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>
|
| | 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 |
| |
| | DtVreRotaryWingActuatorComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| |
| virtual | ~DtVreRotaryWingActuatorComponent () override |
| |
| | 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 DtSimComponent * | creator (const DtString &name, DtLocalObject *object, DtSimulationServices *simManager, DtComponentDescriptor *compDescriptor, DtReaderWriterRegistry *parentRegistry) |
| |
| static DtSimComponent * | creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| |
◆ DtVreRlActuator()
| RlCgfVrf::DtVreRlActuator::DtVreRlActuator |
( |
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 rotary-wing actuator component for VREngage control.
◆ ~DtVreRlActuator()
| virtual RlCgfVrf::DtVreRlActuator::~DtVreRlActuator |
( |
| ) |
|
|
overridevirtual |
Virtual destructor.
Cleans up resources used by the actuator component.
◆ 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 |
◆ 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
-
| 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.
◆ 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
-
| speed | The 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
-
| 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 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
-
| 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 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()
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
-
| 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.
References setRadio().
◆ setRadio()
| virtual void RlCgfVrf::DtVreRlActuator::setRadio |
( |
DtSimBaseRadio * | radio | ) |
|
|
protectedvirtual |
Sets the radio interface for this component.
- Parameters
-
| radio | The 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
-
| 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 RlCgfVrf::DtVreRlActuator::processRadioMsg |
( |
DtSimMessage * | msg | ) |
|
|
protectedvirtual |
Processes a radio message.
- Parameters
-
| msg | The 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
-
| 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 RlCgfVrf::DtVreRlActuator::processSetLocation |
( |
DtSetLocationRequest * | req | ) |
|
|
protectedvirtual |
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 RlCgfVrf::DtVreRlActuator::processSetHeading |
( |
DtSetHeadingRequest * | req | ) |
|
|
protectedvirtual |
Processes a heading change request.
- Parameters
-
| req | The heading request to process |
Changes the entity's heading.
◆ 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
PID controller for X-axis stabilization.
◆ myYPid
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: