VR-Engage  2.2
Loading...
Searching...
No Matches
vreTurretJoystickController.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreTurretJoystickController.h
7//! \ingroup vreVrfmodel
8//! \brief Controller for joystick-based turret control
9//!
10//! This file defines the DtVreTurretJoystickController class which provides
11//! joystick control functionality for turrets. It extends the base joystick
12//! controller with specific functionality for controlling turret rotation,
13//! elevation, and aiming modes.
14
15#pragma once
16
17#include "vreVrfModel/vreJoystickController.h"
18
19class DtStringOutputPort;
20
21namespace makVre
22{
23
24//! \brief Type identifier for the VRE turret joystick controller component
25const char DtVreTurretJoystickControllerType[] = "vre-turret-joystick-controller";
26
27//! \brief Controller for joystick-based turret control
28//!
29//! DtVreTurretJoystickController extends the base joystick controller to provide
30//! specialized functionality for controlling turrets with joystick inputs. It
31//! automatically creates and manages the appropriate output ports for turret
32//! azimuth, elevation, and aiming mode controls, and translates joystick inputs
33//! into commands that the turret actuator can understand and execute.
34
36{
37public:
38 //! \brief Constructor
39 //! \param name The name of this component
40 //! \param owner The local object that owns this component
41 //! \param simManager The simulation services manager
42 //! \param desc Component descriptor with configuration parameters
43 //! \param parentRegistry Optional parent registry for reader/writer functionality
44 //!
45 //! Creates a new turret joystick controller component with the specified parameters.
46 //! Initializes the controller and sets up the required output ports for turret control.
47 DtVreTurretJoystickController(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
48 DtComponentDescriptor* desc, DtReaderWriterRegistry* parentRegistry = 0);
49
50 //! \brief Virtual destructor
51 //!
52 //! Cleans up resources used by the turret joystick controller component.
54
55 //! \brief Gets the type identifier for this component
56 //! \return String identifying the component type (DtVreTurretJoystickControllerType)
57 //!
58 //! Implements the DtSimComponent::type() method to return the
59 //! type identifier for this component.
60 virtual const char* type() const override;
61
62
63 //! \brief Factory method to create a new instance of this component
64 //! \param name The name for the new component
65 //! \param owner The local object that will own this component
66 //! \param simManager The simulation services manager
67 //! \param desc Optional component descriptor
68 //! \param parentRegistry Optional parent registry for reader/writer functionality
69 //! \return Pointer to the newly created component
70 //!
71 //! Static factory method used by the component creation system to instantiate
72 //! new instances of this component type.
73 static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
74 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
75
76private:
77 //! \brief Default constructor (not implemented)
78 //!
79 //! Default constructor is private and not implemented to prevent
80 //! creation of instances without proper initialization.
82
83 //! \brief Copy constructor (not implemented)
84 //!
85 //! Copy constructor is private and not implemented to prevent
86 //! copy construction.
88
89 //! \brief Assignment operator (not implemented)
90 //! \return Reference to this object
91 //!
92 //! Assignment operator is private and not implemented to prevent assignment.
94
95protected:
96 //! \brief Processes joystick input and sets corresponding port values
97 //! \param functionGroup The function group identifier for the input
98 //! \param function The specific function name for the input
99 //! \param value The input value (typically in range [-1.0, 1.0])
100 //! \param repeat Flag indicating whether the function should repeat
101 //!
102 //! Handles joystick input by translating joystick function calls into
103 //! appropriate turret control values. Maps joystick axes and buttons
104 //! to turret azimuth, elevation, and aiming mode controls.
106 const DtString& functionGroup, const DtString& function, double value, bool repeat) override;
107
108 //! \brief Creates input and output ports for the component
109 //! \return True if ports are successfully created, false otherwise
110 //!
111 //! Creates the output ports needed by this component for turret control,
112 //! including ports for azimuth, elevation, and aiming mode. These ports
113 //! connect to the turret actuator component.
114 virtual bool createPorts() override;
115
116 //! \brief Output port for the turret aiming mode
117 //!
118 //! String output port that specifies the current aiming mode for the turret.
119 //! This can be used to switch between different aiming behaviors such as
120 //! direct aim, lead aim, or other specialized aiming modes.
121 DtStringOutputPort* myAimingModePort;
122};
123
124} // namespace makVre
DtVreJoystickController(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
virtual ~DtVreTurretJoystickController() override
Virtual destructor.
virtual const char * type() const override
Gets the type identifier for this component.
DtVreTurretJoystickController(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
DtVreTurretJoystickController()
Default constructor (not implemented)
DtVreTurretJoystickController(const DtVreJoystickController &orig)
Copy constructor (not implemented)
virtual bool createPorts() override
Creates input and output ports for the component.
DtVreTurretJoystickController & operator=(const DtVreTurretJoystickController &orig)
Assignment operator (not implemented)
DtStringOutputPort * myAimingModePort
Output port for the turret aiming mode.
Definition vreTurretJoystickController.h:121
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.
virtual void calcAndSetPortValues(const DtString &functionGroup, const DtString &function, double value, bool repeat) override
Processes joystick input and sets corresponding port values.
#define VREVRFMODEL_DLL
Definition export.h:22
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
const char DtVreTurretJoystickControllerType[]
Type identifier for the VRE turret joystick controller component.
Definition vreTurretJoystickController.h:25