|
VR-Engage
2.3
|
DtVreGimbalController extends the base sensor gimbal controller with VRE-specific functionality. It manages the rotation of sensor gimbals to aim sensors at targets, handles laser designation, and provides mechanisms for object tracking. The controller supports both joystick-controlled and AI-controlled gimbal movement. Joystick connection state and the current request count are restored through VreJoystickControllers.Controllers internal state, using the existing sensor interface.
#include <vreGimbalController.h>
Public Member Functions | |
| DtVreGimbalController (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| virtual | ~DtVreGimbalController () override |
| virtual const char * | type () const override |
| virtual bool | init () override |
| virtual void | preFirstTickInit () override |
| virtual void | calcAndSetPortValues (const DtString &functionGroup, const DtString &function, double value, bool repeat) override |
| virtual bool | findLocationOfSensorAiming (const DtVector &location, const DtTaitBryan &orientation, DtVector &aimingPoint) const override |
| virtual const makVrf::DtLaserDesignatorStateComponent * | lookupDesignator () const |
| virtual void | processSetAimGimbal (DtSimMessage *msg) override |
| virtual void | holdCurrentAim () |
| virtual void | updateDesignatorLocation () |
| virtual void | tick () override |
| virtual bool | targetPoint (const DtTaitBryan &orientation, DtVector &location) const override |
Public Member Functions inherited from makVre::DtVreSimComponent< DtSensorGimbalController > | |
| DtVreSimComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| virtual | ~DtVreSimComponent () |
| bool | isPlayerControlled (const std::string &role="") const |
| std::vector< std::string > | controllingStations (const std::string &role) const |
| std::vector< std::string > | engagedRoles () const |
| DtString | entitySystemName () const |
| DtVreSimComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| virtual | ~DtVreSimComponent () |
| bool | isPlayerControlled (const std::string &role="") const |
| std::vector< std::string > | controllingStations (const std::string &role) const |
| std::vector< std::string > | engagedRoles () const |
| DtString | entitySystemName () const |
Static Public Member Functions | |
| static DtSimComponent * | creator (const DtString &name, DtLocalObject *object, DtSimulationServices *simManager, DtComponentDescriptor *compDescriptor, DtReaderWriterRegistry *parentRegistry) |
Protected Member Functions | |
| virtual void | joystickConnected () override |
| virtual void | joystickDisconnected () override |
| virtual void | processJoyDeviceRequest (DtSimMessage *msg) override |
| void | updateJoystickState () |
| void | restoreJoystickState () |
| virtual void | aimSensorAtPoint (const DtVector &worldLocation) override |
| double | checkDistance () const |
| void | increaseCheckDistance () const |
| void | resetCheckDistance () const |
Protected Attributes | |
| DtVreGimbalControllerDescriptor * | myVreGimbalDescriptor |
| double | myMinCheckDistance |
| double | myCurrentCheckDistance |
| double | myMaxCheckDistance |
| int | myLaserCode |
| bool | myContinuousTrack |
| double | myPendingHoldTime = -1.0 |
Private Types | |
| using | Base = DtVreSimComponent<DtSensorGimbalController> |
Private Member Functions | |
| DtVreGimbalController () | |
| DtVreGimbalController (const DtVreGimbalController &orig) | |
| const DtVreGimbalController & | operator= (const DtVreGimbalController &orig) |
Private Attributes | |
| bool | myRestoreJoystickState |
|
private |
| makVre::DtVreGimbalController::DtVreGimbalController | ( | const DtString & | name, |
| DtLocalObject * | owner, | ||
| DtSimulationServices * | simManager, | ||
| DtComponentDescriptor * | desc = 0, | ||
| DtReaderWriterRegistry * | parentRegistry = 0 ) |
Constructor.
| name | The name of this component |
| owner | The local object that owns this component |
| simManager | The simulation services manager |
| desc | Component descriptor with configuration parameters |
| parentRegistry | Optional parent registry for reader/writer functionality |
Creates a new gimbal controller component with the specified parameters.
Referenced by DtVreGimbalController(), and operator=().
|
overridevirtual |
Virtual destructor.
Cleans up resources used by the gimbal controller component.
|
private |
Default constructor (not implemented)
Default constructor is private and not implemented to prevent creation of instances without proper initialization.
|
private |
Copy constructor (not implemented)
Copy constructor is private and not implemented to prevent copy construction.
References DtVreGimbalController().
|
overridevirtual |
Gets the type identifier for this component.
Implements the DtSimComponent::type() method to return the type identifier for this component.
|
overridevirtual |
Initializes the gimbal controller.
Powers on VRE gimbal sensors as soon as the backend component is initialized so first-created frontend sensor views render scene data.
|
overridevirtual |
Runs existing initialization, then restores incoming joystick control.
|
overridevirtual |
Calculates and sets port values based on function input.
| functionGroup | The function group identifier |
| function | The specific function name |
| value | The input value to process |
| repeat | Flag indicating whether the function should repeat |
Processes input from function ports (typically joystick inputs) and applies the appropriate transforms to control the gimbal movement.
|
overridevirtual |
Finds the world location that a sensor is aiming at.
| location | The geocentric location of the sensor |
| orientation | The orientation of the sensor |
| aimingPoint | Output parameter that will contain the aiming point if found |
Determines the world location that a sensor is currently aiming at, based on the sensor's location, orientation, and internal configuration.
|
virtual |
Chooses an appropriate laser designator object as the target to engage.
Searches for and selects an appropriate laser designator object to engage as a target. Uses targetDesignatorValid() to check if each potential target is valid. This method enables sensors to track laser-designated targets.
|
overridevirtual |
Processes a message to set the gimbal aim direction.
| msg | Pointer to the simulation message containing aim parameters |
Handles messages requesting to set the aiming direction of the gimbal. Extracts the target aiming information from the message and applies it to the gimbal controller.
|
virtual |
Stops tracking, keeps the current elevation, and returns azimuth to neutral.
|
virtual |
Updates the current laser designator target location.
Refreshes the stored location of the current laser designator target. This keeps the gimbal controller's understanding of the target position up to date for accurate tracking.
|
overridevirtual |
Updates the controller state each simulation frame.
Overridden to allow object tracking while in joystick mode. This method is called each simulation frame to update the gimbal orientation based on current tracking targets and input controls.
|
overridevirtual |
Determines the target point based on orientation and maximum laser range.
| orientation | The orientation to calculate the target point from |
| location | Output parameter that will contain the target point if found |
Overridden to respect the maximum range of the laser when determining target points. Calculates the point in world space that corresponds to the given orientation and the configured maximum laser range.
|
overrideprotectedvirtual |
Handles joystick connection events.
Keeps the VRE gimbal sensor powered on when a player role takes control of the gimbal joystick function group and persists the current joystick state.
|
overrideprotectedvirtual |
Runs the sensor's normal disconnection hook and persists the disabled state.
|
overrideprotectedvirtual |
Calls the inherited request handler once and persists count-only changes.
| msg | The original joystick device request message. |
|
protected |
Writes the existing sensor interface's enabled flag and exact request count.
|
protected |
Restores incoming state and reconnects the original sensor joystick callback once.
|
overrideprotectedvirtual |
Aims the sensor at a specified world location.
| worldLocation | The geocentric world location to aim at |
Attempts to adjust the gimbal orientation so that the sensor is aimed at the specified world location. Calculates the appropriate azimuth and elevation angles to achieve the desired aiming point.
|
private |
Assignment operator (not implemented)
Assignment operator is private and not implemented to prevent assignment.
References DtVreGimbalController().
|
static |
Factory method to create a new instance of this component.
| name | The name for the new component |
| object | The local object that will own this component |
| simManager | The simulation services manager |
| compDescriptor | Optional component descriptor |
| parentRegistry | Optional parent registry for reader/writer functionality |
Static factory method used by the component creation system to instantiate new instances of this component type.
|
protected |
Gets the current terrain check distance.
Returns the current distance value used for terrain intersection checks. Used to handle terrain loading latency issues by progressively checking at different distances.
|
protected |
Increases the terrain check distance.
Increments the terrain check distance when a previous check fails. Helps handle terrain loading latency by progressively increasing the check distance until terrain is found or the maximum is reached.
|
protected |
Resets the terrain check distance to the minimum value.
Resets the terrain check distance back to the minimum configured value. Called when starting a new series of terrain checks.
|
private |
Remembers incoming conversion until first-tick initialization consumes it.
|
protected |
Pointer to the gimbal controller descriptor.
Contains the configuration parameters for this gimbal controller component.
|
protected |
Minimum distance for terrain intersection checks.
The starting (minimum) distance used for terrain intersection checks. This is the initial value used when resetting the check distance.
|
mutableprotected |
Current distance for terrain intersection checks.
The current distance being used for terrain intersection checks. May be modified during runtime as checks are performed.
|
protected |
Maximum distance for terrain intersection checks.
The maximum distance to use for terrain intersection checks. Once this value is reached, no further increases will occur.
|
protected |
Laser code for designation.
The code used for laser designation. This helps identify specific laser designators when multiple are present in the simulation.
|
protected |
Flag indicating whether continuous tracking is enabled.
When true, indicates that the gimbal should continuously track the target, even in joystick control mode.
|
protected |
Sim time at which a deferred end-of-task hold is applied, or negative if none is pending.