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.

Module I/O Messages#

Msg Variable Name

Msg Type

Description

rwMotorTorqueOutMsg

RwMotorTorqueMsgPayload

RW motor torque output message

vehControlInMsg

CmdTorqueBodyMsgPayload

commanded vehicle control torque input message

vehControlIn2Msg

CmdTorqueBodyMsgPayload

(optional) additional commanded vehicle control torque input message

rwParamsInMsg

RWArrayConfigMsgPayload

RW array configuration input message

rwAvailInMsg

RWAvailabilityMsgPayload

(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.

image

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

\[\label{eq:rwtm1} [G_{s}] \bm u_{s} = (- {\vphantom{\bm L}}^{\mathcal{B}\!}{\bm L} _r)\]

The project matrix is defined as

\[\label{eq:rwtm2} [G_{s}] = \begin{bmatrix} \hat{\bm g}_{s_{1}} & \cdots & \hat{\bm g}_{s_{m}} \end{bmatrix}\]

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

\[ \begin{align}\begin{aligned}\label{eq:rwtm3} [CB] = \begin{bmatrix}\\\begin{split} {\vphantom{\hat{\bm c}}}^{\mathcal{B}\!}{\hat{\bm c}} _{1}^{T} \\ \vdots \\\end{split}\\ {\vphantom{\hat{\bm c}}}^{\mathcal{B}\!}{\hat{\bm c}} _{n}^{T} \end{bmatrix}\end{aligned}\end{align} \]

where \(n \le 3\).

To map the requested torque onto the control axes, Eq. [eq:rwtm1] is pre-multifplied by \([CB]\) to yield

\[\label{eq:rwtm4} [CB][G_{s}] \bm u_{s} = [CG_{s}] \bm u_{s} = [CB](- {\vphantom{\bm L}}^{\mathcal{B}\!}{\bm L} _r) = {\vphantom{\bm L}}^{\mathcal{C}\!}{\bm L} _{r}\]

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:

\[\bm u_{s} = [CG]^T \left([CG][CG]^T\right)^{-1}\ {\vphantom{\bm L}}^{\mathcal{C}\!}{\bm L} _{r}\]

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 CmdTorqueBodyIntMsg and 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