Siphon Regulator 1.0
Nanosattelite attitude determination and control system.
Loading...
Searching...
No Matches
Sensors

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.
 

Detailed Description

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.

Macro Definition Documentation

◆ CAL_CYC_NUM

#define CAL_CYC_NUM   100

How much calibration measurement is performed.

Definition at line 25 of file sensor_fcn_def.h.

◆ CAL_TIME

#define CAL_TIME   10

How often sensor is readed during calibration in milliseconds.

Definition at line 31 of file sensor_fcn_def.h.

◆ MEAS_TIME

#define MEAS_TIME   10

How often sensor is readed in milliseconds.

Definition at line 28 of file sensor_fcn_def.h.

Function Documentation

◆ sensor_calibration()

static void sensor_calibration ( float * gyr_offset)
static

It performs the computation of the gyroscope offset.

Parameters
gyr_offsetgyroscope 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.

◆ sensor_deg_limit()

void sensor_deg_limit ( float * p_deg)

It normalizes the orientation value to the –180° to +180° range.

Parameters
p_deggyroscope 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.

◆ sensor_get_value()

void sensor_get_value ( float * gyr_offset)

It handles reading the value from the sensor.

Parameters
gyr_offsetgyroscope 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.

◆ sensor_init()

void sensor_init ( float * gyr_offset)

It initiates communication with the sensor.

Parameters
gyr_offsetgyroscope 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.

Variable Documentation

◆ measured_data

sensor_data_t measured_data
extern

Current sensor measured data.

Definition at line 60 of file main.c.

◆ set_data

settings_t set_data
extern

Main system settings.

Definition at line 61 of file main.c.