mrpRotation#

Executive Summary#

This module creates a dynamic reference frame attitude state message where the initial orientation relative to the input reference frame is specified through an MRP set, and the angular velocity vector is held fixed as seen by the resulting reference frame.

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.

api/modules/fswAlgorithms/attGuidance/mrpRotation/_Documentation/Figures/moduleIO.pdf

Figure 1: mrpRotation() Module I/O Illustration#

Module I/O Messages#

Msg Variable Name

Msg Type

Description

attRefOutMsg

AttRefMsgPayload

name of the output message containing the Reference

attRefInMsg

AttRefMsgPayload

name of the guidance reference input message

desiredAttInMsg

AttStateMsgPayload

(optional) name of the incoming message containing the desired MRP set

Model Description#

The purpose of this mrpRotation module is to add a constant rotation relative to the input frame \(\mathcal{R}_{0}\). The output reference frame is called \(\mathcal{R}\). The initial orientation is specified through an MRP set \(\mathbf\sigma_{R/R0}\), while the \(\mathcal{R}\)-frame angular velocity vector \({}^{\mathcal{R}}{\mathbf\omega}_{R/R0}\) is held constant in this module.

Assume that the input reference frame \(\mathcal{R}_{0}\) is given through an attitude state input message containing \(\mathbf\sigma_{R_{0}/N}\), \({}^{\mathcal{N}}{\mathbf\omega}_{R_{0}/N}\) and \({}^{\mathcal{N}}{\dot{\mathbf\omega}}_{R_{0}/N}\) as illustrated in :ref:`[fig:moduleIO] <#fig:moduleIO>`__. The MRP set is mapped into the corresponding Direction Cosine Matrix (DCM) using

\[[R_{0}N] = [R_{0}N ( \mathbf\sigma_{R_{0}/N})]\]

The goal of the motion is to compute the attitude of \(\mathcal{R}\) relative to input frame \(\mathcal{R}_{0}\) such that

\[\begin{split}\begin{align} \dot{\mathbf\sigma}_{R/R_{0}} &= \frac{1}{4} [B(\mathbf\sigma_{R/R_{0}})] {}^{\mathcal{R}}{\mathbf\omega}_{R/R_{0}} & \label{eq:mRot1} \\ \frac{{}^{\mathcal{R}}{\textrm{d}} {\mathbf\omega}_{R/R_{0}}}{\textrm{d}t} &= \mathbf 0 & \label{eq:mRot2} \end{align}\end{split}\]

Assume the initial \(\mathbf\sigma_{R/R_{0}}(t_{0})\) set and the \(\mathcal{R}\)-frame relative invariant \({}^{\mathcal{R}}{\mathbf\omega}_{R/R_{0}}\) vector are provided to the module. The current \(\mathbf\sigma_{R/R_{0}}(t_{0})\) value is then obtained by Eq.:ref:eq:mRot1. The current DCM of the \(\mathcal{R}\)-frame is thus

\[\label{eq:mRot3} [RN] = [RR_{0}(\mathbf\sigma_{R/R_{0}}(t) ] [R_{0}N]\]

Next, the angular velocity vector is transformed to inertial frame \(\mathcal{N}\)-frame components using

\[ \begin{align}\begin{aligned}\label{eq:mRot4}\\ {}^{\mathcal{N}}{\mathbf\omega}_{R/R_{0}} = [RN]^{T}{}^{\mathcal{R}}{\mathbf\omega}_{R/R_{0}}\end{aligned}\end{align} \]

to find the inertial angular velocity of the output reference frame:

\[ \begin{align}\begin{aligned}\label{eq:mRot5}\\ {}^{\mathcal{N}}{\mathbf\omega}_{R/N} = {}^{\mathcal{N}}{\mathbf\omega}_{R/R_{0}} + {}^{\mathcal{N}}{\mathbf\omega}_{R_{0}/N}\end{aligned}\end{align} \]

Finally, the inertial angular acceleration of the output reference frame is found using the transport theorem:

\[\label{eq:mRot6} \dot{\mathbf\omega}_{R/N} = \frac{ {}^{\mathcal{R}}{\textrm{d}} {\mathbf\omega}_{R/R_{0}}}{\textrm{d}t} + \mathbf\omega_{R/N} \times {\mathbf\omega}_{R/R_{0}} + \dot{\mathbf\omega}_{R_{0}/N} = \mathbf\omega_{R_{0}/N} \times {\mathbf\omega}_{R/R_{0}} + \dot{\mathbf\omega}_{R_{0}/N}\]

where \(\mathbf\omega_{R/N} \times {\mathbf\omega}_{R/R_{0}} = (\mathbf\omega_{R/R_{0}} +\mathbf\omega_{R_{0}/N}) \times {\mathbf\omega}_{R/R_{0}} = \mathbf\omega_{R_{0}/N} \times {\mathbf\omega}_{R/R_{0}}\) is used. Expressed in \(\mathcal{N}\) frame components, this vector equation is numerically evaluated using:

\[ \begin{align}\begin{aligned}\label{eq:mRot7}\\ {}^{\mathcal{N}}{\dot{\mathbf\omega}} _{R/N} = {}^{\mathcal{N}}{\mathbf\omega} _{R_{0}/N} \times {}^{\mathcal{N}}{\mathbf\omega} _{R/R_{0}} + {}^{\mathcal{N}}{\dot{\mathbf\omega}} _{R_{0}/N}\end{aligned}\end{align} \]

Module Functions#

The mrpRotation module has the following design goals

  • Constant Spin: The angular velocity vector between the input and output frame is constant as seen by output reference frame

  • MRP attitude representation: The initial and output attitude is described through an MRP coordinate set

  • Flexible Setup: The desired rotation state can be described through an initial MRP and angular velocity vector specified in module internal variables, or read in through a Basilisk AttStateMsg message.

Module Assumptions and Limitations#

  • On reset the next time step doesn’t yield an integration as the integration time evaluation requires at least a second time step.

  • If the desired rotation states are read in with an input message, then this message is checked each update cycle for new content. On reset the commanded frame states are reset to zero such that they are re-read in again in the next update cycle.

  • If the desired rotation is specified with module internal states, then on reset the prior internal states are re-used unless they are over-written after the reset call.

User Guide#

Specifying Desired Rotation#

If the mrpRotation module is set directly with the desired rotation states, then the modules variables sigma_RR0 and omega_RR0_R must be set.

If instead the desired rotation states are to be read in, then the input message name desiredAttInMsg must be specified, and a corresponding message of type AttStateMsgPayload created.

Required Input and Output Messages#

The \(\mathcal{R}_{0}\) input reference frame state message is specified through attRefInMsg. The output message name is specified through the attRefOutMsg.

Module Reset Behavior#

If the module is reset, then the priorTime flag is reset, meaning it take another time step to compute the sampling period used to integrate the kinematic differential equations.

Module Setup#

The module is configured by:

module = mrpRotation.mrpRotation()
module.modelTag = "mrpRotation"

The desired rotation state can be directly specified by:

sigma_RR0 = np.array([0.3, .5, 0.0])
module.setSigmaRR0(sigma_RR0)
omega_RR0_R = np.array([0.1, 0.0, 0.0]) * mc.D2R
module.setOmegaRR0(omega_RR0_R)

Alternatively, the desired rotation state can be specified with the input message desiredAttInMsg:

module.desiredAttInMsg.subscribeTo(desiredAttMsg)

Finally, the module is added to the simulation using:

unitTestSim.AddModelToTask(unitTaskName, module)

Class MrpRotation#

class MrpRotation : public SysModel#

MRP Rotation class.

Public Functions

void reset(uint64_t callTime) override#

This resets the module to original states.

Parameters:

callTime – The clock time at which the function was called (nanoseconds)

Returns:

void

void updateState(uint64_t callTime) override#

This method takes the input attitude reference frame, and superimposes the dynamics MRP scanning motion on top of this.

Parameters:

callTime – The clock time at which the function was called (nanoseconds)

Returns:

void

void setSigmaRR0(const Eigen::Vector3d &sigma)#

Setter method for the current MRP attitude coordinate set with respect to the input reference

Parameters:

sigma – [-] current MRP attitude coordinate set with respect to the input reference

Returns:

void

const Eigen::Vector3d &getSigmaRR0() const#

Getter method for the current MRP attitude coordinate set with respect to the input reference

Returns:

const Eigen::Vector3d

void setOmegaRR0(const Eigen::Vector3d &omega)#

Setter method for the angular velocity vector relative to input reference

Parameters:

omega – [rad/s] angular velocity vector relative to input reference

Returns:

void

const Eigen::Vector3d &getOmegaRR0() const#

Getter method for the angular velocity vector relative to input reference

Returns:

const Eigen::Vector3d

Public Members

Message<AttRefMsgPayload> attRefOutMsg#

output message containing the Reference

ReadFunctor<AttRefMsgPayload> attRefInMsg#

guidance reference input message

ReadFunctor<AttStateMsgPayload> desiredAttInMsg#

incoming message containing the desired attitude set