ADCS.controller.mtq_lovera module

class ADCS.controller.mtq_lovera.MTQ_Lovera(est_sat, p_gain, d_gain, eps)[source]

Bases: Controller

Magnetic proportional–derivative attitude controller using magnetorquers only, based on the global stabilization law of Lovera and Astolfi [1].

This controller implements the magnetic attitude control strategy presented in

M. Lovera and A. Astolfi, Global Magnetic Attitude Control of Inertially Pointing Spacecraft, Journal of Guidance, Control, and Dynamics, Vol. 28, No. 5, 2005, pp. 1065–1072.

The control law achieves global asymptotic stabilization of a constant inertial attitude using only magnetic torquers by exploiting the time-varying nature of the geomagnetic field along the orbit.

Rotational Dynamics

The spacecraft rotational dynamics are modeled as

\[J \dot{\boldsymbol{\omega}} = -\boldsymbol{\omega} \times (J \boldsymbol{\omega} + \boldsymbol{h}_{rw}) + \boldsymbol{\tau}\]

where

Symbol | Description

\(\boldsymbol{\omega}\) | Body angular velocity

\(J\) | Spacecraft inertia matrix

\(\boldsymbol{h}_{rw}\) | Total reaction wheel angular momentum

\(\boldsymbol{\tau}\) | Control torque

Magnetic Torque Model

Magnetorquers generate torque according to

\[\boldsymbol{\tau} = \boldsymbol{m} \times \boldsymbol{B}\]

where \(\boldsymbol{m}\) is the commanded magnetic dipole moment and \(\boldsymbol{B}\) is the geomagnetic field expressed in the body frame.

Attitude and Angular Velocity Errors

Let q be the current attitude quaternion and q_d the desired inertial reference quaternion. The attitude error vector is defined as

\[\boldsymbol{e}_q = \mathrm{vec}(q_d^{-1} \otimes q)\]

The angular velocity error is defined as

\[\boldsymbol{e}_{\omega} = \boldsymbol{\omega} - R_b^i(q)^\top \boldsymbol{\omega}_d\]

where \(R_b^i(q)\) is the body-to-inertial rotation matrix and \(\boldsymbol{\omega}_d\) is the desired inertial angular rate.

PD Control with Gyroscopic Compensation

The desired control torque is chosen as

\[\boldsymbol{\tau}_{des} = -\varepsilon^2 k_p \boldsymbol{e}_q -\varepsilon k_d \boldsymbol{e}_{\omega} + \boldsymbol{\omega} \times (J \boldsymbol{\omega} + \boldsymbol{h}_{rw})\]

where \(k_p\) and \(k_d\) are positive scalar gains and \(\varepsilon\) is a small positive parameter separating time scales.

Magnetic Dipole Allocation

Since magnetorquers cannot generate torque parallel to the geomagnetic field, the commanded magnetic dipole is computed as

\[\boldsymbol{m}^* = \frac{\boldsymbol{B} \times \boldsymbol{\tau}_{des}}{\|\boldsymbol{B}\|^2}\]

which yields

\[\boldsymbol{m}^* \times \boldsymbol{B} = \Pi_{\boldsymbol{B}^\perp}(\boldsymbol{\tau}_{des})\]

If the magnetic field magnitude falls below a numerical threshold, the dipole command is set to zero.

Actuator Saturation

Magnetorquer dipole limits are enforced by uniformly scaling the commanded dipole:

\[\boldsymbol{m} = \alpha \boldsymbol{m}^*, \quad \alpha = \min\left( 1, \min_i \frac{m_{i,\max}}{|m_i^*|} \right)\]

This preserves the dipole direction and therefore the resulting torque direction.

References

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

Computes magnetorquer actuator commands using the Lovera–Astolfi control law.

This method evaluates the magnetic PD attitude stabilization controller using the current state estimate, sensor measurements, and mission goal. Reaction wheel angular momentum is included in the gyroscopic compensation term if present.

The output command vector contains nonzero entries only for magnetorquer actuators; all other actuator commands are set to zero.

Parameters:
  • x_hat (numpy.ndarray) – Estimated state vector containing angular velocity and attitude

  • sens (numpy.ndarray) – Raw sensor measurement vector

  • est_sat (EstimatedSatellite) – Estimated satellite object providing hardware properties

  • os_hat (Orbital_State) – Estimated orbital state

  • goal (Goal or None) – Optional mission goal definition

Returns:

Actuator command vector with magnetorquer dipole commands

Return type:

numpy.ndarray

Parameters: