Skip to main content

Overview

mrpFeedback implements a Modified Rodrigues Parameter (MRP) feedback control law. Given attitude guidance error from an AttGuidMsg, it computes a control torque about the spacecraft body frame. Two control-law variants are available via controlLawType. The module optionally incorporates reaction wheel momentum feedback to decouple wheel angular momentum from the attitude control.
from Basilisk.fswAlgorithms import mrpFeedback

controller = mrpFeedback.mrpFeedback()
controller.ModelTag = "mrpFeedback"

Configuration parameters

K
double
Proportional gain applied to the MRP attitude error [rad/s].
controller.K = 3.5  # [rad/s]
P
double
Rate-error feedback gain [N·m·s].
controller.P = 30.0  # [N*m*s]
Ki
double
Integral gain on rate error [N·m]. Set to -1 to disable integral action.
controller.Ki = 0.0002  # [N*m]
integralLimit
double
Anti-windup saturation limit on the integral state [N·m].
controller.integralLimit = 0.1  # [N*m]
controlLawType
int
Selects between the two available control law formulations. 0 is the default; consult the module documentation for the analytical differences.
knownTorquePntB_B
double[3]
Known external torque about body point B in the body frame [N·m]. Used as a feedforward term.
controller.knownTorquePntB_B = [0.0, 0.0, 0.0]  # [N*m]

Input messages

guidInMsg
AttGuidMsg_C
Attitude guidance input message. Provides the MRP attitude error sigma_BR, rate error omega_BR_B, reference rate omega_RN_B, and reference rate derivative domega_RN_B.
controller.guidInMsg.subscribeTo(attGuidMsg)
vehConfigInMsg
VehicleConfigMsg_C
Vehicle configuration message containing the spacecraft inertia tensor ISCPntB_B.
controller.vehConfigInMsg.subscribeTo(vehConfigMsg)
rwSpeedsInMsg
RWSpeedMsg_C
(Optional) Reaction wheel speed array. Used to compute wheel angular momentum feedback. Connect when RWs are present.
controller.rwSpeedsInMsg.subscribeTo(rwStateEffector.rwSpeedOutMsg)
rwParamsInMsg
RWArrayConfigMsg_C
(Optional) Reaction wheel configuration parameters. Required when rwSpeedsInMsg is connected.
rwAvailInMsg
RWAvailabilityMsg_C
(Optional) RW availability flags to exclude failed wheels from the momentum computation.

Output messages

cmdTorqueOutMsg
CmdTorqueBodyMsg_C
Commanded spacecraft control torque [N·m] in the body frame.
intFeedbackTorqueOutMsg
CmdTorqueBodyMsg_C
Integral-feedback component of the control torque [N·m] in the body frame (useful for diagnostics).

Full setup example

from Basilisk.fswAlgorithms import mrpFeedback
from Basilisk.utilities import SimulationBaseClass, macros

scSim = SimulationBaseClass.SimBaseClass()
scSim.CreateNewProcess("fswProc")
scSim.CreateNewTask("fswTask", macros.sec2nano(0.5))

controller = mrpFeedback.mrpFeedback()
controller.ModelTag      = "mrpFeedback"
controller.K             = 3.5      # [rad/s]
controller.P             = 30.0     # [N*m*s]
controller.Ki            = -1.0     # integral disabled
controller.integralLimit = 0.1      # [N*m]

controller.guidInMsg.subscribeTo(attGuidMsg)
controller.vehConfigInMsg.subscribeTo(vehConfigMsg)

# Optional RW feedback
controller.rwSpeedsInMsg.subscribeTo(rwStateEffector.rwSpeedOutMsg)
controller.rwParamsInMsg.subscribeTo(rwConfigMsg)

scSim.AddModelToTask("fswTask", controller)

Build docs developers (and LLMs) love