Module: mrpFeedback¶
Executive Summary¶
This module provides a general MRP feedback control law. This 3-axis control can asymptotically track a general reference attitude trajectory. The module is setup to work with or without N reaction wheels with general orientation. If the reaction wheel states are fed into this module, then the resulting RW gyroscopic terms are compensated for. If the wheel information is not present, then these terms are ignored.
Message Connection Descriptions¶
The following table lists all the module input and output messages. The module msg variable name 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.
Figure 1: mrpFeedback()
Module I/O Illustration¶
Msg Variable Name |
Msg Type |
Description |
---|---|---|
cmdTorqueOutMsg |
Control torque output message |
|
guidInMsg |
The name of the attitude guidance input message |
|
vehConfigInMsg |
Name of the vehicle configuration input message |
|
rwParamsInMsg |
(Optional) The name of the RW array configuration input message |
|
rwSpeedsInMsg |
(Optional) The name for the reaction wheel speeds message |
|
rwAvailInMsg |
(Optional) The name of the RWs availability message |
Detailed Module Description¶
General Function¶
The mrpFeedback
module creates the MRP attitude feedback control torque \({\bf L}_{r}\) developed in chapter 8 of Analytical Mechanics of Space Systems. The input and output messages are illustrated in Figure 1: mrpFeedback() Module I/O Illustration. The output message is a body-frame control torque vector. The required attitude guidance message contains both attitude tracking error states as well as reference frame states. This message is read in with every update cycle. The vehicle configuration message is only read in on reset and contains the spacecraft inertia tensor about the vehicle’s center of mass location.
The MRP feedback control can compensate for Reaction Wheel (RW) gyroscopic effects as well. This is an optional input message where the RW configuration array message contains the RW spin axis \(\hat{\bf g}_{s,i}\) information and the RW polar inertia about the spin axis \(I_{W_{s,i}}\). This is only read in on reset. The RW speed message contains the RW speed \(\Omega_{i}\) and is read in every time step. The optional RW availability message can be used to include or not include RWs in the MRP feedback. This allows the module to selectively turn off some RWs. The default is that all RWs are operational and are included.
Initialization¶
Simply call the module reset function prior to using this control module. This will reset the prior function call time variable, and reset the attitude error integral measure. The control update period \(\Delta t\) is evaluated automatically.
Algorithm¶
This module employs the MRP feedback algorithm of Example (8.14) of Analytical Mechanics of Space Systems. This nonlinear attitude tracking control includes an integral measure of the attitude error. Further, we seek to avoid quadratic \(\pmb\omega\) terms to reduce the likelihood of control saturation during a detumbling phase. Let the new nonlinear feedback control be expressed as
where
and
with \(I_{W_{s}}\) being the RW spin axis inertia.
The integral attitude error measure \(\bf z\) is defined through
In the BSK module the vector \(\delta\pmb\omega_{0}\) is hard-coded to a zero vector. This function will work for any initial tracking error, and this assumption doesn’t impact performance. A limit to the magnitude of the \(\int_{t_{0}}^{t} \pmb\sigma \text{d}t\) can be specified, which is a scalar compared to each element of the integral term.
The integral measure \(\bf z\) must be computed to determine \([P][K_{I}] {\bf z}\), and the expression \([\widetilde{K_{I}{\bf z}}]\) is added to \([\widetilde{\pmb\omega_{r}}]\) term.
To analyze the stability of this control, the following Lyapunov candidate function is used:
provides a convenient positive definite attitude error function. The attitude feedback gain $K$ is positive, while the integral feedback gain \([K_{I}]\) is a symmetric positive definite matrix. The resulting Lyapunov rate expression is given by
Substituting the equations of motion of a spacecraft with \(N\) reaction wheels (see Eq.~(8.160) in Analytical Mechanics of Space Systems, results in
Substituting the control expression in Eq. (1) and making use of \(\pmb \alpha = \pmb\omega_{r} - [K_{I}]{\bf z}\) leads to
Because \((\delta\pmb\omega + [K_{I}]{\bf z} )^{T} ([\widetilde{\delta\pmb\omega}] + [\widetilde{K_{I}{\bf z}}] ) = 0\), the Lyapunov rate reduces the negative semi-definite expression
This proves the new control is globally stabilizing. Asymptotic stability is shown following the same steps as for the nonlinear integral feedback control in Eq. (8.104) in Analytical Mechanics of Space Systems.
One of the goals set forth at the beginning of the example was avoiding quadratic $bmomega$ feedback terms to reduce the odds of control saturation during periods with large \(\pmb\omega\) values. However, the control in Eq. (1) contains a product of \(\bf z\) and \(\pmb\omega\). Let us study this term in more detail. The \(\pmb\omega\) expression with this product terms is found to be
If the integral feedback gain is a scalar \(K_{I}\), rather than a symmetric positive definite matrix \([K_{I}]\), the quadratic \(\pmb\omega\) term vanishes. If the full \(3\times 3\) gain matrix is employed, then quadratic rate feedback terms are retained.
Module Assumptions and Limitations¶
This module assumes the main spacecraft is a rigid body. If RW devices are installed, their wheel speeds are assumed to be fed into this control solution.
User Guide¶
This module requires the following variables from the required input messages:
\({\pmb\sigma}_{B/N}\) as
guidCmdData.sigma_BR
\(^B{\pmb\omega}_{B/R}\) as
guidCmdData.omega_BR_B
\(^B{\pmb\omega}_{R/N}\) as
guidCmdData.omega_RN_B
\(^B\dot{\pmb\omega}_{R/N}\) as
guidCmdData.domega_RN_B
\([I]\), the inertia matrix of the body as
vehicleConfigOut.ISCPntB_B
The gains \(K\) and \(P\) must be set to positive values. The integral gain \(K_i\) is optional, it is a negative number by default. Setting this variable to a negative number disables the error integration for the controller, leaving just PD terms. The integrator is required to maintain asymptotic tracking in the presence of an external disturbing torque. The integralLimit
is a scalar value applied in an element-wise check to ensure that the value of each element of the \(\int_{t_{0}}^{t} \pmb\sigma \text{d}t\) vector is within the desired limit. If not, the sign of that element is persevered, but the magnitude is replaced by integralLimit
.
If the rwParamsInMsg
is specified, then the associated rwSpeedsInMsg
is required as well.
The rwAvailInMsg
is optional and is used to selectively include RW devices in the control solution.
Functions
-
void SelfInit_mrpFeedback(mrpFeedbackConfig *configData, int64_t moduleID)¶
This method sets up the module output message of type :ref:
CmdTorqueBodyMsgPayload
- Parameters
configData – The configuration data associated with this module
moduleID – The ID associated with the configData
- Returns
void
-
void Update_mrpFeedback(mrpFeedbackConfig *configData, uint64_t callTime, int64_t moduleID)¶
This method takes the attitude and rate errors relative to the Reference frame, as well as the reference frame angular rates and acceleration, and computes the required control torque Lr.
- Parameters
configData – The configuration data associated with the MRP Steering attitude control
callTime – The clock time at which the function was called (nanoseconds)
moduleID – The module identifier
- Returns
void
-
void Reset_mrpFeedback(mrpFeedbackConfig *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.
- Parameters
callTime – The clock time at which the function was called (nanoseconds)
configData – The configuration data associated with the MRP steering control
moduleID – The module identifier
- Returns
void
-
struct mrpFeedbackConfig¶
- #include <mrpFeedback.h>
Data configuration structure for the MRP feedback attitude control routine.
Public Members
-
double K¶
[rad/sec] Proportional gain applied to MRP errors
-
double P¶
[N*m*s] Rate error feedback gain applied
-
double Ki¶
[N*m] Integration feedback error on rate error
-
double integralLimit¶
[N*m] Integration limit to avoid wind-up issue
-
uint64_t priorTime¶
[ns] Last time the attitude control is called
-
double z[3]¶
[rad] integral state of delta_omega
-
double int_sigma[3]¶
[s] integral of the MPR attitude error
-
double knownTorquePntB_B[3]¶
[N*m] known external torque in body frame vector components
-
double ISCPntB_B[9]¶
[kg m^2] Spacecraft Inertia
-
RWArrayConfigMsgPayload rwConfigParams¶
[-] struct to store message containing RW config parameters in body B frame
-
RWSpeedMsg_C rwSpeedsInMsg¶
RW speed input message (Optional)
-
RWAvailabilityMsg_C rwAvailInMsg¶
RW availability input message (Optional)
-
RWArrayConfigMsg_C rwParamsInMsg¶
RW parameter input message. (Optional)
-
CmdTorqueBodyMsg_C cmdTorqueOutMsg¶
commanded spacecraft external control torque output message
-
AttGuidMsg_C guidInMsg¶
attitude guidance input message
-
VehicleConfigMsg_C vehConfigInMsg¶
vehicle configuration input message
-
BSKLogger *bskLogger¶
BSK Logging.
-
double K¶