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>
|
| static DtSimComponent * | creator (const DtString &name, DtLocalObject *object, DtSimulationServices *simManager, DtComponentDescriptor *compDescriptor, DtReaderWriterRegistry *parentRegistry) |
| |
| static void | radioMsgCallback (DtSimMessage *msg, void *usr) |
| |
◆ DtVreFwlActuator()
| FwlCgfVrf::DtVreFwlActuator::DtVreFwlActuator |
( |
const DtString & | name, |
|
|
DtLocalObject * | object, |
|
|
DtSimulationServices * | simManager, |
|
|
DtComponentDescriptor * | compDescriptor, |
|
|
DtReaderWriterRegistry * | parentRegistry ) |
Constructor.
- Parameters
-
| name | The name of the component |
| object | The local object this component belongs to |
| simManager | The simulation services manager |
| compDescriptor | Component descriptor containing configuration |
| parentRegistry | Parent 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.
◆ 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
-
| radio | The 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
-
| resetToZero | If 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
-
| name | The name for the new component |
| object | The local object the component will belong to |
| simManager | The simulation services manager |
| compDescriptor | Component descriptor containing configuration |
| parentRegistry | Parent 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
-
| msg | The received message |
| usr | User 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
-
| msg | The 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
-
| req | The 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
-
| req | The 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
-
| req | The 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
-
| enable | True 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
-
| speed | The 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
-
| localPosition | The 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
-
| position | Output parameter for position |
| velocity | Output parameter for velocity |
| acceleration | Output parameter for acceleration |
| orientation | Output parameter for orientation |
| rotVelocity | Output 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()
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 |
◆ 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: