rwMotorTorque#
Executive Summary#
This module maps a desired torque to control the spacecraft, and maps it to the available wheels using a minimum norm inverse fit.
The optional wheel availability message is used to include or exclude particular reaction wheels from the torque solution. The desired control torque can be mapped onto particular orthogonal control axes to implement a partial solution for the overall attitude control torque.
Message Connection Descriptions#
The following table lists all the module input and output messages. The module msg connection is set by the user from python. The msg type contains a link to the message structure definition, while the description provides information on what this message is used for.
Msg Variable Name |
Msg Type |
Description |
|---|---|---|
rwMotorTorqueOutMsg |
RW motor torque output message |
|
vehControlInMsg |
commanded vehicle control torque input message |
|
vehControlIn2Msg |
(optional) additional commanded vehicle control torque input message |
|
rwParamsInMsg |
RW array configuration input message |
|
rwAvailInMsg |
(optional) RW device availability message |
Model Description#
Module Input and Output Behavior#
As illustrated in Figure 1, this module takes an attitude control torque \({\vphantom{\bm L_{r}}}^{\mathcal{B}\!}{\bm L_{r}}\) and maps the vector onto the specific control axes, \(\hat{\bm c}_{i}\). This allows only a subset of \({\vphantom{\bm L_{r}}}^{\mathcal{B}\!}{\bm L_{r}}\) to be implemented with the Reaction Wheels (RWs). The next step is to map reduced control torque onto the available RW spin axes,\(\hat{\bm g}_{s_j}\). The module accounts for the availability of the reaction wheels in the case that not all wheels are functioning appropriately or are undergoing independent analysis.
Assume in this documentation that the number of available RWs is \(m\), while the number of desired control axes \(\hat{\bm c}_{i}\) is \(n\). The number of installed RWs is \(N\).
The commanded torque message is a required input message and is read in every time step. The RW configuration message is also required, but only read in during reset. If the RW spin axes \(\hat{\bm b}_{s_{i}}\) change then reset() must be called again. The RW availability message is optional. If the availability message is not used, then all installed RWs are assumed to be available. The output message is always the array of RW motor torques.
Torque Mapping#
The rwMotorTorque module receives a desired attitude control torque
in the body frame \({\vphantom{\bm L}}^{\mathcal{B}\!}{\bm L}
_r\). If two control torques are provided via the second optional control
input message, these two are added together to compute
\({\vphantom{\bm L}}^{\mathcal{B}\!}{\bm L}
_r\). This torque is the net control torque that should be applied to the
spacecraft. Let \(\hat{\bm g}_{s_{i}}\) be the individual RW spin
axis, while \(\bm u_{s}\) is the \(m\)-dimensional array of
motor torques. The \(3\times m\) projection matrix \([G_{s}]\)
then maps the control torque on motor torques using
The project matrix is defined as
Note that here \(\bm u_{s}\) is the array of available motor torques. The installed set of RWs could be larger than \(m\).
The projection matrix to map a vector in the body frame \(\cal B\) onto the set of control axes \(\hat{\bm c}_{i}\) is given by
where \(n \le 3\).
To map the requested torque onto the control axes, Eq. [eq:rwtm1] is pre-multifplied by \([CB]\) to yield
Note that \([CG_{s}]\) is a \(n\times m\) matrix.
The module assumes that \(m\ge n\) such that there are enough RWs available to implement \({\vphantom{\bm L}}^{\mathcal{C}\!}{\bm L} _{r}\). If not, then the output motor torques are set to zero with \(\bm u_{s} = \bm 0\).
To invert Eq. [eq:rwtm4] a minimum norm solution is used yielding:
The final step is to map the array of available motor torques \(\bm u_{s}\) onto the output array of installed RW motor torques.
RW Availability#
If the input message rwAvailInMsg is linked, then the RW
availability message is read in. The torque mapping is only used for
RW’s whose availability setting is AVAILABLE. If it is
UNAVAILABLE then that RW output torque is set to zero.
Model Functions#
The code performs the following functions:
Maps control torque vector onto available reaction wheels: Takes a desired body-frame torque from
CmdTorqueBodyIntMsgand maps it onto the RW axes.Removes torque from unavailable reaction wheels: The module observes the availability of the RWs and maps the torques to only available reaction wheels.
Model Assumptions and Limitations#
This code makes the following assumptions:
The number of available wheels must be equal or larger than the number of control axes. If this is not the case a zero output motor torque message is produced.
Module Setup#
The module is configured by:
module = rwMotorTorque.RwMotorTorque()
module.modelTag = "rwMotorTorque"
control_axes_B = [[1, 0, 0], [0, 1, 0], [0, 0, 0]]
module.setControlAxes(control_axes_B)
Class RwMotorTorque#
-
class RwMotorTorque : public SysModel#
Top level structure for the sub-module routines.
Public Functions
-
void reset(uint64_t callTime) override#
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.
- Parameters:
callTime – The clock time at which the function was called (nanoseconds)
- Returns:
void
-
void updateState(uint64_t callTime) override#
Computes the reaction wheel torques given a commanded torque on the spacecraft
- Parameters:
callTime – The clock time at which the function was called (nanoseconds)
- Returns:
void
-
void setControlAxes(const Eigen::Matrix3d &controlMappingMatrix)#
Setter method for the control axes mapping matrix CB, where each row includes the transpose of a control axis. The matrix needs to be 3x3, so if only 2 axes are controlled, the third row should be all zeros.
- Parameters:
controlMappingMatrix – Known external torque expressed in body frame components
- Returns:
void
-
Eigen::Matrix3d getControlAxes() const#
Getter method for the control axes mapping matrix CB.
- Returns:
const Eigen::Matrix3d
Public Members
-
Message<RwMotorTorqueMsgPayload> rwMotorTorqueOutMsg#
RW motor torque output message.
-
ReadFunctor<CmdTorqueBodyMsgPayload> vehControlInMsg#
vehicle control (Lr) Input message
-
ReadFunctor<CmdTorqueBodyMsgPayload> vehControlIn2Msg#
optional vehicle control input message
-
ReadFunctor<RWArrayConfigMsgPayload> rwParamsInMsg#
RW Array input message.
-
ReadFunctor<RWAvailabilityMsgPayload> rwAvailInMsg#
optional RWs availability input message
-
void reset(uint64_t callTime) override#