Module: extForceTorque

Class used to provide a direct external force and torque on body. This class is used to simulate an external for or torque acting on the body. For example, this module can be used to simulate the external disturbance due to outgasing or a thruster, or be used to directly apply requested control forces or torques.

The module PDF Description contains further information on this module’s function, how to run it, as well as testing.


class ExtForceTorque : public SysModel, public DynamicEffector

Public Functions

ExtForceTorque()

This is the constructor. It sets some default initializers that can be overriden by the user.

~ExtForceTorque()

The destructor. Nothing of note is performed here

void SelfInit()

No Action is performed in this function.

Return

void

void CrossInit()

This method is used to connect the input message. It sets the message ID based on what it finds for the input string. If the message is not successfully linked, it will warn the user.

Return

void

void UpdateState(uint64_t CurrentSimNanos)
void linkInStates(DynParamManager &statesIn)
void writeOutputMessages(uint64_t currentClock)

This module does not write any output messages.

Return

void

Parameters
  • CurrentClock: The current time used for time-stamping the message

void readInputMessages()

This method is used to read the incoming message and set the associated buffer structure.

Return

void

void computeForceTorque(double integTime)

This method is used to compute the RHS forces and torques. Note: the module can set any of these three vecors, or a subset. Regarding the external force, the matrix representations in the body (B) and inerial (N) frame components are treated as 2 separate vectors. Only set both if you mean to, as both vectors will be included.

Public Members

Eigen::Vector3d extForce_N

[N] external force in inertial frame components

Eigen::Vector3d extForce_B

[N] external force in body frame components

Eigen::Vector3d extTorquePntB_B

[Nm] external torque in body frame components

std::string cmdTorqueInMsgName

message used to read torque command inputs

std::string cmdForceInertialInMsgName

message used to read force command inputs

std::string cmdForceBodyInMsgName

message used to read force command inputs

BSKLogger bskLogger

BSK Logging

Private Members

int64_t cmdTorqueInMsgID

Message ID for incoming data

int64_t cmdForceInertialInMsgID

Message ID for incoming data

int64_t cmdForceBodyInMsgID

Message ID for incoming data

CmdTorqueBodyIntMsg incomingCmdTorqueBuffer

One-time allocation for savings

CmdForceInertialIntMsg incomingCmdForceInertialBuffer

One-time allocation for savings

CmdForceBodyIntMsg incomingCmdForceBodyBuffer

One-time allocation for savings

bool goodTorqueCmdMsg

flag indicating if a torque command message was read

bool goodForceBCmdMsg

flag indicating if a inertial force command message was read

bool goodForceNCmdMsg

flag indicating if a body-relative force command message was read