ADCS.estimators.measurement_stack module

Canonical measurement assembly for attitude estimators.

MeasurementStack is the one estimator-facing owner of measurement order, availability, residual coordinates, covariance, and Jacobians. Raw telemetry remains in the satellite’s historical order: attitude sensors followed by reaction-wheel momentum measurements. The residual vector may have a different dimension: a quaternion attitude measurement is reduced from four stored coefficients to three local attitude coordinates.

class ADCS.estimators.measurement_stack.MeasurementStack(satellite)[source]

Bases: object

Assemble estimator measurements from an EstimatedSatellite.

The stack has one entry for each attitude sensor and one entry for each reaction-wheel momentum measurement. An entry is active only when all of its raw values are finite, it is explicitly enabled, and, when time_s is supplied, its sample_time schedule is due. This deliberately makes a partially missing vector measurement unavailable as a whole: retaining a subset would silently change that sensor’s physical measurement model.

active_mask is entry-wise, while active_measurements and residual return compact vectors in the selected entry order.

Quaternion residuals, Jacobians, and covariances consistently use right attitude errors. This is intentionally fixed rather than exposed as a partially supported convention knob.

Parameters:

satellite (Any)

active_mask(measurements, *, time_s=None, enabled=None, epoch_s=0.0, predicted=None)[source]

Return the active entry mask for a raw measurement vector.

An entry is also inactive when predicted is supplied and any of its predicted values are non-finite. time_s is elapsed seconds on the sensor sampling timeline; it is intentionally not an orbital J2000 value. When omitted, a received finite measurement is treated as live, which is the useful default for asynchronous telemetry streams. A sensor with sample_time <= 0 is treated as continuously sampled. Reaction-wheel measurements are continuously sampled until the hardware model gains a sampling period.

Parameters:
  • measurements (Any)

  • time_s (float | None)

  • enabled (Sequence[bool] | None)

  • epoch_s (float)

  • predicted (Any | None)

Return type:

ndarray

active_measurements(measurements, active_mask)[source]

Return the compact raw measurement vector selected by active_mask.

Parameters:
  • measurements (Any)

  • active_mask (Any)

Return type:

ndarray

covariance(state, active_mask, *, form='full', quaternion_mode='quaternion_vector')[source]

Return active residual covariance R using right-error coordinates.

Parameters:
  • state (EstimatorState)

  • active_mask (Any)

  • form (str)

  • quaternion_mode (str)

Return type:

Covariance

jacobian(state, orbital_state, active_mask, *, quaternion_mode='quaternion_vector')[source]

Return the active right-error EKF Jacobian H in tangent coordinates.

Parameters:
  • state (EstimatorState)

  • orbital_state (Any)

  • active_mask (Any)

  • quaternion_mode (str)

Return type:

ndarray

predict(state, orbital_state, active_mask=None)[source]

Evaluate raw predicted measurements h(x) in canonical order.

When active_mask is supplied, inactive sensor models are not evaluated and their raw slots are filled with NaNs. Pass the result back to active_mask() as predicted to remove entries that are unavailable at the estimated state.

Parameters:
Return type:

ndarray

readings(state, orbital_state, *, dmode=None)[source]

Return raw readings in the stack’s canonical order.

This is the estimator-neutral telemetry path. Estimators should pass its result to active_mask() before performing an update.

Parameters:
  • state (State)

  • orbital_state (Any)

  • dmode (Any)

Return type:

ndarray

residual(measurements, predicted, active_mask, *, quaternion_mode='quaternion_vector')[source]

Return compact innovations in their proper local coordinates.

Additive sources use z - h(x). A quaternion star tracker uses the right relative quaternion q_pred^{-1} * q_measured and converts it to the three attitude coordinates selected by quaternion_mode.

Parameters:
  • measurements (Any)

  • predicted (Any)

  • active_mask (Any)

  • quaternion_mode (str)

Return type:

ndarray

property entries: tuple[_MeasurementEntry, ...]

Ordered measurement sources, primarily for diagnostics and tests.

property source_order: tuple[str, ...]

Stable, human-readable order of the measurement sources.