47 #include <matrix/math.hpp> 55 static_assert(GYRO_COUNT_MAX == 3,
56 "GYRO_COUNT_MAX must be 3 (if changed, add/remove TC_* params to match the count)");
57 static_assert(ACCEL_COUNT_MAX == 3,
58 "ACCEL_COUNT_MAX must be 3 (if changed, add/remove TC_* params to match the count)");
59 static_assert(BARO_COUNT_MAX == 3,
60 "BARO_COUNT_MAX must be 3 (if changed, add/remove TC_* params to match the count)");
77 int set_sensor_id_accel(uint32_t device_id,
int topic_instance);
78 int set_sensor_id_baro(uint32_t device_id,
int topic_instance);
93 int apply_corrections_gyro(
int topic_instance, matrix::Vector3f &sensor_data,
float temperature,
float *offsets,
96 int apply_corrections_accel(
int topic_instance, matrix::Vector3f &sensor_data,
float temperature,
float *offsets,
99 int apply_corrections_baro(
int topic_instance,
float &sensor_data,
float temperature,
float *offsets,
float *scales);
120 struct SensorCalData1D {
134 struct SensorCalHandles1D {
164 struct SensorCalData3D {
176 struct SensorCalHandles3D {
190 int32_t gyro_tc_enable;
191 SensorCalData3D gyro_cal_data[GYRO_COUNT_MAX];
192 int32_t accel_tc_enable;
193 SensorCalData3D accel_cal_data[ACCEL_COUNT_MAX];
194 int32_t baro_tc_enable;
195 SensorCalData1D baro_cal_data[BARO_COUNT_MAX];
199 struct ParameterHandles {
201 SensorCalHandles3D gyro_cal_handles[GYRO_COUNT_MAX];
203 SensorCalHandles3D accel_cal_handles[ACCEL_COUNT_MAX];
205 SensorCalHandles1D baro_cal_handles[BARO_COUNT_MAX];
213 static int initialize_parameter_handles(ParameterHandles ¶meter_handles);
233 bool calc_thermal_offsets_1D(SensorCalData1D &coef,
float measured_temp,
float &offset);
252 bool calc_thermal_offsets_3D(
const SensorCalData3D &coef,
float measured_temp,
float offset[]);
255 Parameters _parameters;
258 struct PerSensorData {
261 for (
int i = 0; i < SENSOR_COUNT_MAX; ++i) { device_mapping[i] = 255; last_temperature[i] = -100.0f; }
263 void reset_temperature()
265 for (
int i = 0; i < SENSOR_COUNT_MAX; ++i) { last_temperature[i] = -100.0f; }
267 uint8_t device_mapping[SENSOR_COUNT_MAX];
268 float last_temperature[SENSOR_COUNT_MAX];
270 PerSensorData _gyro_data;
271 PerSensorData _accel_data;
272 PerSensorData _baro_data;
276 static inline int set_sensor_id(uint32_t device_id,
int topic_instance, PerSensorData &sensor_data,
277 const T *sensor_cal_data, uint8_t sensor_count_max);
int apply_corrections_gyro(int topic_instance, matrix::Vector3f &sensor_data, float temperature, float *offsets, float *scales)
Apply Thermal corrections to gyro (& other) sensor data.
Definition: temperature_compensation.cpp:395
Global flash based parameter store.
int set_sensor_id_gyro(uint32_t device_id, int topic_instance)
supply information which device_id matches a specific uORB topic_instance (needed if a system has mul...
Definition: temperature_compensation.cpp:354
Common header for mathlib exports.
int parameters_update(bool hil_enabled=false)
(re)load the parameters.
Definition: temperature_compensation.cpp:154
void print_status()
output current configuration status to console
Definition: temperature_compensation.cpp:480
class TemperatureCompensation Applies temperature compensation to sensor data.
Definition: temperature_compensation.h:66
uint32_t param_t
Parameter handle.
Definition: param.h:98