ADCS.satellite_hardware.sensors.magnetometer module

class ADCS.satellite_hardware.sensors.magnetometer.MTM(axis, sample_time=0.1, bias=None, noise=None, estimate_bias=False)[source]

Bases: Sensor

Single–axis magnetometer (MTM) sensor model.

This class implements a single–axis magnetic field sensor that measures the projection of the local geomagnetic field onto a specified body–fixed axis. It conforms to the generic sensor interface defined by Sensor.

Measurement model

Let the geomagnetic field expressed in the spacecraft body frame be

\[\mathbf{b} = \begin{bmatrix} b_x & b_y & b_z \end{bmatrix}^\top \in \mathbb{R}^3,\]

and let the magnetometer sensitive axis be the unit vector \(\hat{\mathbf{a}} \in \mathbb{R}^3\).

The clean (ideal) magnetometer measurement is

\[y_{\text{clean}} = \mathbf{b}^\top \hat{\mathbf{a}}.\]

Including bias and noise, the full measurement is

\[z = \mathbf{b}^\top \hat{\mathbf{a}} + b + n,\]

where:

Symbol

Description

\(b\)

Scalar magnetometer bias

\(n\)

Scalar measurement noise

The geomagnetic field vector \(\mathbf{b}\) and its Jacobian with respect to the system state are provided by Orbital_State.

param axis:

Body–frame sensitive axis of the magnetometer, shape (3,). The axis is normalized internally to unit length.

type axis:

numpy.ndarray

param sample_time:

Sampling period of the magnetometer in seconds.

type sample_time:

float

param bias:

Magnetometer bias model. If None, a zero-bias model is used.

type bias:

Bias or None

param noise:

Magnetometer noise model. If None, a zero-noise model is used.

type noise:

Noise or None

param estimate_bias:

Indicates whether the magnetometer bias is included as part of the estimated filter state.

type estimate_bias:

bool

return:

None

rtype:

None

Notes

  • This is a single–axis sensor; therefore output_length = 1.

  • The magnetometer itself is not an attitude sensor, but it provides attitude information when combined with an orbital magnetic field model.

basestate_jac(x, os)[source]

Jacobian of the magnetometer measurement with respect to the base (non-bias) system states.

The clean measurement is

\[y_{\text{clean}} = \mathbf{b}^\top \hat{\mathbf{a}}.\]

Taking the derivative with respect to the base state \(\mathbf{x}_{\text{base}}\) yields

\[\frac{\partial y_{\text{clean}}}{\partial \mathbf{x}_{\text{base}}} = \left( \frac{\partial \mathbf{b}}{\partial \mathbf{x}_{\text{base}}} \right)^\top \hat{\mathbf{a}}.\]

The orbital state is expected to provide the magnetic field Jacobian via

\[\texttt{os.get_state_vector(x)["db"]} = \frac{\partial \mathbf{b}}{\partial \mathbf{x}_{\text{base}}} \in \mathbb{R}^{3 \times n_{\text{base}}}.\]

The full base–state Jacobian returned by this method is

\[\begin{split}\mathbf{H}_x = \begin{bmatrix} \mathbf{0}_{3 \times 1} \\ \left( \frac{\partial \mathbf{b}}{\partial \mathbf{x}_{\text{base}}} \hat{\mathbf{a}} \right) \end{bmatrix}.\end{split}\]
Parameters:
  • x (numpy.ndarray) – Full system state vector.

  • os (Orbital_State) – Orbital and environmental model providing both the geomagnetic field and its Jacobian with respect to the base states.

Returns:

Base–state Jacobian of the magnetometer measurement with respect to the non-bias system states.

Return type:

numpy.ndarray

bias_jac(x, os)[source]

Jacobian of the magnetometer measurement with respect to the bias state.

When a bias model is present, the measurement equation is

\[z = y_{\text{clean}} + b,\]

where \(b\) is a scalar bias term.

The Jacobian with respect to the bias is therefore

\[\mathbf{H}_b = \frac{\partial z}{\partial b} = \begin{bmatrix} 1 \end{bmatrix}.\]

If no bias model is included, an empty Jacobian is returned.

Parameters:
  • x (numpy.ndarray) – Full system state vector (unused).

  • os (Orbital_State) – Orbital state object (unused).

Returns:

(1, 1) Jacobian matrix if a bias model exists; otherwise a (0, 1) empty matrix.

Return type:

numpy.ndarray

clean_reading(x, os)[source]

Compute the clean (bias– and noise–free) magnetometer measurement.

The geomagnetic field vector in the body frame is obtained from the orbital state via

\[\mathbf{b} = \mathbf{b}(\mathbf{x}, t),\]

and projected onto the magnetometer axis:

\[y_{\text{clean}} = \mathbf{b}^\top \hat{\mathbf{a}}.\]

The magnetic field vector is expected to be provided by

\[\texttt{os.get_state_vector(x)["b"]},\]

where \(\mathbf{b} \in \mathbb{R}^3\).

Parameters:
  • x (numpy.ndarray) – Full system state vector. This includes attitude and any additional states required by the magnetic field model.

  • os (Orbital_State) – Orbital and environmental model providing the geomagnetic field in the body frame.

Returns:

Clean magnetometer measurement along the sensor axis.

Return type:

numpy.ndarray

Parameters:
  • axis (ndarray)

  • sample_time (float)

  • bias (Bias)

  • noise (Noise)

  • estimate_bias (bool)