Sensor Modeling - spacecraft-design-lab-2019/documentation GitHub Wiki
IMU
IMU information can be found here: https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMX160-DS000.pdf
Below is information from gyroscope for determining sensor noise model
Sensor Noise Model Inputs
- Sensitivity change: pm .02 (due to temp), 0.01 (due to voltage). We will sample from Guassian with mean 0 and cov .0002
- Cross axis sensitivity: 2% . This goes into the matrix for misalignment. We will sample values from Guassian with mean 0 and cov .01 (This would correspond to pm 1%, total of 2% (this might not be an entirely accurate interpretation of the datasheet, since pm on datasheet isn't specified, but it is best guess interpretation)
- Zero Rate Offset: pm 3. We will initialize the value with 3 degrees and perform the random walk adjustments.
Note: parts above may be outdated, experimental calibration will determine these coefficients more accurately. IMU characterization is taking place at https://github.com/spacecraft-design-lab-2019/SensorCalibration
Sun Sensor
We have created a sun model based on code found here: This calculates the geocentric position of the sun. We'll use this to spoof the sun sensors, using this position and the modeled spacecraft position and attitude to determine values from the sun sensors.
Sun Sensor Specs
Sensor Datasheet Link:https://cdn-shop.adafruit.com/datasheets/TSL2561.pdf. We will be using the TSL2561CS model PN.
Main Specs:
Responsivity
Reponsivity information pulled from same datasheet above.
The sensor we have chosen has a normalized reponsivity of 0.8 to 0 in infrared (ir begins at 800 nm).
Nightglow
Measuring Nightglow from the Earth with our sun sensors could allow for attitude determination while in eclipse. These are some values for nightglow irradiance pulled from a photonics website: https://www.photonics.com/Articles/The_Night_Glows_Brighter_in_the_Near-IR/a50540
From this plot, as well as the response spectrum for the sensor and the count information from the sensor datasheet, it seems like we will not have enough resolution for the sun sensor to accurately keep track of Nightglow.
Eclipse
Based on the nightglow information, it seems unlikely we will be able to use this for attitude determination. We will determine whether we are in eclipse by taking the nominal daylight value that the sensor reads and if all sensors are underneath half of this value, then we will say be are in eclipse.
Sun Sensor Math
Compared to the other sensors, a bit more work needed to be put into modeling for sun sensors, both from the standpoint of providing code to run on CircuitPython to take sensor count values and turn it into a vector, as well as simulating sensor values from a vector generated from the simulator. The file sun_sensor_math.py includes all these functionalities combined on one place (it could be wise to redistribute later on based on functionality).
Math without NumPy
In order to run on circuit python, a number of generic functions needed to be rewritten for lists. All of these are included in the sun_sensor_math.py file. For example, a new normalize function needed to be created:
def normalize(vec):
"""
Inputs: vector
Outputs: normalized vector
"""
mag = norm(vec)
return [x/mag for x in vec]
Below is a drawing illustrating how the sun vector is compiled. First, the sensor count values are compared from the positive an negative faces for the X, Y, and Z faces on the satellite. A difference is taken for each face. The X,Y, and Z values are then compiled into a vector and normalized in order to get a total light/illuminance vector. Sun sensors are digital sensors and provide their output in counts. The higher the counts, the more sunlight.
This is NOT the sun vector, as it includes the effect of albedo, the sunlight reflecting off of Earth. The below image illustrates this. We estimate what the albedo vector would be and subtract this off of the total light vector we get from the sensor outputs.
Code Architecture
General Sensor Modeling
General sensor modeling happens in sensormodels.py, where sensors get defined as a class and various helper functions are kept to set up a linear noise model for each created sensor.
Example Usage:
S = Sensor(errormodel = LinearErrorModel.withDim(3, b = np.ones(3), cov = 0.0005))
S.measure(np.zeros(3))
returns
array([0.99649388, 0.9849549 , 1.04930531])