VR-Engage  2.2
Loading...
Searching...
No Matches
RlCgfVrf::DtVreRlActuator Class Reference

Detailed Description

This class provides the real-time dynamics integration for rotary-wing aircraft controlled through VREngage. It processes joystick inputs, handles control surface movement, and maintains proper kinematic state.

Note
Generally the VREngage actuator should not directly write the kinematic state to the state repository but use its output ports instead. This allows to use the Update Repository Actuator which in turn allows to mix the RTD actuator with the VRF Flight Kinematics Actuator. However, there are exceptions:

Reason:

  • VRF often calls DtVrfMovingObjectStateRepository::clampToGround() after a setLocation request. This method considers the current kinematic state of the state repository which has to be assigned beforehand.
  • The kinematic state is written to the state repository only at certain situations (setRestore, setLocation etc.) while the RTD actuator is active (see isPlayerControlled()). Hence, there should be no critical interference with other actuators.

#include <vreRlActuator.h>

Inheritance diagram for RlCgfVrf::DtVreRlActuator:
[legend]

Public Member Functions

 DtVreRlActuator (const DtString &name, DtLocalObject *object, DtSimulationServices *simManager, DtComponentDescriptor *compDescriptor, DtReaderWriterRegistry *parentRegistry)
 
virtual ~DtVreRlActuator () override
 
DtRotaryWingEntityStateRepository * getStateRepository ()
 
virtual DtString type () const
 
virtual void tick () override
 
virtual void preFirstTickInit () override
 
virtual bool init () override
 
virtual bool createPorts () override
 
- Public Member Functions inherited from makVre::DtVreRotaryWingActuatorComponent
 DtVreRotaryWingActuatorComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtVreRotaryWingActuatorComponent () override
 
- Public Member Functions inherited from makVre::DtVreSimComponent< DtRotaryWingActuatorComponent >
 DtVreSimComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtVreSimComponent ()
 
bool isPlayerControlled (const std::string &role="") const
 
DtString entitySystemName () const
 

Static Public Member Functions

static DtSimComponent * creator (const DtString &name, DtLocalObject *object, DtSimulationServices *simManager, DtComponentDescriptor *compDescriptor, DtReaderWriterRegistry *parentRegistry)
 
- Static Public Member Functions inherited from makVre::DtVreRotaryWingActuatorComponent
static DtSimComponent * creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 

Protected Member Functions

bool isPlayerControlled ()
 
void writeOutputData ()
 
virtual double calculateFuel () const
 
virtual void setSpeed (DtReal speed)
 
virtual void checkAndClampAircraftOnGround (const DtVector &localPosition)
 
virtual void copyStateFromRTD ()
 
virtual void copyStateFromRTD (DtVector &position, DtVector &velocity, DtVector &acceleration, DtTaitBryan &orientation, DtVector &rotVelocity)
 
virtual void copyStateToRTD ()
 
const DtVreRlParametersgetParameters ()
 
void setStatePropThresholdingEnabled (bool enable)
 
virtual void setRadio (DtSimBaseRadio *radio)
 
virtual void processRadioMsg (DtSimMessage *msg)
 
virtual void processSetRestore (DtSetRestoreRequest *req)
 
virtual void processSetLocation (DtSetLocationRequest *req)
 
virtual void processSetHeading (DtSetHeadingRequest *req)
 
- Protected Member Functions inherited from makVre::DtVreRotaryWingActuatorComponent
virtual void sendDetonation (const DtVector &geocentricLocation) override
 
virtual void checkLandedOrCrashed () override
 

Static Protected Member Functions

static void radioMsgCallback (DtSimMessage *msg, void *usr)
 

Protected Attributes

DtBooleanInputPort * myJoystickEnabledPort
 
DtBooleanInputPort * myWheelBrakePort
 
bool myPlayerControlled
 
RotorLibCGF::HelicopterDynamics * myDynamics
 
DtReal myLastSpeed
 
makVre::MiniPIDmyXPid
 
makVre::MiniPIDmyYPid
 
float myPreviousLat
 
float myPreviousLon
 
bool myReverseCollective
 

Constructor & Destructor Documentation

◆ DtVreRlActuator()

RlCgfVrf::DtVreRlActuator::DtVreRlActuator ( const DtString & name,
DtLocalObject * object,
DtSimulationServices * simManager,
DtComponentDescriptor * compDescriptor,
DtReaderWriterRegistry * parentRegistry )

Constructor.

Parameters
nameThe name of the component
objectThe local object this component belongs to
simManagerThe simulation services manager
compDescriptorComponent descriptor containing configuration
parentRegistryParent registry for reader/writer functionality

Initializes a new rotary-wing actuator component for VREngage control.

◆ ~DtVreRlActuator()

virtual RlCgfVrf::DtVreRlActuator::~DtVreRlActuator ( )
overridevirtual

Virtual destructor.

Cleans up resources used by the actuator component.

Member Function Documentation

◆ getStateRepository()

DtRotaryWingEntityStateRepository * RlCgfVrf::DtVreRlActuator::getStateRepository ( )

Gets the state repository.

Returns
Pointer to the rotary-wing entity state repository

Returns the state repository used by this rotary-wing aircraft.

References type().

◆ type()

virtual DtString RlCgfVrf::DtVreRlActuator::type ( ) const
virtual

Gets the component type.

Returns
The type string for this component

Returns TS_VREngageActuator as the component type identifier.

Reimplemented from makVre::DtVreRotaryWingActuatorComponent.

Referenced by getStateRepository().

◆ tick()

virtual void RlCgfVrf::DtVreRlActuator::tick ( )
overridevirtual

Performs per-frame processing.

Called once per simulation frame to update the component state, process inputs, and generate outputs.

◆ preFirstTickInit()

virtual void RlCgfVrf::DtVreRlActuator::preFirstTickInit ( )
overridevirtual

Initializes the component before the first tick.

Performs initialization that must occur before the first tick, such as setting up initial state values.

◆ init()

virtual bool RlCgfVrf::DtVreRlActuator::init ( )
overridevirtual

Initializes the component.

Returns
True if initialization was successful

Performs initial setup of the component, including configuration loading and port initialization.

◆ createPorts()

virtual bool RlCgfVrf::DtVreRlActuator::createPorts ( )
overridevirtual

Creates component ports.

Returns
True if port creation was successful

Creates input and output ports for helicopter controls including collective, cyclic, pedals, and wheel brakes.

◆ creator()

static DtSimComponent * RlCgfVrf::DtVreRlActuator::creator ( const DtString & name,
DtLocalObject * object,
DtSimulationServices * simManager,
DtComponentDescriptor * compDescriptor,
DtReaderWriterRegistry * parentRegistry )
static

Component factory function.

Parameters
nameThe name for the new component
objectThe local object the component will belong to
simManagerThe simulation services manager
compDescriptorComponent descriptor containing configuration
parentRegistryParent registry for reader/writer functionality
Returns
Pointer to the newly created component

Static factory function used for component creation through the component registry.

◆ isPlayerControlled()

bool RlCgfVrf::DtVreRlActuator::isPlayerControlled ( )
protected

Checks if the entity is currently player-controlled.

Returns
True if the entity is player-controlled, false otherwise

Determines whether the entity is currently under player control through VREngage or AI control.

◆ writeOutputData()

void RlCgfVrf::DtVreRlActuator::writeOutputData ( )
protected

Writes output data to ports.

Updates all output ports with current state data.

◆ calculateFuel()

virtual double RlCgfVrf::DtVreRlActuator::calculateFuel ( ) const
protectedvirtual

Calculates current fuel consumption.

Returns
Current fuel consumption rate

Calculates the current fuel consumption based on engine state and power settings.

◆ setSpeed()

virtual void RlCgfVrf::DtVreRlActuator::setSpeed ( DtReal speed)
protectedvirtual

Sets the aircraft speed.

Parameters
speedThe new speed value to set

Sets the current speed of the aircraft.

◆ checkAndClampAircraftOnGround()

virtual void RlCgfVrf::DtVreRlActuator::checkAndClampAircraftOnGround ( const DtVector & localPosition)
protectedvirtual

Checks and adjusts the aircraft position to keep it on the ground.

Parameters
localPositionThe current local position to check

Ensures the aircraft doesn't sink into or float above the ground when it should be in contact with the terrain.

◆ copyStateFromRTD() [1/2]

virtual void RlCgfVrf::DtVreRlActuator::copyStateFromRTD ( )
protectedvirtual

Copies state from RTD to the state repository.

Copies the current state from the real-time dynamics engine to the state repository to synchronize the simulation state.

◆ copyStateFromRTD() [2/2]

virtual void RlCgfVrf::DtVreRlActuator::copyStateFromRTD ( DtVector & position,
DtVector & velocity,
DtVector & acceleration,
DtTaitBryan & orientation,
DtVector & rotVelocity )
protectedvirtual

Copies state from RTD to provided parameters.

Parameters
positionOutput parameter for position
velocityOutput parameter for velocity
accelerationOutput parameter for acceleration
orientationOutput parameter for orientation
rotVelocityOutput parameter for rotational velocity

Copies the current state from the real-time dynamics engine to the provided output parameters.

◆ copyStateToRTD()

virtual void RlCgfVrf::DtVreRlActuator::copyStateToRTD ( )
protectedvirtual

Copies state from the state repository to RTD.

Copies the current state from the state repository to the real-time dynamics engine to synchronize the simulation state.

◆ getParameters()

const DtVreRlParameters * RlCgfVrf::DtVreRlActuator::getParameters ( )
protected

Gets the rotary-wing parameters.

Returns
Pointer to the rotary-wing parameters

Returns the parameters used to configure this rotary-wing aircraft.

◆ setStatePropThresholdingEnabled()

void RlCgfVrf::DtVreRlActuator::setStatePropThresholdingEnabled ( bool enable)
protected

Enables or disables state propagation thresholding.

Parameters
enableTrue to enable thresholding, false to disable

Enables or disables thresholding for state propagation to reduce network traffic by only sending significant state changes.

References setRadio().

◆ setRadio()

virtual void RlCgfVrf::DtVreRlActuator::setRadio ( DtSimBaseRadio * radio)
protectedvirtual

Sets the radio interface for this component.

Parameters
radioThe radio interface to use

Configures the radio interface used for communication with this component.

Referenced by setStatePropThresholdingEnabled().

◆ radioMsgCallback()

static void RlCgfVrf::DtVreRlActuator::radioMsgCallback ( DtSimMessage * msg,
void * usr )
staticprotected

Static callback for radio messages.

Parameters
msgThe received message
usrUser data pointer (points to the actuator instance)

Static callback function invoked when a radio message is received. Routes the message to the appropriate instance.

◆ processRadioMsg()

virtual void RlCgfVrf::DtVreRlActuator::processRadioMsg ( DtSimMessage * msg)
protectedvirtual

Processes a radio message.

Parameters
msgThe message to process

Handles incoming radio messages directed to this component.

◆ processSetRestore()

virtual void RlCgfVrf::DtVreRlActuator::processSetRestore ( DtSetRestoreRequest * req)
protectedvirtual

Processes a restore request.

Parameters
reqThe restore request to process

Restores the entity to a previously saved state. Note: This method directly writes to the state repository. See class notes.

◆ processSetLocation()

virtual void RlCgfVrf::DtVreRlActuator::processSetLocation ( DtSetLocationRequest * req)
protectedvirtual

Processes a location change request.

Parameters
reqThe location request to process

Changes the entity's location. Note: This method directly writes to the state repository. See class notes.

◆ processSetHeading()

virtual void RlCgfVrf::DtVreRlActuator::processSetHeading ( DtSetHeadingRequest * req)
protectedvirtual

Processes a heading change request.

Parameters
reqThe heading request to process

Changes the entity's heading.

Member Data Documentation

◆ myJoystickEnabledPort

DtBooleanInputPort* RlCgfVrf::DtVreRlActuator::myJoystickEnabledPort
protected

Input port for joystick enabled state.

◆ myWheelBrakePort

DtBooleanInputPort* RlCgfVrf::DtVreRlActuator::myWheelBrakePort
protected

Input port for wheel brake control (boolean version)

◆ myPlayerControlled

bool RlCgfVrf::DtVreRlActuator::myPlayerControlled
protected

Flag indicating whether the entity is player-controlled.

◆ myDynamics

RotorLibCGF::HelicopterDynamics* RlCgfVrf::DtVreRlActuator::myDynamics
protected

Pointer to the real-time dynamics model.

◆ myLastSpeed

DtReal RlCgfVrf::DtVreRlActuator::myLastSpeed
protected

Last recorded speed value.

◆ myXPid

makVre::MiniPID* RlCgfVrf::DtVreRlActuator::myXPid
protected

PID controller for X-axis stabilization.

◆ myYPid

makVre::MiniPID* RlCgfVrf::DtVreRlActuator::myYPid
protected

PID controller for Y-axis stabilization.

◆ myPreviousLat

float RlCgfVrf::DtVreRlActuator::myPreviousLat
protected

Previous latitude value for position tracking.

◆ myPreviousLon

float RlCgfVrf::DtVreRlActuator::myPreviousLon
protected

Previous longitude value for position tracking.

◆ myReverseCollective

bool RlCgfVrf::DtVreRlActuator::myReverseCollective
protected

Flag indicating whether collective control should be reversed.


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