ADCS.satellite_hardware.sensors.sunsensor module¶
- class ADCS.satellite_hardware.sensors.sunsensor.SunSensor(axis, efficiency, sample_time=0.1, bias=None, noise=None, estimate_bias=False)[source]¶
Bases:
SensorSingle-axis coarse Sun sensor model.
This class implements a single-axis coarse Sun sensor that measures the cosine of the incidence angle between a fixed body-frame sensor axis and the Sun direction. The measurement is scaled by a constant efficiency factor and clipped to zero when the Sun is outside the sensor’s field of view.
The sensor follows the generic interface defined by
Sensor.Measurement model¶
Let
Symbol
Description
\(\hat{\mathbf{a}}\)
Unit sensor axis (body frame)
\(\hat{\mathbf{s}}\)
Unit Sun direction (body frame)
\(\eta\)
Scalar sensor efficiency
The Sun direction expressed in the body frame is obtained from the orbital state as
\[\hat{\mathbf{s}} = \frac{\mathbf{s} - \mathbf{r}} {\lVert \mathbf{s} - \mathbf{r} \rVert},\]where \(\mathbf{r}\) is the spacecraft position and \(\mathbf{s}\) is the Sun position, both provided by
get_state_vector().The cosine of the incidence angle between the Sun and the sensor axis is
\[c = \hat{\mathbf{a}}^\top \hat{\mathbf{s}}.\]The clean (noise- and bias-free) measurement is defined as
\[\begin{split}y_{\text{clean}} = \begin{cases} \eta \, \max(c, 0), & \text{if } \texttt{os.is\_sunlit()} = \text{True}, \\ 0, & \text{if } \texttt{os.is\_sunlit()} = \text{False}. \end{cases}\end{split}\]Measurement with errors¶
When bias and noise models are present, the full measurement is
\[z = y_{\text{clean}} + b + n,\]where
Notes
This is a coarse Sun sensor intended for low-accuracy attitude determination.
The sensor output is scalar, so
output_length = 1.In eclipse, the clean measurement and all Jacobians are identically zero.
- basestate_jac(x, os)[source]¶
Jacobian of the clean Sun sensor measurement with respect to the base ADCS state.
The base state is defined as
\[\mathbf{x} = [\omega_x, \omega_y, \omega_z, q_0, q_1, q_2, q_3]^\top,\]where \(\boldsymbol{\omega}\) is the body angular rate and \(\mathbf{q}\) is the attitude quaternion.
The Sun direction is
\[\hat{\mathbf{s}} = \frac{\mathbf{s} - \mathbf{r}} {\lVert \mathbf{s} - \mathbf{r} \rVert},\]and the cosine incidence is
\[c = \hat{\mathbf{a}}^\top \hat{\mathbf{s}}.\]The derivative of the normalized Sun vector with respect to the state is computed using
normed_vec_jac(), yielding\[\frac{\partial \hat{\mathbf{s}}}{\partial \mathbf{x}}.\]The derivative of the cosine term is then
\[\frac{\partial c}{\partial \mathbf{x}} = \left( \frac{\partial \hat{\mathbf{s}}}{\partial \mathbf{x}} \right)^\top \hat{\mathbf{a}}.\]Because the measurement uses \(\max(c, 0)\), the Jacobian is defined to be zero whenever \(c \le 0\). Furthermore, when the spacecraft is in eclipse (
os.is_sunlit() == False), the measurement is identically zero and all partial derivatives vanish.- Parameters:
x (numpy.ndarray) – Full 7-element ADCS state vector.
os (
Orbital_State) – Orbital state providing Sun/spacecraft geometry and lighting information.
- Returns:
Jacobian of the clean measurement with respect to the base state, with shape
(7, 1). The Jacobian is zero if the spacecraft is in eclipse or if the Sun is behind the sensor.- Return type:
numpy.ndarray
- bias_jac(x, os)[source]¶
Jacobian of the measurement with respect to the Sun sensor bias.
If a bias model is present, the measurement equation is
\[z = y + b,\]where \(b\) is a scalar bias. The corresponding Jacobian is
\[\frac{\partial z}{\partial b} = 1.\]If no bias model exists, an empty Jacobian is returned.
- Parameters:
x (numpy.ndarray) – Full system state vector (unused).
os (
Orbital_State) – Orbital state object (unused).
- Returns:
A
(1,1)array containing1if a bias exists, otherwise a(0,1)empty array.- Return type:
numpy.ndarray
- clean_reading(x, os)[source]¶
Compute the clean (noise- and bias-free) Sun sensor measurement.
The Sun direction is computed from the orbital state as
\[\hat{\mathbf{s}} = \frac{\mathbf{s} - \mathbf{r}} {\lVert \mathbf{s} - \mathbf{r} \rVert},\]and the cosine incidence term is
\[c = \hat{\mathbf{a}}^\top \hat{\mathbf{s}}.\]The illuminated contribution is defined by
\[\text{illumination} = \max(c, 0).\]The resulting clean measurement is
\[\begin{split}y_{\text{clean}} = \begin{cases} \eta \, \text{illumination}, & \text{if sunlit}, \\ 0, & \text{if in eclipse}. \end{cases}\end{split}\]- Parameters:
x (numpy.ndarray) – Full system state vector.
os (
Orbital_State) – Orbital state providing spacecraft position, Sun position, and lighting conditions viais_sunlit().
- Returns:
Clean Sun sensor measurement of shape
(1,). If the spacecraft is not sunlit, the value is defined to beNaN.- Return type:
numpy.ndarray