VR-Engage  2.2
Loading...
Searching...
No Matches
vreGimbalController.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreGimbalController.h
7//! \ingroup vreVrfmodel
8//! \brief Controller for sensor gimbal movement and targeting
9//!
10//! This file defines the DtVreGimbalController class which extends the base sensor
11//! gimbal controller with VRE-specific functionality. It provides mechanisms for
12//! controlling sensor gimbal movement, targeting, and laser designation.
13
14#pragma once
15
16#include "vreVrfmodel/export.h"
17#include <vrfmodel/sensorGimbalController.h>
18#include "vreVrfModel/vreSimComponent.h"
19
20#include <matrix/vlVector.h>
21#include <matrix/vlTaitBryan.h>
22
23namespace makVrf
24{
25class DtLaserDesignatorStateComponent;
26}
27
28namespace makVre
29{
30class DtVreGimbalControllerDescriptor;
31
32//! \brief Type identifier for the VRE sensor gimbal controller component
33const char DtVreGimbalControllerType[] = "vre-sensor-gimbal-controller";
34
35//! \brief Controller for sensor gimbal movement and targeting
36//!
37//! DtVreGimbalController extends the base sensor gimbal controller with VRE-specific
38//! functionality. It manages the rotation of sensor gimbals to aim sensors at targets,
39//! handles laser designation, and provides mechanisms for object tracking. The controller
40//! supports both joystick-controlled and AI-controlled gimbal movement.
41class VREVRFMODEL_DLL DtVreGimbalController : public DtVreSimComponent<DtSensorGimbalController>
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 gimbal controller component with the specified parameters.
52 DtVreGimbalController(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
53 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
54
55 //! \brief Virtual destructor
56 //!
57 //! Cleans up resources used by the gimbal controller component.
58 virtual ~DtVreGimbalController() override;
59
60 //! \brief Gets the type identifier for this component
61 //! \return String identifying the component type (DtVreGimbalControllerType)
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 Calculates and sets port values based on function input
68 //! \param functionGroup The function group identifier
69 //! \param function The specific function name
70 //! \param value The input value to process
71 //! \param repeat Flag indicating whether the function should repeat
72 //!
73 //! Processes input from function ports (typically joystick inputs) and
74 //! applies the appropriate transforms to control the gimbal movement.
76 const DtString& functionGroup, const DtString& function, double value, bool repeat) override;
77
78 //! \brief Finds the world location that a sensor is aiming at
79 //! \param location The geocentric location of the sensor
80 //! \param orientation The orientation of the sensor
81 //! \param aimingPoint Output parameter that will contain the aiming point if found
82 //! \return True if an aiming point was successfully found, false otherwise
83 //!
84 //! Determines the world location that a sensor is currently aiming at,
85 //! based on the sensor's location, orientation, and internal configuration.
87 const DtVector& location, const DtTaitBryan& orientation, DtVector& aimingPoint) const override;
88
89 //! \brief Chooses an appropriate laser designator object as the target to engage
90 //! \return Pointer to the selected designator component, or NULL if no valid target found
91 //!
92 //! Searches for and selects an appropriate laser designator object to engage as
93 //! a target. Uses targetDesignatorValid() to check if each potential target is valid.
94 //! This method enables sensors to track laser-designated targets.
95 virtual const makVrf::DtLaserDesignatorStateComponent* lookupDesignator() const;
96
97 //! \brief Processes a message to set the gimbal aim direction
98 //! \param msg Pointer to the simulation message containing aim parameters
99 //!
100 //! Handles messages requesting to set the aiming direction of the gimbal.
101 //! Extracts the target aiming information from the message and applies it
102 //! to the gimbal controller.
103 virtual void processSetAimGimbal(DtSimMessage* msg) override;
104
105 //! \brief Updates the current laser designator target location
106 //!
107 //! Refreshes the stored location of the current laser designator target.
108 //! This keeps the gimbal controller's understanding of the target position
109 //! up to date for accurate tracking.
111
112 //! \brief Updates the controller state each simulation frame
113 //!
114 //! Overridden to allow object tracking while in joystick mode. This method
115 //! is called each simulation frame to update the gimbal orientation based
116 //! on current tracking targets and input controls.
117 virtual void tick() override;
118
119 //! \brief Determines the target point based on orientation and maximum laser range
120 //! \param orientation The orientation to calculate the target point from
121 //! \param location Output parameter that will contain the target point if found
122 //! \return True if a target point was successfully found, false otherwise
123 //!
124 //! Overridden to respect the maximum range of the laser when determining target points.
125 //! Calculates the point in world space that corresponds to the given orientation
126 //! and the configured maximum laser range.
127 virtual bool targetPoint(const DtTaitBryan& orientation, DtVector& location) const override;
128
129protected:
130 //! \brief Aims the sensor at a specified world location
131 //! \param worldLocation The geocentric world location to aim at
132 //!
133 //! Attempts to adjust the gimbal orientation so that the sensor is aimed
134 //! at the specified world location. Calculates the appropriate azimuth and
135 //! elevation angles to achieve the desired aiming point.
136 virtual void aimSensorAtPoint(const DtVector& worldLocation) override;
137
138private:
139 //! \brief Default constructor (not implemented)
140 //!
141 //! Default constructor is private and not implemented to prevent
142 //! creation of instances without proper initialization.
144
145 //! \brief Copy constructor (not implemented)
146 //!
147 //! Copy constructor is private and not implemented to prevent
148 //! copy construction.
150
151 //! \brief Assignment operator (not implemented)
152 //! \return Reference to this object
153 //!
154 //! Assignment operator is private and not implemented to prevent assignment.
156
157public:
158 //! \brief Factory method to create a new instance of this component
159 //! \param name The name for the new component
160 //! \param object The local object that will own this component
161 //! \param simManager The simulation services manager
162 //! \param compDescriptor Optional component descriptor
163 //! \param parentRegistry Optional parent registry for reader/writer functionality
164 //! \return Pointer to the newly created component
165 //!
166 //! Static factory method used by the component creation system to instantiate
167 //! new instances of this component type.
168 static DtSimComponent* creator(const DtString& name, DtLocalObject* object, DtSimulationServices* simManager,
169 DtComponentDescriptor* compDescriptor, DtReaderWriterRegistry* parentRegistry);
170
171protected:
172 //! \brief Pointer to the gimbal controller descriptor
173 //!
174 //! Contains the configuration parameters for this gimbal controller component.
175 DtVreGimbalControllerDescriptor* myVreGimbalDescriptor;
176
177 //! \brief Gets the current terrain check distance
178 //! \return The current distance to check for terrain intersections
179 //!
180 //! Returns the current distance value used for terrain intersection checks.
181 //! Used to handle terrain loading latency issues by progressively checking
182 //! at different distances.
183 double checkDistance() const;
184
185 //! \brief Increases the terrain check distance
186 //!
187 //! Increments the terrain check distance when a previous check fails.
188 //! Helps handle terrain loading latency by progressively increasing the
189 //! check distance until terrain is found or the maximum is reached.
191
192 //! \brief Resets the terrain check distance to the minimum value
193 //!
194 //! Resets the terrain check distance back to the minimum configured value.
195 //! Called when starting a new series of terrain checks.
196 void resetCheckDistance() const;
197
198 //! \brief Minimum distance for terrain intersection checks
199 //!
200 //! The starting (minimum) distance used for terrain intersection checks.
201 //! This is the initial value used when resetting the check distance.
203
204 //! \brief Current distance for terrain intersection checks
205 //!
206 //! The current distance being used for terrain intersection checks.
207 //! May be modified during runtime as checks are performed.
209
210 //! \brief Maximum distance for terrain intersection checks
211 //!
212 //! The maximum distance to use for terrain intersection checks.
213 //! Once this value is reached, no further increases will occur.
215
216 //! \brief Laser code for designation
217 //!
218 //! The code used for laser designation. This helps identify specific
219 //! laser designators when multiple are present in the simulation.
221
222 //! \brief Flag indicating whether continuous tracking is enabled
223 //!
224 //! When true, indicates that the gimbal should continuously track
225 //! the target, even in joystick control mode.
227};
228
229} // namespace makVre
double checkDistance() const
Gets the current terrain check distance.
virtual ~DtVreGimbalController() override
Virtual destructor.
void resetCheckDistance() const
Resets the terrain check distance to the minimum value.
double myCurrentCheckDistance
Current distance for terrain intersection checks.
Definition vreGimbalController.h:208
virtual void tick() override
Updates the controller state each simulation frame.
DtVreGimbalController()
Default constructor (not implemented)
virtual bool targetPoint(const DtTaitBryan &orientation, DtVector &location) const override
Determines the target point based on orientation and maximum laser range.
virtual void aimSensorAtPoint(const DtVector &worldLocation) override
Aims the sensor at a specified world location.
DtVreGimbalController(const DtVreGimbalController &orig)
Copy constructor (not implemented)
int myLaserCode
Laser code for designation.
Definition vreGimbalController.h:220
void increaseCheckDistance() const
Increases the terrain check distance.
virtual void updateDesignatorLocation()
Updates the current laser designator target location.
virtual void calcAndSetPortValues(const DtString &functionGroup, const DtString &function, double value, bool repeat) override
Calculates and sets port values based on function input.
static DtSimComponent * creator(const DtString &name, DtLocalObject *object, DtSimulationServices *simManager, DtComponentDescriptor *compDescriptor, DtReaderWriterRegistry *parentRegistry)
Factory method to create a new instance of this component.
const DtVreGimbalController & operator=(const DtVreGimbalController &orig)
Assignment operator (not implemented)
virtual const char * type() const override
Gets the type identifier for this component.
DtVreGimbalControllerDescriptor * myVreGimbalDescriptor
Pointer to the gimbal controller descriptor.
Definition vreGimbalController.h:175
virtual void processSetAimGimbal(DtSimMessage *msg) override
Processes a message to set the gimbal aim direction.
DtVreGimbalController(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
double myMaxCheckDistance
Maximum distance for terrain intersection checks.
Definition vreGimbalController.h:214
virtual const makVrf::DtLaserDesignatorStateComponent * lookupDesignator() const
Chooses an appropriate laser designator object as the target to engage.
double myMinCheckDistance
Minimum distance for terrain intersection checks.
Definition vreGimbalController.h:202
virtual bool findLocationOfSensorAiming(const DtVector &location, const DtTaitBryan &orientation, DtVector &aimingPoint) const override
Finds the world location that a sensor is aiming at.
bool myContinuousTrack
Flag indicating whether continuous tracking is enabled.
Definition vreGimbalController.h:226
DtVreSimComponent(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Definition vreSimComponent.h:54
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 DtVreGimbalControllerType[]
Type identifier for the VRE sensor gimbal controller component.
Definition vreGimbalController.h:33
Definition connectorAccessory.h:39