VR-Engage  2.2
Loading...
Searching...
No Matches
rotaryWingJoyFlightController.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file rotaryWingJoyFlightController.h
7//! \ingroup vreVrfmodel
8//! \brief Controller for joystick-based rotary-wing aircraft flight control
9//!
10//! This file defines the DtRotaryWingJoyFlightController class which provides
11//! joystick control functionality for rotary-wing aircraft. It extends the base
12//! rotary wing pilot controller to map joystick inputs to helicopter flight controls.
13
14#pragma once
15
16#include "vreVrfmodel/export.h"
17#include <vrfmodel/rotaryWingPilotController.h>
18#include <vrfmodel/joystickControllerInterface.h>
19
20class DtString;
21class DtSimulationServices;
22class DtJoyDeviceControllerDescriptor;
23class DtJoyDevice;
24
25namespace makVre
26{
27//! \brief Type identifier for the rotary wing joystick flight controller component
28const char DtRotaryWingJoyFlightControllerType[] = "rotary-wing-joy-flight-controller";
29
30//! \brief Controller for joystick-based rotary-wing aircraft flight control
31//!
32//! DtRotaryWingJoyFlightController extends the base rotary wing pilot controller
33//! to provide joystick control functionality for helicopters and other rotary-wing
34//! aircraft. It translates joystick inputs into appropriate control commands for
35//! cyclic, collective, and anti-torque controls, managing the complex flight
36//! dynamics of rotary-wing vehicles.
37//!
38//! The controller includes stabilization functionality with configurable gains
39//! to assist pilot control while still allowing for realistic helicopter flight
40//! characteristics.
41//!
42//! Uses Descriptor Type: DtRotaryWingPilotDescriptor
43class VREVRFMODEL_DLL DtRotaryWingJoyFlightController : public DtRotaryWingPilotController,
44 public DtJoystickControllerInterface
45{
46public:
47 //! \brief Constructor
48 //! \param name The name of this component
49 //! \param owner The local object that owns this component
50 //! \param simManager The simulation services manager
51 //! \param desc Component descriptor with configuration parameters
52 //! \param parentRegistry Optional parent registry for reader/writer functionality
53 //!
54 //! Creates a new rotary wing joystick flight controller component with the specified parameters.
55 //! Initializes control gains and joystick input mappings for helicopter flight control.
56 DtRotaryWingJoyFlightController(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
57 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
58
59 //! \brief Virtual destructor
60 //!
61 //! Cleans up resources used by the rotary wing joystick flight controller component.
63
64 //! \brief Initializes the controller
65 //! \return True if initialization was successful, false otherwise
66 //!
67 //! Initializes the rotary wing joystick flight controller, setting up control
68 //! gains and registering with the joystick system. Called during component creation.
69 virtual bool init() override;
70
71 //! \brief Gets the type identifier for this component
72 //! \return String identifying the component type (DtRotaryWingJoyFlightControllerType)
73 //!
74 //! Implements the DtSimComponent::type() method to return the
75 //! type identifier for this component.
76 virtual const char* type() const override;
77
78 //! \brief Factory method to create a new instance of this component
79 //! \param name The name for the new component
80 //! \param owner The local object that will own this component
81 //! \param simManager The simulation services manager
82 //! \param desc Optional component descriptor
83 //! \param parentRegistry Optional parent registry for reader/writer functionality
84 //! \return Pointer to the newly created component
85 //!
86 //! Static factory method used by the component creation system to instantiate
87 //! new instances of this component type.
88 static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
89 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
90
91protected:
92 //! \brief Calculates stabilizing control gains for rotary wing flight
93 //! \param manuverConst Maneuverability constant affecting control responsiveness
94 //! \param riseTime Time to desired rise in response to control inputs
95 //! \param velGain Output parameter for calculated velocity gain
96 //! \param oriGain Output parameter for calculated orientation gain
97 //!
98 //! Calculates stabilizing gains using the input parameters and internal
99 //! configuration. These gains are used to establish the proper balance between
100 //! control responsiveness and stability for the rotary wing aircraft.
101 virtual void calculateGains(const DtReal manuverConst, const DtReal riseTime, DtReal& velGain, DtReal& oriGain);
102
103 //! \brief Processes joystick input and sets corresponding port values
104 //! \param functionGroup The function group identifier for the input
105 //! \param function The specific function name for the input
106 //! \param value The input value (typically in range [-1.0, 1.0])
107 //! \param repeat Flag indicating whether the function should repeat
108 //!
109 //! Handles joystick input by translating joystick function calls into
110 //! appropriate helicopter control values. Maps joystick axes and buttons
111 //! to cyclic, collective, and anti-torque controls for rotary wing flight.
113 const DtString& functionGroup, const DtString& function, double value, bool repeat) override;
114 //! \brief Handles joystick connection events
115 //!
116 //! Required by the DtJoystickControllerInterface. Called when a joystick
117 //! is connected to the system. Sets up initial joystick mappings and
118 //! prepares the controller to receive joystick inputs.
119 virtual void joystickConnected() override;
120 //! \brief Handles joystick disconnection events
121 //!
122 //! Required by the DtJoystickControllerInterface. Called when a joystick
123 //! is disconnected from the system. Ensures the controller gracefully
124 //! handles the loss of joystick input.
125 virtual void joystickDisconnected() override;
126
127protected:
128 //! \brief Default constructor (not implemented)
129 //!
130 //! Default constructor is protected and not implemented to prevent
131 //! creation of instances without proper initialization.
133
134 //! \brief Copy constructor (not implemented)
135 //!
136 //! Copy constructor is protected and not implemented to prevent
137 //! copy construction.
139
140 //! \brief Assignment operator (not implemented)
141 //! \return Reference to this object
142 //!
143 //! Assignment operator is protected and not implemented to prevent assignment.
145
146protected:
147 //! \brief Feedback gain for the pitch angular velocity control
148 //!
149 //! Controls the responsiveness of the pitch rate to joystick inputs.
150 //! Higher values result in faster pitch rate changes.
152
153 //! \brief Feedback gain for the pitch orientation control
154 //!
155 //! Controls the responsiveness of the pitch angle to joystick inputs.
156 //! Higher values result in more direct pitch angle control.
158
159 //! \brief Feedback gain for the roll angular velocity control
160 //!
161 //! Controls the responsiveness of the roll rate to joystick inputs.
162 //! Higher values result in faster roll rate changes.
164
165 //! \brief Feedback gain for the roll orientation control
166 //!
167 //! Controls the responsiveness of the roll angle to joystick inputs.
168 //! Higher values result in more direct roll angle control.
170
171 //! \brief Feedback gain for the yaw angular velocity control
172 //!
173 //! Controls the responsiveness of the yaw rate to joystick inputs.
174 //! Higher values result in faster yaw rate changes.
176
177 //! \brief Feedback gain for the yaw orientation control
178 //!
179 //! Controls the responsiveness of the yaw angle to joystick inputs.
180 //! Higher values result in more direct yaw angle control.
182};
183} // namespace makVre
virtual const char * type() const override
Gets the type identifier for this component.
virtual bool init() override
Initializes the controller.
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.
DtReal myRollOriGain
Feedback gain for the roll orientation control.
Definition rotaryWingJoyFlightController.h:169
virtual void joystickDisconnected() override
Handles joystick disconnection events.
DtReal myRollVelGain
Feedback gain for the roll angular velocity control.
Definition rotaryWingJoyFlightController.h:163
DtReal myYawOriGain
Feedback gain for the yaw orientation control.
Definition rotaryWingJoyFlightController.h:181
DtRotaryWingJoyFlightController()
Default constructor (not implemented)
virtual ~DtRotaryWingJoyFlightController() override
Virtual destructor.
DtRotaryWingJoyFlightController & operator=(const DtRotaryWingJoyFlightController &orig)
Assignment operator (not implemented)
DtReal myYawVelGain
Feedback gain for the yaw angular velocity control.
Definition rotaryWingJoyFlightController.h:175
DtRotaryWingJoyFlightController(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
DtRotaryWingJoyFlightController(const DtRotaryWingJoyFlightController &orig)
Copy constructor (not implemented)
DtReal myPitchVelGain
Feedback gain for the pitch angular velocity control.
Definition rotaryWingJoyFlightController.h:151
virtual void calculateGains(const DtReal manuverConst, const DtReal riseTime, DtReal &velGain, DtReal &oriGain)
Calculates stabilizing control gains for rotary wing flight.
DtReal myPitchOriGain
Feedback gain for the pitch orientation control.
Definition rotaryWingJoyFlightController.h:157
virtual void joystickConnected() override
Handles joystick connection events.
virtual void calcAndSetPortValues(const DtString &functionGroup, const DtString &function, double value, bool repeat) override
Processes joystick input and sets corresponding port values.
Defines export macros for the vreVrfmodel library.
#define VREVRFMODEL_DLL
Definition export.h:22
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
const char DtRotaryWingJoyFlightControllerType[]
Type identifier for the rotary wing joystick flight controller component.
Definition rotaryWingJoyFlightController.h:28