ADCS.controller.mtq_w_rw module

class ADCS.controller.mtq_w_rw.MTQ_w_RW(est_sat, p_gain, d_gain, c_gain, h_target)[source]

Bases: Controller

Hybrid magnetic torquer and reaction wheel attitude controller.

This controller implements a three-axis attitude determination and control system that combines reaction wheels (RW) for precise torque generation with magnetic torquers (MTQ) for continuous reaction wheel momentum unloading. The formulation follows the principles of redundant reaction wheel momentum management described by Hogan and Schaub [1].

Reaction wheels provide high-bandwidth torque authority, while magnetic torquers exploit the geomagnetic field to generate torques orthogonal to the magnetic field direction. Momentum unloading is performed continuously to prevent reaction wheel saturation.

The total commanded body torque is decomposed as:

\[\boldsymbol{\tau}_{\text{total}} = \boldsymbol{\tau}_{\text{rw}} + \boldsymbol{\tau}_{\text{mag}}.\]

Attitude control torque is computed using a proportional-derivative feedback law with gyroscopic compensation:

\[\boldsymbol{\tau}_{\text{att}} = -K_p \boldsymbol{q}_{\text{err}} -K_d (\boldsymbol{\omega} - \boldsymbol{\omega}_{\text{ref}}) + \boldsymbol{\tau}_{\text{gyro}}.\]

Gyroscopic coupling from the spacecraft body and reaction wheels is:

\[\boldsymbol{\tau}_{\text{gyro}} = \boldsymbol{\omega} \times (J \boldsymbol{\omega} + \boldsymbol{h}_{\text{rw}}).\]

Reaction wheel momentum unloading torque is defined as:

\[\boldsymbol{\tau}_{\text{dump}} = -K_c (\boldsymbol{h}_{\text{rw}} - \boldsymbol{h}_{\text{tgt}}).\]

Magnetic torque is generated by a commanded dipole moment interacting with the geomagnetic field:

\[\boldsymbol{\tau}_{\text{mag}} = \boldsymbol{m} \times \boldsymbol{B} = -[B]_{\times} A_{\text{mtq}} \boldsymbol{u}_{\text{mtq}}.\]

The remaining torque demand is allocated to reaction wheels:

\[\boldsymbol{\tau}_{\text{rw}} = \boldsymbol{\tau}_{\text{att}} - \boldsymbol{\tau}_{\text{mag}}.\]
Parameters:
  • est_sat (EstimatedSatellite) – Estimated satellite model containing inertia properties, actuator geometry, and sensor configuration.

  • p_gain (float) – Proportional gain \(K_p\) applied to the quaternion error.

  • d_gain (float) – Derivative gain \(K_d\) applied to angular rate error.

  • c_gain (float) – Momentum dumping gain \(K_c\).

  • h_target (numpy.ndarray) – Desired body-frame reaction wheel momentum target vector.

Raises:

ValueError – If any component of h_target exceeds the maximum allowable reaction wheel momentum defined by RW.

Notes

This controller assumes that reaction wheel momentum states are stored contiguously in the estimated state vector beginning at index 7 and that the ordering matches the internal actuator index ordering.

References

find_u(x_hat, sens, est_sat, os_hat, goal=None)[source]

Compute actuator command vector for reaction wheels and magnetic torquers.

This method evaluates the estimated spacecraft state, reconstructs reaction wheel momentum, computes attitude control torque, performs gyroscopic compensation, and allocates torque between reaction wheels and magnetic torquers while enforcing actuator limits.

Reaction wheel momentum in the body frame is reconstructed as:

\[\boldsymbol{h}_{\text{rw}} = \sum_i h_i \hat{\boldsymbol{a}}_i.\]

Attitude control torque is computed as:

\[\boldsymbol{\tau}_{\text{att}} = -K_p \boldsymbol{q}_{\text{err}} -K_d (\boldsymbol{\omega} - \boldsymbol{\omega}_{\text{ref}}) + \boldsymbol{\tau}_{\text{gyro}}.\]

Magnetic torquer allocation uses a pseudo-inverse mapping:

\[\boldsymbol{u}_{\text{mtq}} = M_{\text{mag}}^{+} \boldsymbol{\tau}_{\text{dump}}.\]

Reaction wheel commands are computed from the remaining torque demand:

\[\boldsymbol{u}_{\text{rw}} = M_{\text{rw}} \boldsymbol{\tau}_{\text{rw}}.\]
Parameters:
  • x_hat (numpy.ndarray) – Estimated spacecraft state vector containing angular rates, quaternion attitude, and reaction wheel momentum states.

  • sens (numpy.ndarray) – Raw sensor measurement vector used to reconstruct the magnetic field via MTM pseudo-inverse mapping.

  • est_sat (EstimatedSatellite) – Satellite model containing inertia and actuator configuration.

  • os_hat (Orbital_State) – Estimated orbital state providing geomagnetic field information.

  • goal (Goal, optional) – Guidance goal object providing reference attitude and angular rate.

Returns:

Full actuator command vector ordered according to est_sat.actuators.

Return type:

numpy.ndarray