34 lines
1.1 KiB
C
34 lines
1.1 KiB
C
#ifndef IMU_CALIBRATION_H
|
|
#define IMU_CALIBRATION_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "fusion_measurement.h"
|
|
|
|
/*
|
|
* Sensor-independent calibration in the IMU body frame.
|
|
*
|
|
* corrected = transform * (measured - bias - temperature_coefficient * dT)
|
|
*
|
|
* The transform can contain scale, cross-axis and mounting-axis corrections.
|
|
* Temperature correction is deliberately opt-in; collecting temperature does
|
|
* not change measurements unless temperature_compensation_enabled is true.
|
|
*/
|
|
typedef struct {
|
|
double accel_bias_mps2[3];
|
|
double gyro_bias_rps[3];
|
|
double accel_transform[3][3];
|
|
double gyro_transform[3][3];
|
|
double reference_temperature_c;
|
|
double accel_temperature_coefficient_mps2_per_c[3];
|
|
double gyro_temperature_coefficient_rps_per_c[3];
|
|
bool temperature_compensation_enabled;
|
|
} imu_calibration_t;
|
|
|
|
void imu_calibration_default(imu_calibration_t* calibration);
|
|
bool imu_calibration_is_valid(const imu_calibration_t* calibration);
|
|
bool imu_calibration_apply(const imu_calibration_t* calibration,
|
|
fusion_imu_measurement_t* measurement);
|
|
|
|
#endif
|