VR-Engage  2.3
Loading...
Searching...
No Matches
groundJoyTurretController.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file groundJoyTurretController.h
7//! \ingroup vreVrfmodel
8//! \brief Joystick controller for ground vehicle turrets
9//!
10//! This file defines the DtGroundJoyTurretController class which extends
11//! the turret slew controller with joystick input capabilities, allowing
12//! for direct manual control of ground vehicle turrets.
13
14#pragma once
15
16#include "vreVrfmodel/export.h"
17
18#include <vrfmodel/turretSlewController.h>
20#include <vrfobjcore/simRadio.h>
21
22class DtString;
23class DtSimulationServices;
24class DtJoyDeviceControllerDescriptor;
25
26//! \brief Type identifier for the ground turret joystick controller component
27const char DtGroundJoyTurretControllerType[] = "ground-turret-joystick-controller";
28
29namespace makVre
30{
31//! \brief Controller for joystick control of ground vehicle turrets
32//!
33//! DtGroundJoyTurretController extends the turret slew controller with
34//! joystick input capabilities, allowing direct manual control of ground
35//! vehicle turrets. It implements the DtVreJoystickControllerInterface to
36//! process input from joystick devices and translate it to appropriate
37//! turret control outputs.
38//!
39//! Uses Descriptor Type: DtTurretJoyDeviceControllerDescriptor
40class VREVRFMODEL_DLL DtGroundJoyTurretController : public DtTurretSlewController,
42{
43public:
44 //! \brief Constructor
45 //! \param name The name of this component
46 //! \param owner The local object that owns this component
47 //! \param simManager The simulation services manager
48 //! \param desc Component descriptor with configuration parameters
49 //! \param parentRegistry Optional parent registry for reader/writer functionality
50 //!
51 //! Creates a new ground turret joystick controller component with the specified parameters.
52 DtGroundJoyTurretController(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
53 DtComponentDescriptor* desc, DtReaderWriterRegistry* parentRegistry = 0);
54
55 //! \brief Virtual destructor
56 //!
57 //! Cleans up resources used by the ground turret joystick controller component.
58 virtual ~DtGroundJoyTurretController() override;
59
60 //! \brief Gets the type identifier for this component
61 //! \return String identifying the component type (DtGroundJoyTurretControllerType)
62 //!
63 //! Implements the DtSimComponent::type() method to return the
64 //! type identifier for this component.
65 virtual const char* type() const override;
66
67 //! \brief Calls base first-tick initialization and restores incoming joystick state.
68 virtual void preFirstTickInit() override;
69
70 //! \brief Factory method to create a new instance of this component
71 //! \param name The name for the new component
72 //! \param owner The local object that will own this component
73 //! \param simManager The simulation services manager
74 //! \param desc Optional component descriptor
75 //! \param parentRegistry Optional parent registry for reader/writer functionality
76 //! \return Pointer to the newly created component
77 //!
78 //! Static factory method used by the component creation system to instantiate
79 //! new instances of this component type.
80 static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
81 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
82
83protected:
84 //! \brief Processes joystick input and updates output ports
85 //! \param functionGroup The function group identifier for the input
86 //! \param function The specific function identifier within the group
87 //! \param value The input value from the joystick
88 //! \param repeat Flag indicating if this is a repeated input
89 //!
90 //! Implements the DtJoystickControllerInterface method to process joystick
91 //! input and update the controller's output ports accordingly for turret control.
93 const DtString& functionGroup, const DtString& function, double value, bool repeat) override;
94
95 //! \brief Handles joystick connection event
96 //!
97 //! Called when a joystick is connected to the system.
98 //! Activates joystick control mode for this turret controller.
99 virtual void joystickConnected() override;
100
101 //! \brief Handles joystick disconnection event
102 //!
103 //! Called when a joystick is disconnected from the system.
104 //! Deactivates joystick control mode for this turret controller.
105 virtual void joystickDisconnected() override;
106
107private:
108 //! \brief Default constructor (not implemented)
109 //!
110 //! Default constructor is private and not implemented to prevent
111 //! creation of instances without proper initialization.
113
114 //! \brief Assignment operator (not implemented)
115 //! \return Reference to this object
116 //!
117 //! Assignment operator is private and not implemented to prevent assignment.
119
120 //! \brief Copy constructor (not implemented)
121 //!
122 //! Copy constructor is private and not implemented to prevent
123 //! copy construction.
125};
126} // namespace makVre
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Factory method to create a new instance of this component.
DtGroundJoyTurretController()
Default constructor (not implemented)
virtual void joystickDisconnected() override
Handles joystick disconnection event.
virtual ~DtGroundJoyTurretController() override
Virtual destructor.
virtual void joystickConnected() override
Handles joystick connection event.
DtGroundJoyTurretController & operator=(const DtGroundJoyTurretController &orig)
Assignment operator (not implemented)
DtGroundJoyTurretController(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
virtual void calcAndSetPortValues(const DtString &functionGroup, const DtString &function, double value, bool repeat) override
Processes joystick input and updates output ports.
virtual void preFirstTickInit() override
Calls base first-tick initialization and restores incoming joystick state.
virtual const char * type() const override
Gets the type identifier for this component.
DtGroundJoyTurretController(const DtGroundJoyTurretController &orig)
Copy constructor (not implemented)
DtVreJoystickControllerInterface(DtSimComponent *component, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc)
Constructs an interface alongside an existing component base.
const char DtGroundJoyTurretControllerType[]
Type identifier for the ground turret joystick controller component.
Definition groundJoyTurretController.h:27
Defines export macros for the vreVrfmodel library.
#define VREVRFMODEL_DLL
Definition export.h:22
!
Definition glsVreMessageUtil.h:50
Internal-state persistence for VRE joystick controllers.