VR-Engage  2.2
Loading...
Searching...
No Matches
FwlCgfVrf::DtVreFwlActuator Class Reference

Detailed Description

This class provides the real-time dynamics integration for fixed-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 VREngageActuator 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 <vreFwlActuator.h>

Inheritance diagram for FwlCgfVrf::DtVreFwlActuator:
[legend]

Public Member Functions

 DtVreFwlActuator (const DtString &name, DtLocalObject *object, DtSimulationServices *simManager, DtComponentDescriptor *compDescriptor, DtReaderWriterRegistry *parentRegistry)
 
virtual ~DtVreFwlActuator () override
 
virtual const char * type () const override
 
virtual void setRadio (DtSimRadio *radio) override
 
virtual void tick () override
 
virtual bool createPorts () override
 
virtual bool createPortGroups () override
 
virtual void updateControlSurfaces (bool resetToZero=false)
 
virtual void processRadioMsg (DtSimMessage *msg)
 
virtual void processSetRestore (DtSetRestoreRequest *req)
 
virtual void processSetLocation (DtSetLocationRequest *req)
 
virtual void processSetHeading (DtSetHeadingRequest *req)
 
DtFixedWingEntityStateRepository * getStateRepository ()
 

Static Public Member Functions

static DtSimComponent * creator (const DtString &name, DtLocalObject *object, DtSimulationServices *simManager, DtComponentDescriptor *compDescriptor, DtReaderWriterRegistry *parentRegistry)
 
static void radioMsgCallback (DtSimMessage *msg, void *usr)
 

Protected Member Functions

bool isPlayerControlled ()
 
void writeOutputData ()
 
void enableStatePropThresholding (bool enable)
 
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 DtVreFwlParametersgetFWParameters ()
 
 UNIMPLEMENTED_COPYCTOR_AND_ASSIGNMENT_OPERATOR (DtVreFwlActuator)
 

Protected Attributes

DtBooleanInputPort * myJoystickEnabledPort
 
DtBooleanInputPort * myLandingGearPort
 
DtIntegerInputPort * myFlapSettingPort
 
DtAnalogInputPort * myAirBrakePort
 
DtAnalogInputPort * myWheelBrakePort
 
DtConstrainedDualAxisAnalogInputPort * myStickPort
 
DtConstrainedAnalogInputPort * myPedalPort
 
DtConstrainedAnalogInputPort * myThrottlePort
 
DtBooleanOutputPort * myLandingGearState
 
DtAnalogOutputPort * myRudderPort
 
DtAnalogOutputPort * myLeftAileronPort
 
DtAnalogOutputPort * myRightAileronPort
 
DtAnalogOutputPort * myLeftElevatorPort
 
DtAnalogOutputPort * myRightElevatorPort
 
DtAnalogOutputPort * myLeftFlapPort
 
DtAnalogOutputPort * myRightFlapPort
 
DtOutputPortGroup * myControlSurfacesGroup
 
FixedWingLibCGF::AirplaneDynamics * myDynamics
 
bool myPlayerControlled
 
DtReal myLastSpeed
 
bool myExtendedGearsLocked
 

Constructor & Destructor Documentation

◆ DtVreFwlActuator()

FwlCgfVrf::DtVreFwlActuator::DtVreFwlActuator ( 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 fixed-wing actuator component for VREngage control.

Referenced by UNIMPLEMENTED_COPYCTOR_AND_ASSIGNMENT_OPERATOR().

◆ ~DtVreFwlActuator()

virtual FwlCgfVrf::DtVreFwlActuator::~DtVreFwlActuator ( )
overridevirtual

Virtual destructor.

Cleans up resources used by the actuator component.

Member Function Documentation

◆ type()

virtual const char * FwlCgfVrf::DtVreFwlActuator::type ( ) const
overridevirtual

Gets the component type.

Returns
The type string for this component

Returns TS_VREngageActuator as the component type identifier.

◆ setRadio()

virtual void FwlCgfVrf::DtVreFwlActuator::setRadio ( DtSimRadio * radio)
overridevirtual

Sets the radio interface for this component.

Parameters
radioThe radio interface to use

Configures the radio interface used for communication with this component.

◆ tick()

virtual void FwlCgfVrf::DtVreFwlActuator::tick ( )
overridevirtual

Performs per-frame processing.

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

◆ createPorts()

virtual bool FwlCgfVrf::DtVreFwlActuator::createPorts ( )
overridevirtual

Creates component ports.

Returns
True if port creation was successful

Creates input and output ports for joystick control, landing gear, flaps, and other control surfaces.

◆ createPortGroups()

virtual bool FwlCgfVrf::DtVreFwlActuator::createPortGroups ( )
overridevirtual

Creates port groups.

Returns
True if port group creation was successful

Creates logical groupings of related ports such as control surfaces.

◆ updateControlSurfaces()

virtual void FwlCgfVrf::DtVreFwlActuator::updateControlSurfaces ( bool resetToZero = false)
virtual

Updates the control surface positions.

Parameters
resetToZeroIf true, resets all control surfaces to neutral positions

Updates the positions of all aircraft control surfaces based on current inputs or resets them to neutral positions if resetToZero is true.

◆ creator()

static DtSimComponent * FwlCgfVrf::DtVreFwlActuator::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.

◆ radioMsgCallback()

static void FwlCgfVrf::DtVreFwlActuator::radioMsgCallback ( DtSimMessage * msg,
void * usr )
static

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 FwlCgfVrf::DtVreFwlActuator::processRadioMsg ( DtSimMessage * msg)
virtual

Processes a radio message.

Parameters
msgThe message to process

Handles incoming radio messages directed to this component.

◆ processSetRestore()

virtual void FwlCgfVrf::DtVreFwlActuator::processSetRestore ( DtSetRestoreRequest * req)
virtual

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 FwlCgfVrf::DtVreFwlActuator::processSetLocation ( DtSetLocationRequest * req)
virtual

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 FwlCgfVrf::DtVreFwlActuator::processSetHeading ( DtSetHeadingRequest * req)
virtual

Processes a heading change request.

Parameters
reqThe heading request to process

Changes the entity's heading.

◆ getStateRepository()

DtFixedWingEntityStateRepository * FwlCgfVrf::DtVreFwlActuator::getStateRepository ( )

Gets the state repository.

Returns
Pointer to the fixed-wing entity state repository

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

◆ isPlayerControlled()

bool FwlCgfVrf::DtVreFwlActuator::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 FwlCgfVrf::DtVreFwlActuator::writeOutputData ( )
protected

Writes output data to ports.

Updates all output ports with current state data.

◆ enableStatePropThresholding()

void FwlCgfVrf::DtVreFwlActuator::enableStatePropThresholding ( 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.

◆ setSpeed()

virtual void FwlCgfVrf::DtVreFwlActuator::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 FwlCgfVrf::DtVreFwlActuator::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 FwlCgfVrf::DtVreFwlActuator::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 FwlCgfVrf::DtVreFwlActuator::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 FwlCgfVrf::DtVreFwlActuator::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.

◆ getFWParameters()

const DtVreFwlParameters * FwlCgfVrf::DtVreFwlActuator::getFWParameters ( )
protected

Gets the fixed-wing parameters.

Returns
Pointer to the fixed-wing parameters

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

◆ UNIMPLEMENTED_COPYCTOR_AND_ASSIGNMENT_OPERATOR()

FwlCgfVrf::DtVreFwlActuator::UNIMPLEMENTED_COPYCTOR_AND_ASSIGNMENT_OPERATOR ( DtVreFwlActuator )
protected

References DtVreFwlActuator().

Member Data Documentation

◆ myJoystickEnabledPort

DtBooleanInputPort* FwlCgfVrf::DtVreFwlActuator::myJoystickEnabledPort
protected

Input port for joystick enabled state.

◆ myLandingGearPort

DtBooleanInputPort* FwlCgfVrf::DtVreFwlActuator::myLandingGearPort
protected

Input port for landing gear control.

◆ myFlapSettingPort

DtIntegerInputPort* FwlCgfVrf::DtVreFwlActuator::myFlapSettingPort
protected

Input port for flap setting.

◆ myAirBrakePort

DtAnalogInputPort* FwlCgfVrf::DtVreFwlActuator::myAirBrakePort
protected

Input port for air brake control.

◆ myWheelBrakePort

DtAnalogInputPort* FwlCgfVrf::DtVreFwlActuator::myWheelBrakePort
protected

Input port for wheel brake control.

◆ myStickPort

DtConstrainedDualAxisAnalogInputPort* FwlCgfVrf::DtVreFwlActuator::myStickPort
protected

Input port for control stick (pitch/roll)

◆ myPedalPort

DtConstrainedAnalogInputPort* FwlCgfVrf::DtVreFwlActuator::myPedalPort
protected

Input port for rudder pedals (yaw)

◆ myThrottlePort

DtConstrainedAnalogInputPort* FwlCgfVrf::DtVreFwlActuator::myThrottlePort
protected

Input port for throttle control.

◆ myLandingGearState

DtBooleanOutputPort* FwlCgfVrf::DtVreFwlActuator::myLandingGearState
protected

Output port for landing gear state.

◆ myRudderPort

DtAnalogOutputPort* FwlCgfVrf::DtVreFwlActuator::myRudderPort
protected

Output port for rudder position.

◆ myLeftAileronPort

DtAnalogOutputPort* FwlCgfVrf::DtVreFwlActuator::myLeftAileronPort
protected

Output port for left aileron position.

◆ myRightAileronPort

DtAnalogOutputPort* FwlCgfVrf::DtVreFwlActuator::myRightAileronPort
protected

Output port for right aileron position.

◆ myLeftElevatorPort

DtAnalogOutputPort* FwlCgfVrf::DtVreFwlActuator::myLeftElevatorPort
protected

Output port for left elevator position.

◆ myRightElevatorPort

DtAnalogOutputPort* FwlCgfVrf::DtVreFwlActuator::myRightElevatorPort
protected

Output port for right elevator position.

◆ myLeftFlapPort

DtAnalogOutputPort* FwlCgfVrf::DtVreFwlActuator::myLeftFlapPort
protected

Output port for left flap position.

◆ myRightFlapPort

DtAnalogOutputPort* FwlCgfVrf::DtVreFwlActuator::myRightFlapPort
protected

Output port for right flap position.

◆ myControlSurfacesGroup

DtOutputPortGroup* FwlCgfVrf::DtVreFwlActuator::myControlSurfacesGroup
protected

Output port group for all control surfaces.

◆ myDynamics

FixedWingLibCGF::AirplaneDynamics* FwlCgfVrf::DtVreFwlActuator::myDynamics
protected

Pointer to the real-time dynamics model.

◆ myPlayerControlled

bool FwlCgfVrf::DtVreFwlActuator::myPlayerControlled
protected

Flag indicating whether the entity is player-controlled.

◆ myLastSpeed

DtReal FwlCgfVrf::DtVreFwlActuator::myLastSpeed
protected

Last recorded speed value.

◆ myExtendedGearsLocked

bool FwlCgfVrf::DtVreFwlActuator::myExtendedGearsLocked
protected

Flag to keep landing gear extended when on ground.

Keep gears extended if vehicle is placed on ground even if isTouchingGround is (still) false. This is required to avoid that gears are retracted due to joystick input while vehicle is on ground. Lock is automatically released as soon as isTouchingGround becomes true.


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