Basic_Frame_TypeC_2023_Omni
Loading...
Searching...
No Matches
imu.hpp
1#ifndef __IMU_H
2#define __IMU_H
3
4#include "madgewick.hpp" // TODO: move to attitude_types.h eventually.
5#include "subsystems_interfaces.h"
6#include "subsystems_types.h"
7
8class Imu : public IImu {
9 private:
10 Madgewick_Filter madgewick;
11 float temperature;
12 float gyro[3], accel[3], mag[3];
13
14 const float accel_bias[3] = {0.076091, -0.056203, 0.049820};
15 const float accel_scale[3][3] = {{1.004290, 0.002457, 0.000033},
16 {0.002457, 1.002675, 0.002101},
17 {0.000033, 0.002101, 0.994819}};
18 const float gyro_bias[3] = {0.00127898, 0.00048873, 0.00255299};
19 const float gyro_scale[3][3] = {
20 {1.0, 0, 0},
21 {0.0, 1.0, 0},
22 {0.0, 0, 1.0},
23 };
24 const float orientation[3][3];
25
26 public:
27 Imu(uint32_t sampling_rate_, float beta_, const float orientation_[3][3]);
28 void init() override;
29 float get_temp() override;
30 void get_attitude(Attitude_t& attitude) override;
31 void get_sensor_data(AhrsSensor_t& sensor) override;
32 void set_heat_pwm(uint16_t duty_cycle) override;
33 void gather_sensor_data(AhrsSensor_t& sensor, bool read_mag) override;
34 void adjust_data(float output[3], float data[3], const float bias[3],
35 const float scale[3][3]);
36};
37
38#endif
Definition subsystems_interfaces.h:31
Definition madgewick.hpp:8
Definition attitude_types.h:9
Definition attitude_types.h:28