Module: arrayMotorTorqueToSingleActuators
Executive Summary
The arrayMotorTorqueToSingleActuators module is an adapter that converts an array motor torque command message into a
set of scalar actuator command messages. The module reads a single input message of type
ArrayMotorTorqueMsgPayload, which contains a motor torque vector \(\boldsymbol{u}\). At each update, the
module writes \(N\) output messages of type SingleActuatorMsgPayload such that
where \(u_i^{(\text{out})}\) is the scalar command written to the \(i\)-th actuator output message. This supports connecting flight software modules that publish array-valued motor commands to simulation actuators that expect individual scalar actuator command messages.
Message Connection Description
The following table lists the module input and output messages.
Msg Variable Name |
Msg Type |
Description |
|---|---|---|
torqueInMsg |
Input message containing the motor torque array |
|
actuatorOutMsgs |
Vector of output messages containing one scalar actuator command per actuator |
Module Functions
Below is a list of functions that this simulation module performs
Reads the incoming
ArrayMotorTorqueMsginputCopies each array entry into the corresponding scalar
SingleActuatorMsgoutputWrites all scalar actuator output messages each update cycle
Module Assumptions and Limitations
The mapping is order-preserving: array index \(i\) maps to output actuator index \(i\)
The module assumes \(N\) does not exceed the size of the input motor torque array provided by ArrayMotorTorqueMsgPayload
Test Description and Success Criteria
The unit test for this module is defined in test_arrayMotorTorqueToSingleActuators. The test initializes the module with a configurable number of actuators \(N\), publishes a known torque vector to the input message, and runs one simulation step. The test passes if each scalar output message matches the corresponding input array element to within numerical tolerance.
-
class ArrayMotorTorqueToSingleActuators : public SysModel
- #include <arrayMotorTorqueToSingleActuators.h>
Adapter module that converts an ArrayMotorTorqueMsg into one SingleActuatorMsg per actuator using direct index mapping.
Public Functions
-
ArrayMotorTorqueToSingleActuators()
Default constructor.
-
explicit ArrayMotorTorqueToSingleActuators(uint32_t numActuators)
Constructor specifying number of actuators.
- Parameters:
numActuators – Number of output actuators.
-
~ArrayMotorTorqueToSingleActuators() override = default
Destructor.
-
void Reset(uint64_t CurrentSimNanos) override
Reset the module.
- Parameters:
CurrentSimNanos – Current simulation time [ns].
-
void UpdateState(uint64_t CurrentSimNanos) override
Read array torque message and publish scalar actuator commands.
- Parameters:
CurrentSimNanos – Current simulation time [ns].
-
void setNumActuators(uint32_t numActuators)
Set the number of actuators.
- Parameters:
numActuators – Number of actuators.
Public Members
-
ReadFunctor<ArrayMotorTorqueMsgPayload> torqueInMsg
Input motor torque array.
-
std::vector<Message<SingleActuatorMsgPayload>> actuatorOutMsgs
Scalar actuator outputs.
-
BSKLogger bskLogger
BSK Logging.
Private Functions
-
void ensureSizes()
Ensure internal buffers are correctly sized.
Private Members
-
uint32_t numActuators
Number of actuators.
-
ArrayMotorTorqueToSingleActuators()