sensors module¶
Sensors module for attitude determination and control system.
This module models the behavior of a suite of sensors and contains classes that abstract gyroscopes, Earth horizon sensors, and magnetometers in order to produce attitude and angular velocity estimates.
-
class
sensors.
EarthHorizonSensor
(accuracy)¶ Bases:
object
A class to store Earth horizon sensor parameters and methods
Parameters: resolution (float) – the accuracy of the sensor in degrees; an accuracy of 0 means no measurement noise is applied (it is a perfect sensor) -
noise_vals
¶ numpy ndarray – a cache of pre-generated noise values to aid in the addition of noise
-
estimate_earth_direction
(q_actual, r, t, delta_t)¶ Estimates the direction vector to the Earth
Parameters: - q_actual (numpy ndarray) – the actual quaternion representing the attitude (from the inertial to body frame) of the spacecraft
- r (numpy ndarray) – the inertial position of the spacecraft (m)
- t (float) – the current simulation time in seconds
- delta_t (float) – the time between user-defined integrator steps (not the internal/adaptive integrator steps) in seconds
Returns: - the direction vector to the Earth as measured by the
sensor in body coordinates
Return type: numpy ndarray
-
get_noise
(t, delta_t)¶ Gets the Gaussian noise for a set of x, y, and z direction measurements
- NOTE: This method uses a cache of random values generated in this
- class’s constructor. This is done to (1) reduce the overhead of many individual rvs calls and (2) ensure that all adaptive integrator steps in between user-defined steps use the same noise value (so that the dynamics are not constantly changing). Without this, the integrator fails to move forward in time. Therefore, a custom hash function is used to apply the same noise is necessary cases.
Parameters: - t (float) – the current simulation time in seconds
- delta_t (float) – the time between user-defined integrator steps (not the internal/adaptive integrator steps) in seconds
Returns: the noise vector (noise in x, y, and z)
Return type: numpy ndarray
-
-
class
sensors.
Gyros
(bias_stability, angular_random_walk)¶ Bases:
object
A class to store gyroscope parameters and methods
Parameters: - bias_stability (float) – the bias stability of the gyro in deg/hr
- angular_random_walk (float) – the angular random walk of the gyro in deg/sqrt(hr)
-
bias
¶ numpy ndarray – the biases of the gyros throughout the duration of a simulation (3x1)
-
noise_vals
¶ numpy ndarray – a cache of pre-generated noise values to aid in the addition of noise
-
estimate_angular_velocity
(w_actual, t, delta_t)¶ Provides an estimated angular velocity (adding noise & bias to the actual)
Parameters: - w_actual (numpy ndarray) – the actual angular velocity in rad/s
- t (float) – the current simulation time in seconds
- delta_t (float) – the time between user-defined integrator steps (not the internal/adaptive integrator steps) in seconds
Returns: the estimated angular velocity in rad/s
Return type: numpy ndarray
-
get_noise
(t, delta_t)¶ Gets the Gaussian noise for a set of x, y, and z gyro measurements
- NOTE: This method uses a cache of random values generated in this
- class’s constructor. This is done to (1) reduce the overhead of many individual rvs calls and (2) ensure that all adaptive integrator steps in between user-defined steps use the same noise value (so that the dynamics are not constantly changing). Without this, the integrator fails to move forward in time. Therefore, a custom hash function is used to apply the same noise is necessary cases.
Parameters: - t (float) – the current simulation time in seconds
- delta_t (float) – the time between user-defined integrator steps (not the internal/adaptive integrator steps) in seconds
Returns: the noise vector (noise in x, y, and z)
Return type: numpy ndarray
-
class
sensors.
Magnetometer
(resolution=0)¶ Bases:
object
A class to store magnetometer parameters and methods
Parameters: resolution (float) – the resolution of the magnetometer in Tesla; a resolution of 0 T means no measurement noise (it is a perfect sensor) -
noise_vals
¶ numpy ndarray – a cache of pre-generated noise values to aid in the addition of noise
-
estimate_magnetic_field
(q_actual, r, t, delta_t)¶ Estimates the local magnetic field in body coordinates
Parameters: - q_actual (numpy ndarray) – the actual quaternion representing the attitude (from the inertial to body frame) of the spacecraft
- r (numpy ndarray) – the inertial position of the spacecraft (m)
- t (float) – the current simulation time in seconds
- delta_t (float) – the time between user-defined integrator steps (not the internal/adaptive integrator steps) in seconds
Returns: - the vector representing the local magnetic field
measured in body coordinates (with measurement noise applied)
Return type: numpy ndarray
-
get_noise
(t, delta_t)¶ Gets the Gaussian noise for a set of x, y, and z magnetic field measurements
- NOTE: This method uses a cache of random values generated in this
- class’s constructor. This is done to (1) reduce the overhead of many individual rvs calls and (2) ensure that all adaptive integrator steps in between user-defined steps use the same noise value (so that the dynamics are not constantly changing). Without this, the integrator fails to move forward in time. Therefore, a custom hash function is used to apply the same noise is necessary cases.
Parameters: - t (float) – the current simulation time in seconds
- delta_t (float) – the time between user-defined integrator steps (not the internal/adaptive integrator steps) in seconds
Returns: the noise vector (noise in x, y, and z)
Return type: numpy ndarray
-