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

Dependencies:   mbed

Committer:
maetugr
Date:
Tue Aug 27 17:37:06 2013 +0000
Revision:
0:3e7450f1a938
Child:
4:f62337b907e5
before 10DOF class (only files already created)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maetugr 0:3e7450f1a938 1 // by MaEtUgR
maetugr 0:3e7450f1a938 2
maetugr 0:3e7450f1a938 3 #ifndef IMU_FILTER_H
maetugr 0:3e7450f1a938 4 #define IMU_FILTER_H
maetugr 0:3e7450f1a938 5
maetugr 0:3e7450f1a938 6 #include "mbed.h"
maetugr 0:3e7450f1a938 7
maetugr 0:3e7450f1a938 8 #define Rad2Deg 57.295779513082320876798154814105 // factor between radians and degrees of angle (180/Pi)
maetugr 0:3e7450f1a938 9
maetugr 0:3e7450f1a938 10 class IMU_Filter
maetugr 0:3e7450f1a938 11 {
maetugr 0:3e7450f1a938 12 public:
maetugr 0:3e7450f1a938 13 IMU_Filter();
maetugr 0:3e7450f1a938 14 void compute(float dt, const float * gyro_data, const float * acc_data, const float * Comp_data);
maetugr 0:3e7450f1a938 15 float angle[3]; // calculated values of the position [0: x,roll | 1: y,pitch | 2: z,yaw]
maetugr 0:3e7450f1a938 16
maetugr 0:3e7450f1a938 17 // IMU/AHRS
maetugr 0:3e7450f1a938 18 float q0, q1, q2, q3; // quaternion elements representing the estimated orientation
maetugr 0:3e7450f1a938 19 float exInt , eyInt , ezInt; // scaled integral error
maetugr 0:3e7450f1a938 20 void IMUupdate(float halfT, float gx, float gy, float gz, float ax, float ay, float az);
maetugr 0:3e7450f1a938 21 void AHRSupdate(float halfT, float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz);
maetugr 0:3e7450f1a938 22 private:
maetugr 0:3e7450f1a938 23 float d_Gyro_angle[3];
maetugr 0:3e7450f1a938 24 void get_Acc_angle(const float * Acc_data);
maetugr 0:3e7450f1a938 25 float Acc_angle[3];
maetugr 0:3e7450f1a938 26 };
maetugr 0:3e7450f1a938 27
maetugr 0:3e7450f1a938 28 #endif