An fully working IMU-Filter and Sensor drivers for the 10DOF-Board over I2C. All in one simple class. Include, calibrate sensors, call read, get angles. (3D Visualisation code for Python also included) Sensors: L3G4200D, ADXL345, HMC5883, BMP085
Diff: IMU/IMU_Filter/IMU_Filter.h
- Revision:
- 0:3e7450f1a938
- Child:
- 4:f62337b907e5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IMU/IMU_Filter/IMU_Filter.h Tue Aug 27 17:37:06 2013 +0000 @@ -0,0 +1,28 @@ +// by MaEtUgR + +#ifndef IMU_FILTER_H +#define IMU_FILTER_H + +#include "mbed.h" + +#define Rad2Deg 57.295779513082320876798154814105 // factor between radians and degrees of angle (180/Pi) + +class IMU_Filter +{ + public: + IMU_Filter(); + void compute(float dt, const float * gyro_data, const float * acc_data, const float * Comp_data); + float angle[3]; // calculated values of the position [0: x,roll | 1: y,pitch | 2: z,yaw] + + // IMU/AHRS + float q0, q1, q2, q3; // quaternion elements representing the estimated orientation + float exInt , eyInt , ezInt; // scaled integral error + void IMUupdate(float halfT, float gx, float gy, float gz, float ax, float ay, float az); + void AHRSupdate(float halfT, float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz); + private: + float d_Gyro_angle[3]; + void get_Acc_angle(const float * Acc_data); + float Acc_angle[3]; +}; + +#endif \ No newline at end of file