VR-Engage  2.2
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 setExtendedData (const std::string &key, const std::string &value, DtEntityIdentifier entity=DtEntityIdentifier::nullId())
 
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 makVre::DtVreMessageResult handleSimState (makVre::DtVreMessage *msg)
 
virtual makVre::DtVreMessageResult handleStateMessages (makVre::DtVreMessage *message)
 
virtual makVre::DtVreMessageResult handleReset (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 ()
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () const
 

Protected Attributes

DtInputLogic myInputLogic
 
std::string myMainControlGroup
 
bool myOutTheHatchMode
 
float myAzimuthInput
 
float myElevationInput
 
float myMaxZoom
 
float myMinZoom
 
bool myEnableZoom
 
- Protected Attributes inherited from makVre::DtEntityControlLogic
std::vector< std::string > myJoystickFunctionGroups
 
DtInputLogic myCommonInputLogic
 
std::string myInputConfigFile
 
bool myMouseControlEnabled
 
bool myMouseControlSupportAllowed
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Additional Inherited Members

- Protected Member Functions inherited from makVre::DtEntityControlLogic
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

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