Module: thrForceMapping¶
This module is reads in a desired attitude control torque vector and maps it onto a set of thrusters.
The module works for both on-pulsing (nominal thruster state is off such as with RCS thrusters) and off-pulsing (nominal thruster state in such as with DV thrusters). More information can be found in the
PDF Description
.
Functions
-
void
SelfInit_thrForceMapping
(thrForceMappingConfig *configData, int64_t moduleID)¶ This method creates the module output message of type THRArrayCmdForceFswMsg.
- Return
void
- Parameters
configData
: The configuration data associated with this modulemoduleID
: The ID associated with the configData
-
void
CrossInit_thrForceMapping
(thrForceMappingConfig *configData, int64_t moduleID)¶ This method performs the second stage of initialization for this module. It’s primary function is to link the input messages that were created elsewhere.
- Return
void
- Parameters
configData
: The configuration data associated with this modulemoduleID
: The ID associated with the configData
-
void
Update_thrForceMapping
(thrForceMappingConfig *configData, uint64_t callTime, int64_t moduleID)¶ The module takes a body frame torque vector and projects it onto available RCS or DV thrusters.
- Return
void
- Parameters
configData
: The configuration data associated with the modulecallTime
: The clock time at which the function was called (nanoseconds)moduleID
: The ID associated with the configData
-
void
Reset_thrForceMapping
(thrForceMappingConfig *configData, uint64_t callTime, int64_t moduleID)¶ This method performs a complete reset of the module. Local module variables that retain time varying states between function calls are reset to their default values.
- Return
void
- Parameters
configData
: The configuration data associated with the modulemoduleID
: The ID associated with the configData
-
void
substractMin
(double *F, uint32_t size)¶ Take a stack of force values find the smallest value, and subtract if from all force values. Here the smallest values will become zero, while other forces increase. This assumes that the thrusters are aligned such that if all thrusters are firing, then no torque or force is applied. This ensures only positive force values are computed.
-
void
findMinimumNormForce
(thrForceMappingConfig *configData, double D[3][MAX_EFF_CNT], double Lr_B[3], uint32_t numForces, double F[MAX_EFF_CNT])¶ Use a least square inverse to determine the smallest set of thruster forces that yield the desired torque vector. Note that this routine does not constrain yet the forces to be either positive or negative
-
double
computeTorqueAngErr
(double D[3][MAX_EFF_CNT], double BLr[3], uint32_t numForces, double epsilon, double F[MAX_EFF_CNT], double FMag[MAX_EFF_CNT])¶ Determine the angle between the desired torque vector and the actual torque vector.
-
struct
thrForceMappingConfig
¶ - #include <thrForceMapping.h>
Data structure for module to map a command torque onto thruster forces.
Public Members
-
double
controlAxes_B
[3 * 3]¶ [] array of the control unit axes
-
double
rThruster_B
[MAX_EFF_CNT
][3]¶ [m] local copy of the thruster locations
-
double
gtThruster_B
[MAX_EFF_CNT
][3]¶ [] local copy of the thruster force unit direction vectors
-
int32_t
thrForceSign
¶ [] Flag indicating if pos (+1) or negative (-1) thruster solutions are found
-
double
angErrThresh
¶ [r] Angular error at which thruster forces are scaled to not be super-saturated
-
double
epsilon
¶ variable specifying what is considered a small number
-
uint32_t
use2ndLoop
¶ [] flag indicating if the 2nd least squares fitting loop should be used (1) or not used (0 - default)
-
uint32_t
numControlAxes
¶ [] counter indicating how many orthogonal axes are controlled
-
uint32_t
numThrusters
¶ [] The number of thrusters available on vehicle
-
double
outTorqAngErr
¶ [r] Angular error of effector torque
-
double
thrForcMag
[MAX_EFF_CNT
]¶
-
char
outputDataName
[MAX_STAT_MSG_LENGTH
]¶ The name of the output thruster force message.
-
int32_t
thrusterForceOutMsgId
¶ ID for the outgoing message.
-
char
inputVehControlName
[MAX_STAT_MSG_LENGTH
]¶ The name of the vehicle control (Lr) Input message.
-
int32_t
controlTorqueInMsgId
¶ ID for the incoming Lr control message.
-
char
inputThrusterConfName
[MAX_STAT_MSG_LENGTH
]¶ The name of the thruster cluster Input message.
-
int32_t
thrusterConfigInMsgId
¶ [-] ID for the incoming Thruster configuration data
-
char
inputVehicleConfigDataName
[MAX_STAT_MSG_LENGTH
]¶ The name of the Input message.
-
int32_t
vehicleConfigDataInMsgId
¶ [] ID for the incoming static vehicle data
-
VehicleConfigFswMsg
sc
¶ spacecraft configuration message
-
double