Skip to main content

Overview

ReactionWheelStateEffector is a StateEffector you attach to a Spacecraft object to simulate one or more reaction wheels. The module integrates wheel spin states, applies motor torques from a command message, and feeds back the resulting angular momentum and gyroscopic torques into the spacecraft equations of motion.
from Basilisk.simulation import reactionWheelStateEffector
from Basilisk.utilities import simIncludeRW

Wheel models

Three fidelity levels are available via the RWModels enum:
Enum valueDescription
BalancedWheelsIdeal wheels — no mass imbalance.
JitterSimpleSimplified jitter model (scalar imbalance).
JitterFullyCoupledFull 6-DOF jitter coupling.

Configuration parameters

maxWheelAcceleration
double
Maximum allowed wheel angular acceleration [rad/s²]. Clamps derivatives to prevent numerical blow-up. Default: 1.0e6 rad/s².
rwStateEffector.setMaxWheelAcceleration(2.0e6)  # [rad/s^2]
current = rwStateEffector.getMaxWheelAcceleration()
largeTorqueThreshold
double
Log-warning threshold for large torque commands when the wheel operates in unlimited-torque mode [N·m]. Default: 10.0 N·m.
rwStateEffector.setLargeTorqueThreshold(15.0)  # [N*m]
current = rwStateEffector.getLargeTorqueThreshold()

Adding wheels

rwStateEffector.addReactionWheel(rwConfig)
rwConfig is a RWConfigPayload (or a Python object wrapping it) that carries per-wheel properties:
gsHat_B
double[3]
Unit spin-axis vector in the body frame.
Js
double
Wheel spin-axis moment of inertia [kg·m²].
uMax
double
Maximum motor torque [N·m]. Set to -1 for unlimited torque.
Omega
double
Initial wheel spin rate [rad/s].

Input messages

rwMotorCmdInMsg
ReadFunctor<ArrayMotorTorqueMsgPayload>
(Optional) Array of motor torque commands, one entry per wheel [N·m]. If not connected, all motor torques are zero.
rwStateEffector.rwMotorCmdInMsg.subscribeTo(torqueCmdMsg)

Output messages

rwSpeedOutMsg
RWSpeedMsgPayload
Array of current wheel spin rates [rad/s].
rwOutMsgs
vector<RWConfigLogMsgPayload>
Per-wheel log messages containing spin rate, torque, and configuration data.

Full setup example

from Basilisk.simulation import reactionWheelStateEffector, spacecraft
from Basilisk.utilities import simIncludeRW, macros, SimulationBaseClass

scSim = SimulationBaseClass.SimBaseClass()
proc  = scSim.CreateNewProcess("dynProc")
scSim.CreateNewTask("dynTask", macros.sec2nano(0.1))

scObject = spacecraft.Spacecraft()
scObject.ModelTag = "bsk-Sat"

rwFactory = simIncludeRW.rwFactory()
rwFactory.create("Honeywell_HR16", [1, 0, 0], maxMomentum=50.0)   # +X wheel
rwFactory.create("Honeywell_HR16", [0, 1, 0], maxMomentum=50.0)   # +Y wheel
rwFactory.create("Honeywell_HR16", [0, 0, 1], maxMomentum=50.0)   # +Z wheel

rwStateEffector = reactionWheelStateEffector.ReactionWheelStateEffector()
rwFactory.addToSpacecraft(scObject.ModelTag, rwStateEffector, scObject)

scSim.AddModelToTask("dynTask", rwStateEffector)
scSim.AddModelToTask("dynTask", scObject)

Build docs developers (and LLMs) love