ADCS.satellite_hardware.sensors.sensor module¶
- class ADCS.satellite_hardware.sensors.sensor.Sensor(sample_time=0.1, output_length=1, bias=None, noise=None, estimate_bias=False)[source]¶
Bases:
objectBase class for all Attitude Determination and Control System (ADCS) sensor models.
This class defines a unified measurement interface for all onboard sensors (e.g., gyroscopes, magnetometers, sun sensors, star trackers). It encapsulates the full sensor measurement pipeline, including:
Ideal (noise– and bias–free) measurement generation
Additive stochastic bias modeling
Additive measurement noise modeling
Time propagation of bias and noise processes
Analytical Jacobians for use in estimation filters (e.g., EKF, UKF)
Subclasses must implement at least
clean_reading()and may override Jacobian methods as required by the sensor physics.Mathematical measurement model¶
The generic sensor model implemented by this class is
\[\mathbf{z}_k = \mathbf{h}(\mathbf{x}_k, \mathcal{O}_k) + \mathbf{b}_k + \mathbf{n}_k\]where:
Notation¶ Symbol
Description
\(\mathbf{z}_k\)
Sensor measurement vector
\(\mathbf{x}_k\)
Full system state vector
\(\mathcal{O}_k\)
Orbital/environmental state
\(\mathbf{h}\)
Ideal (clean) sensor model
\(\mathbf{b}_k\)
Sensor bias
\(\mathbf{n}_k\)
Measurement noise
Bias and noise are modeled using instances of
BiasandNoise, respectively.Bias evolution is typically time-dependent:
\[\mathbf{b}_{k+1} = f_b(\mathbf{b}_k, t_k)\]while noise is assumed to be white or colored stochastic noise:
\[\mathbf{n}_k \sim \mathcal{N}(\mathbf{0}, \mathbf{R})\]- param sample_time:
Sampling period of the sensor in seconds.
- type sample_time:
float
- param output_length:
Dimension of the sensor measurement output.
- type output_length:
int
- param bias:
Bias model instance. If
None, a zero-bias model is used.- type bias:
Biasor None- param noise:
Noise model instance. If
None, a zero-noise model is used.- type noise:
Noiseor None- param estimate_bias:
Indicates whether the sensor bias is included in the estimator state.
- type estimate_bias:
bool
- return:
None
- rtype:
None
Notes
This class does not assume any specific state ordering.
Bias and noise updates are controlled via
ErrorMode.
- basestate_jac(x, os)[source]¶
Jacobian of the clean sensor measurement with respect to the base states.
This method returns the Jacobian
\[\mathbf{H}_x = \frac{\partial \mathbf{h}(\mathbf{x}, \mathcal{O})} {\partial \mathbf{x}_{\text{base}}}\]where \(\mathbf{x}_{\text{base}}\) denotes the non-bias portion of the system state.
The default implementation assumes that the measurement is independent of the base state and returns a zero matrix. Sensor subclasses should override this method to provide physically meaningful derivatives.
- Parameters:
x (numpy.ndarray) – Full system state vector.
os (
Orbital_State) – Orbital and environmental state.
- Returns:
Jacobian matrix of shape
(output_length, N_base_states).- Return type:
numpy.ndarray
- bias_jac(x, os)[source]¶
Jacobian of the measurement with respect to the sensor bias state.
If the measurement model is
\[\mathbf{z} = \mathbf{h}(\mathbf{x}, \mathcal{O}) + \mathbf{b},\]then the Jacobian with respect to the bias is
\[\mathbf{H}_b = \frac{\partial \mathbf{z}}{\partial \mathbf{b}} = \mathbf{I}\]where \(\mathbf{I}\) is the identity matrix of dimension
output_length.If the sensor does not include a bias model, an empty Jacobian is returned.
- Parameters:
x (numpy.ndarray) – Full system state vector (unused).
os (
Orbital_State) – Orbital state object (unused).
- Returns:
Identity matrix of shape
(output_length, output_length)if a bias model exists; otherwise an empty matrix.- Return type:
numpy.ndarray
- reading(x, os, dmode=None)[source]¶
Compute the full sensor measurement including bias and noise.
This method evaluates the complete sensor pipeline:
Compute the clean (ideal) sensor reading
Add the current sensor bias
Update the bias process (if enabled)
Add measurement noise
Update the noise process (if enabled)
Formally, the measurement is computed as
\[\mathbf{z} = \mathbf{h}(\mathbf{x}, \mathcal{O}) + \mathbf{b}(t) + \mathbf{n}\]where:
\(\mathbf{h}\) is implemented by
clean_reading()\(\mathbf{b}(t)\) is provided by
Bias\(\mathbf{n}\) is provided by
Noise
The inclusion and propagation of bias and noise are controlled via
ErrorMode.- Parameters:
x (numpy.ndarray) – Full system state vector.
os (
Orbital_State) – Orbital and environmental state providing the current timeos.J2000.dmode (
ErrorModeor None) – Error mode configuration controlling bias and noise behavior. IfNone, all effects are enabled.
- Returns:
Sensor measurement vector.
- Return type:
numpy.ndarray