Rleg  2
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Functions
Routines to calibrate sensors
Collaboration diagram for Routines to calibrate sensors:

Functions

void calibrate_all (IMU_DATA_STRUCT *imu_data)
 Calibrate all sensors. More...
 
void calibrate_imu (IMU_DATA_STRUCT *imu_data)
 Calibrate imu sensors. More...
 

Detailed Description

Function Documentation

void calibrate_all ( IMU_DATA_STRUCT imu_data)

Calibrate all sensors.

Definition at line 8 of file calibration.c.

References calibrate_imu().

Referenced by control_task(), and periodic_task_1().

9 {
10  calibrate_imu(imu_data);
11  return;
12 }
void calibrate_imu(IMU_DATA_STRUCT *imu_data)
Calibrate imu sensors.
Definition: calibration.c:14

Here is the call graph for this function:

Here is the caller graph for this function:

void calibrate_imu ( IMU_DATA_STRUCT imu_data)

Calibrate imu sensors.

Definition at line 14 of file calibration.c.

References IMU_DATA_STRUCT::acc, IMU_DATA_STRUCT::calibrated::acc, ACC_BIAS_X, ACC_BIAS_Y, ACC_BIAS_Z, ACC_FS_X, ACC_FS_Y, ACC_FS_Z, IMU_DATA_STRUCT::calib, IMU_DATA_STRUCT::calib_temp, IMU_DATA_STRUCT::gyr, IMU_DATA_STRUCT::calibrated::gyr, GYR_BIAS_X, GYR_BIAS_Y, GYR_BIAS_Z, GYR_FS_X, GYR_FS_Y, GYR_FS_Z, IMU_DATA_STRUCT::mag, IMU_DATA_STRUCT::calibrated::mag, MAG_BIAS_X, MAG_BIAS_Y, MAG_BIAS_Z, MAG_FS_X, MAG_FS_Y, MAG_FS_Z, IMU_DATA_STRUCT::temp, DATA_XYZ::x, DATA_XYZ_DOUBLE::x, DATA_XYZ::y, DATA_XYZ_DOUBLE::y, DATA_XYZ::z, and DATA_XYZ_DOUBLE::z.

Referenced by calibrate_all().

15 {
16  // With this parameters, the vectors of acceleration and magnetic field will have norm = 1 theorically (i.e. in g or G)
17  imu_data->calib.acc.x = ((double)imu_data->acc.x-ACC_BIAS_X)/ACC_FS_X;
18  imu_data->calib.acc.y = ((double)imu_data->acc.y-ACC_BIAS_Y)/ACC_FS_Y;
19  imu_data->calib.acc.z = ((double)imu_data->acc.z-ACC_BIAS_Z)/ACC_FS_Z;
20 
21  imu_data->calib.mag.x = ((double)imu_data->mag.x-ACC_BIAS_X)/ACC_FS_X;
22  imu_data->calib.mag.y = ((double)imu_data->mag.y-ACC_BIAS_Y)/ACC_FS_Y;
23  imu_data->calib.mag.z = ((double)imu_data->mag.z-ACC_BIAS_Z)/ACC_FS_Z;
24 
25  // With this parameters, we consider right datasheet scale and we get in rad/s
26  imu_data->calib.gyr.x = ((double)imu_data->gyr.x-GYR_BIAS_X)/GYR_FS_X;
27  imu_data->calib.gyr.y = ((double)imu_data->gyr.y-GYR_BIAS_X)/GYR_FS_Y;
28  imu_data->calib.gyr.z = ((double)imu_data->gyr.z-GYR_BIAS_X)/GYR_FS_Z;
29 
30  return;
31 }
#define ACC_FS_Y
Definition: calibration.h:19
#define ACC_BIAS_X
Definition: calibration.h:15
#define GYR_FS_X
Definition: calibration.h:33
short int y
Definition: communication.h:77
#define ACC_BIAS_Z
Definition: calibration.h:17
DATA_XYZ mag
Magnetormeter Vector.
Definition: communication.h:96
#define ACC_FS_X
Definition: calibration.h:18
#define GYR_BIAS_X
Definition: calibration.h:30
#define ACC_BIAS_Y
Definition: calibration.h:16
DATA_XYZ acc
Accel Vector.
Definition: communication.h:94
#define ACC_FS_Z
Definition: calibration.h:20
short int z
Definition: communication.h:78
#define GYR_FS_Z
Definition: calibration.h:35
struct IMU_DATA_STRUCT::calibrated calib
DATA_XYZ gyr
Gyrometer Vector.
Definition: communication.h:95
short int x
Definition: communication.h:76
#define GYR_FS_Y
Definition: calibration.h:34

Here is the caller graph for this function: