![]() |
Siphon Regulator 1.0
Nanosattelite attitude determination and control system.
|
It is responsible for processing the sensor data. More...
Macros | |
| #define | CAL_CYC_NUM 100 |
| #define | MEAS_TIME 10 |
| #define | CAL_TIME 10 |
Functions | |
| void | sensor_init (float *gyr_offset) |
| It initiates communication with the sensor. | |
| void | sensor_get_value (float *gyr_offset) |
| It handles reading the value from the sensor. | |
| void | sensor_deg_limit (float *p_deg) |
| It normalizes the orientation value to the –180° to +180° range. | |
| static void | sensor_calibration (float *gyr_offset) |
| It performs the computation of the gyroscope offset. | |
Variables | |
| sensor_data_t | measured_data |
| Current sensor measured data. | |
| settings_t | set_data |
| Main system settings. | |
It is responsible for processing the sensor data.
The library provides manual gyroscope calibration, sensor data acquisition, and reformatting of the orientation value into the –180° to +180° range. It serves as an additional layer on top of the mpu9250 library from driverlib.
Necessary definition and function declaration.
| #define CAL_CYC_NUM 100 |
How much calibration measurement is performed.
Definition at line 25 of file sensor_fcn_def.h.
| #define CAL_TIME 10 |
How often sensor is readed during calibration in milliseconds.
Definition at line 31 of file sensor_fcn_def.h.
| #define MEAS_TIME 10 |
How often sensor is readed in milliseconds.
Definition at line 28 of file sensor_fcn_def.h.
|
static |
It performs the computation of the gyroscope offset.
| gyr_offset | gyroscope offset obtained repeated measurement |
It measures the angular velocity 100 times with a 10 ms period. The result is then averaged. During this procedure, the satellite must remain perfectly stationary.
| void sensor_deg_limit | ( | float * | p_deg | ) |
It normalizes the orientation value to the –180° to +180° range.
| p_deg | gyroscope offset obtained repeated measurement |
The orientation data are converted into an angular format. For values greater than 180°, 360° is subtracted. For values less than –180°, 360° is added.
Definition at line 88 of file sensor_fcn.c.
| void sensor_get_value | ( | float * | gyr_offset | ) |
It handles reading the value from the sensor.
| gyr_offset | gyroscope offset obtained repeated measurement |
The data are read using the mpu9250_basic_read() function from The the mpu9250 library. The values are stored in the global variable measure_data. The gyroscope data are corrected using the previously determined offset, and the orientation is then computed.
Definition at line 49 of file sensor_fcn.c.
| void sensor_init | ( | float * | gyr_offset | ) |
It initiates communication with the sensor.
| gyr_offset | gyroscope offset obtained repeated measurement |
This function initiates communication with the MPU9250 sensor, using the SPI interface. It then calls the sensor_calibration() function, which determines the gyroscope offset. The resulting offset value is subsequently taken into account throughout the rest of the program execution.
Definition at line 24 of file sensor_fcn.c.
|
extern |
|
extern |