ADCS.controller.mtq_wisniewski module

class ADCS.controller.mtq_wisniewski.MTQ_Wisniewski(est_sat, lambda_s, lambda_q)[source]

Bases: Controller

Sliding mode magnetic attitude controller based on Wisniewski (1998).

This controller implements a sliding mode control law for spacecraft attitude regulation using magnetic torquers as the sole actuation mechanism. The formulation follows the work of R. Wisniewski and is designed to handle the nonlinear, time-varying, and underactuated nature of magnetic attitude control.

The controller defines a sliding surface in terms of angular velocity error and attitude error. Control action is chosen such that system trajectories are driven onto this surface and remain there, ensuring robustness to modeling uncertainties and disturbances.

Attitude and angular velocity errors are defined as:

\[\boldsymbol{\omega}_{\mathrm{err}} = \boldsymbol{\omega} - \boldsymbol{\omega}_{\mathrm{ref}}\]
\[\boldsymbol{q}_{\mathrm{err}} \in \mathbb{R}^3\]

The sliding surface is constructed as:

\[\boldsymbol{s} = J \boldsymbol{\omega}_{\mathrm{err}} + \Lambda_q \boldsymbol{q}_{\mathrm{err}}\]

where \(J\) is the spacecraft inertia matrix and \(\Lambda_q\) is a positive definite gain matrix.

A Lyapunov candidate function is chosen as:

\[V = \frac{1}{2} \boldsymbol{s}^\mathsf{T} \boldsymbol{s}\]

Enforcing \(\dot{V} < 0\) leads to the desired control torque:

\[\boldsymbol{\tau}_{\mathrm{des}} = \boldsymbol{\omega} \times (J\boldsymbol{\omega} + \boldsymbol{h}_{\mathrm{rw}}) + J (\boldsymbol{\omega} \times \boldsymbol{\omega}_{\mathrm{err}}) - \Lambda_q \dot{\boldsymbol{q}}_{\mathrm{err}} - \Lambda_s \boldsymbol{s}\]

Since magnetic actuation can only generate torque orthogonal to the local magnetic field, the desired torque is mapped to a magnetic dipole moment using:

\[\boldsymbol{m} = \frac{\boldsymbol{B} \times \boldsymbol{\tau}_{\mathrm{des}}} {\lVert \boldsymbol{B} \rVert^2}\]
Parameters:
  • est_sat (EstimatedSatellite) – Estimated satellite model providing inertia, actuator geometry, and sensor configuration.

  • lambda_s (numpy.ndarray) – Positive definite sliding surface gain matrix.

  • lambda_q (numpy.ndarray) – Positive definite attitude error gain matrix.

Return type:

None

References

R. Wisniewski, Sliding Mode Attitude Control for Magnetic Actuated Satellite, IFAC Proceedings Volumes, Vol. 31, No. 18, 1998.

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

Compute magnetic torquer command vector using sliding mode control.

This method evaluates the estimated spacecraft state and sensor measurements to compute a magnetic dipole command that enforces the sliding mode dynamics. Reaction wheel momentum is included in the gyroscopic compensation term when available.

The sliding surface is computed as:

\[\boldsymbol{s} = J \boldsymbol{\omega}_{\mathrm{err}} + \Lambda_q \boldsymbol{q}_{\mathrm{err}}\]

The desired control torque is formed as:

\[\boldsymbol{\tau}_{\mathrm{des}} = \boldsymbol{\omega} \times (J\boldsymbol{\omega} + \boldsymbol{h}_{\mathrm{rw}}) + J (\boldsymbol{\omega} \times \boldsymbol{\omega}_{\mathrm{err}}) - \Lambda_q \dot{\boldsymbol{q}}_{\mathrm{err}} - \Lambda_s \boldsymbol{s}\]

Magnetic dipole allocation is performed using the cross-product projection law:

\[\boldsymbol{u}_{\mathrm{mtq}} = \frac{\boldsymbol{B} \times \boldsymbol{\tau}_{\mathrm{des}}} {\lVert \boldsymbol{B} \rVert^2}\]

Actuator saturation is enforced by uniform scaling to respect maximum dipole moment limits.

Parameters:
  • x_hat (numpy.ndarray) – Estimated spacecraft state vector containing angular rates, attitude quaternion, and optional reaction wheel momentum states.

  • sens (numpy.ndarray) – Raw magnetometer sensor measurements.

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

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

  • goal (Goal, optional) – Attitude guidance goal used to compute reference attitude and angular velocity.

Returns:

Actuator command vector containing magnetic torquer commands ordered according to est_sat.actuators.

Return type:

numpy.ndarray