VR-Engage  2.3
Loading...
Searching...
No Matches
makVre::DtCommanderControlLogic Class Reference

Detailed Description

The DtCommanderControlLogic provides control functionality for vehicle commander sensor systems, supporting orientation in azimuth and elevation, zoom control, and the ability to switch between different sensor modes (e.g., IR, NVG, visual).

Input handler details (for configuring in an SMS input configuration file):

This class has the following input handler functions that may be configured to map to input devices in role input configuration files:

  • "sensor-azimuth": Controls horizontal rotation of the sensor
  • "sensor-elevation": Controls vertical tilt of the sensor
  • "sensor-zoom-in": Increases sensor magnification
  • "sensor-zoom-out": Decreases sensor magnification
  • "sensor-zoom": Combined zoom in/out based on positive/negative values
  • "next-sensor": Cycles through available sensor modes

The group name is provided in the role configuration file and is used to distinguish input handlers when multiple handlers are present on the entity.

#include <commanderControlLogic.h>

Inheritance diagram for makVre::DtCommanderControlLogic:
[legend]

Public Member Functions

 DtCommanderControlLogic ()
 
virtual ~DtCommanderControlLogic () override
 
virtual bool initialize (makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
 
virtual bool postInitialize () override
 
virtual void tick (double dt) override
 
virtual void shutdown () override
 
virtual const char * type () const override
 
virtual void azimuth (double val)
 
virtual void elevation (double val)
 
virtual void zoomIn (double val)
 
virtual void zoomOut (double val)
 
virtual void zoom (float val)
 
virtual void nextSensor (double val)
 
virtual makVre::DtVreMessageResult handleMenuMessage (makVre::DtVreMessage *msg)
 
- Public Member Functions inherited from makVre::DtEntityControlLogic
 DtEntityControlLogic ()
 
virtual ~DtEntityControlLogic () override
 
virtual void setMouseControlEnabled (bool enabled)
 
virtual bool isMouseControlEnabled ()
 
virtual bool isMouseControlSupportAllowed () const
 
virtual void setMouseControlSupportAllowed (bool enable)
 
virtual const std::vector< std::string > & joystickGroups () const
 
virtual void sendJoystickCommand (const DtEntityIdentifier &id, const std::string &functionGroup, const std::string &function, double val, bool repeat=false)
 
virtual makVre::DtVreMessageResult handleSimState (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleReset (makVre::DtVreMessage *message)
 
virtual makVre::DtVreMessageResult handleCreationStatus (makVre::DtVreMessage *message)
 
virtual void reset (float val)
 
virtual void resetInPlace (float val)
 
virtual void toggleMouseControl (float val)
 
virtual void enableMouseControl (float val)
 
virtual makVre::DtVreMessageResult handleFocusMessage (makVre::DtVreMessage *message)
 
- Public Member Functions inherited from makVre::DtPlayerComponent
 DtPlayerComponent ()
 
virtual ~DtPlayerComponent ()
 
bool componentReady () const
 
void setComponentReady (bool ready)
 
virtual DtInitTickStatus finalizeInitTick (double dt)
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStation & player ()
 
virtual DtAttributeHandle & playerAttributeStore ()
 
virtual const DtAttributeHandle & playerAttributeStore () const
 
virtual const DtAttributeHandle & ownshipState () const
 
virtual void setExtendedData (const std::string &key, const std::string &value, DtEntityIdentifier entity=DtEntityIdentifier::nullId())
 

Protected Attributes

DtInputLogic myInputLogic
 
std::string myMainControlGroup
 
bool myOutTheHatchMode
 
float myAzimuthInput
 
float myElevationInput
 
float myMaxZoom
 
float myMinZoom
 
bool myEnableZoom
 
DtAttributeHandleType< int > myCurrentSensorAttr
 
DtAttributeHandleType< bool > myZoomChangedAttr
 
DtAttributeHandleType< double > myObserverYawAttr
 
DtAttributeHandleType< double > myObserverPitchAttr
 
DtAttributeHandleType< double > myZoomAttr
 
DtAttributeHandleType< double > myMagnificationAttr
 
DtAttributeHandleType< double > myAimInputScaleAttr
 
DtAttributeHandleType< std::vector< std::string > > mySensorModesAttr
 
- Protected Attributes inherited from makVre::DtEntityControlLogic
std::vector< std::string > myJoystickFunctionGroups
 
DtInputLogic myCommonInputLogic
 
std::string myInputConfigFile
 
bool myMouseControlEnabled
 
bool myMouseControlSupportAllowed
 
DtAttributeHandle myOwnshipAttr
 
DtAttributeHandleType< bool > myEmbarkedAttr
 
DtAttributeHandleType< DtEntityIdentifier > myEmbarkedHostAttr
 
DtAttributeHandleType< DtEntityType > myEmbarkedHostTypeAttr
 
DtAttributeHandleType< std::string > myEmbarkedHostMarkingAttr
 
DtAttributeHandleType< bool > myEmbarkedOnAircraftAttr
 
DtAttributeHandleType< std::string > myEmbarkedInSlotAttr
 
DtAttributeHandleType< unsigned int > myAppearanceAttr
 
DtAttributeHandleType< DtVector > myPositionAttr
 
DtAttributeHandleType< DtTaitBryan > myOrientationAttr
 
DtAttributeHandleType< double > mySpeedAttr
 
DtAttributeHandleType< DtVector32 > myVelocityAttr
 
DtAttributeHandleType< DtVector32 > myAccelerationAttr
 
DtAttributeHandleType< DtVector32 > myRotVelAttr
 
DtAttributeHandleType< DtEntityType > myEntityTypeAttr
 
DtAttributeHandleType< DtVector32 > myRelativeVelocityAttr
 
DtAttributeHandleType< DtDamageState > myDamageStateAttr
 
DtAttributeHandleType< int > mySimStateUpdateIndexAttr
 
DtAttributeHandleType< bool > myHideOccupantsAttr
 
- Protected Attributes inherited from makVre::DtPlayerComponent
bool myComponentReady = true
 
std::string myName
 
DtInitTable myConfig
 
DtPlayerStation * myPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolver * myResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 
DtVreMessageHandlerGroup myMessageHandlers
 

Additional Inherited Members

- Protected Member Functions inherited from makVre::DtEntityControlLogic
bool requiresControl () const
 
bool isAirborne () const
 
void showNotification (const QString &text, double duration)
 
virtual void takeControlOfPlayerEntity ()
 
virtual void releaseControlOfPlayerEntity ()
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Constructor & Destructor Documentation

◆ DtCommanderControlLogic()

makVre::DtCommanderControlLogic::DtCommanderControlLogic ( )

Constructor for DtCommanderControlLogic.

Initializes the component with the name "DtCommanderControlLogic" and default values. Also checks out the required VR Engage Ground license.

◆ ~DtCommanderControlLogic()

virtual makVre::DtCommanderControlLogic::~DtCommanderControlLogic ( )
overridevirtual

Virtual destructor for DtCommanderControlLogic.

Member Function Documentation

◆ initialize()

virtual bool makVre::DtCommanderControlLogic::initialize ( makVre::DtPlayerStation * player,
makVre::DtInitTable & config )
overridevirtual

Initializes the component with configuration from Lua.

Sets up input handlers, zoom limits, and initializes state attributes needed for sensor control. Configures the component based on provided configuration.

Parameters
playerPointer to the player station this component belongs to
configConfiguration table containing initialization parameters
Returns
True if initialization succeeds, false otherwise

Reimplemented from makVre::DtEntityControlLogic.

References makVre::DtPlayerComponent::player().

◆ postInitialize()

virtual bool makVre::DtCommanderControlLogic::postInitialize ( )
overridevirtual

Performs post-initialization setup.

Sets up input handler callbacks after all components have been initialized.

Returns
True if post-initialization succeeds, false otherwise

Reimplemented from makVre::DtEntityControlLogic.

◆ tick()

virtual void makVre::DtCommanderControlLogic::tick ( double dt)
overridevirtual

Updates the component state.

Called each frame to handle sensor control logic, particularly handling special cases like "out the hatch" mode.

Parameters
dtDelta time in seconds since the last tick

Reimplemented from makVre::DtEntityControlLogic.

◆ shutdown()

virtual void makVre::DtCommanderControlLogic::shutdown ( )
overridevirtual

Shuts down the component.

Cleans up resources and disconnects input handlers.

Reimplemented from makVre::DtEntityControlLogic.

◆ type()

virtual const char * makVre::DtCommanderControlLogic::type ( ) const
overridevirtual

Returns the component type identifier.

Returns
The component type string

Reimplemented from makVre::DtEntityControlLogic.

◆ azimuth()

virtual void makVre::DtCommanderControlLogic::azimuth ( double val)
virtual

Input handler for sensor azimuth (horizontal) control.

Controls the horizontal rotation of the sensor. In normal mode, sends joystick messages scaled by the current zoom level. In "out the hatch" mode, stores the input value for processing during tick().

Parameters
valThe azimuth input value, typically from -1.0 to 1.0

◆ elevation()

virtual void makVre::DtCommanderControlLogic::elevation ( double val)
virtual

Input handler for sensor elevation (vertical) control.

Controls the vertical tilt of the sensor. In normal mode, sends joystick messages scaled by the current zoom level. In "out the hatch" mode, stores the input value for processing during tick().

Parameters
valThe elevation input value, typically from -1.0 to 1.0

◆ zoomIn()

virtual void makVre::DtCommanderControlLogic::zoomIn ( double val)
virtual

Input handler for zoom in functionality.

Increases the sensor's magnification level by a factor of 2, up to the configured maximum zoom level.

Parameters
valThe zoom in input value, positive values trigger zoom

◆ zoomOut()

virtual void makVre::DtCommanderControlLogic::zoomOut ( double val)
virtual

Input handler for zoom out functionality.

Decreases the sensor's magnification level by a factor of 0.5, down to the configured minimum zoom level.

Parameters
valThe zoom out input value, positive values trigger zoom

◆ zoom()

virtual void makVre::DtCommanderControlLogic::zoom ( float val)
virtual

Combined input handler for zoom functionality.

Routes to zoomIn or zoomOut based on whether the input value is positive or negative.

Parameters
valThe zoom input value, positive for zoom in, negative for zoom out

◆ nextSensor()

virtual void makVre::DtCommanderControlLogic::nextSensor ( double val)
virtual

Input handler for cycling through sensor modes.

Cycles to the next available sensor mode (e.g., visual, NVG, thermal) when triggered.

Parameters
valThe input value, a value of 1.0 triggers the sensor change

◆ handleMenuMessage()

virtual makVre::DtVreMessageResult makVre::DtCommanderControlLogic::handleMenuMessage ( makVre::DtVreMessage * msg)
virtual

Handles menu action messages.

Processes menu actions, particularly the "cycleSensor" action which triggers the nextSensor functionality.

Parameters
msgThe message to process
Returns
HANDLED if the message was processed, IGNORED otherwise

Member Data Documentation

◆ myInputLogic

DtInputLogic makVre::DtCommanderControlLogic::myInputLogic
protected

Input handler logic for processing input device events.

◆ myMainControlGroup

std::string makVre::DtCommanderControlLogic::myMainControlGroup
protected

Main control group name from configuration.

Used to identify the function group when sending joystick messages.

◆ myOutTheHatchMode

bool makVre::DtCommanderControlLogic::myOutTheHatchMode
protected

Flag indicating whether "out the hatch" mode is active.

When true, sensor control directly affects the observer view rather than sending joystick messages to control a vehicle sensor.

◆ myAzimuthInput

float makVre::DtCommanderControlLogic::myAzimuthInput
protected

Current azimuth input value for "out the hatch" mode.

◆ myElevationInput

float makVre::DtCommanderControlLogic::myElevationInput
protected

Current elevation input value for "out the hatch" mode.

◆ myMaxZoom

float makVre::DtCommanderControlLogic::myMaxZoom
protected

Maximum allowed zoom level.

◆ myMinZoom

float makVre::DtCommanderControlLogic::myMinZoom
protected

Minimum allowed zoom level.

◆ myEnableZoom

bool makVre::DtCommanderControlLogic::myEnableZoom
protected

◆ myCurrentSensorAttr

DtAttributeHandleType<int> makVre::DtCommanderControlLogic::myCurrentSensorAttr
protected

Attribute handle storing the active sensor index (0=Visual, 1=NVG, 2=Thermal-white, 3=Thermal-black).

Attribute Store KeycurrentSensor

◆ myZoomChangedAttr

DtAttributeHandleType<bool> makVre::DtCommanderControlLogic::myZoomChangedAttr
protected

Attribute handle indicating whether the zoom level has changed and the interpolator needs updating.

Attribute Store KeyzoomChanged

◆ myObserverYawAttr

DtAttributeHandleType<double> makVre::DtCommanderControlLogic::myObserverYawAttr
protected

Attribute handle storing the observer's current yaw angle in radians.

Attribute Store KeyobserverYaw

◆ myObserverPitchAttr

DtAttributeHandleType<double> makVre::DtCommanderControlLogic::myObserverPitchAttr
protected

Attribute handle storing the observer's current pitch angle in radians.

Attribute Store KeyobserverPitch

◆ myZoomAttr

DtAttributeHandleType<double> makVre::DtCommanderControlLogic::myZoomAttr
protected

Attribute handle storing the current zoom level.

Attribute Store Keyzoom

◆ myMagnificationAttr

DtAttributeHandleType<double> makVre::DtCommanderControlLogic::myMagnificationAttr
protected

Attribute handle storing the current view magnification level.

Attribute Store KeyviewMagnification

◆ myAimInputScaleAttr

DtAttributeHandleType<double> makVre::DtCommanderControlLogic::myAimInputScaleAttr
protected

Attribute handle storing the input scale factor derived from zoom level for consistent aim control.

Attribute Store KeyaimInputScale

◆ mySensorModesAttr

DtAttributeHandleType<std::vector<std::string> > makVre::DtCommanderControlLogic::mySensorModesAttr
protected

Attribute handle storing the list of available sensor mode name strings.

Attribute Store KeysensorModes

The documentation for this class was generated from the following file: