MPU6050 arduino port by Szymon Gaertig (http://mbed.org/users/garfieldsg/code/MPU6050/) 1 memory overflow error corrected.

Dependents:   MbedFreeIMU gurvanAHRS

Fork of MPU6050 by Simon Garfieldsg

Committer:
pommzorz
Date:
Sat Jun 22 11:23:45 2013 +0000
Revision:
6:40ac13ef7290
Commit;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pommzorz 6:40ac13ef7290 1 #ifndef _GURVIMU_H_
pommzorz 6:40ac13ef7290 2 #define _GURVIMU_H_
pommzorz 6:40ac13ef7290 3
pommzorz 6:40ac13ef7290 4 #include "mbed.h"
pommzorz 6:40ac13ef7290 5 #include "MPU6050.h"
pommzorz 6:40ac13ef7290 6
pommzorz 6:40ac13ef7290 7 class GurvIMU {
pommzorz 6:40ac13ef7290 8 private:
pommzorz 6:40ac13ef7290 9 //Variables
pommzorz 6:40ac13ef7290 10 MPU6050 mpu;
pommzorz 6:40ac13ef7290 11 float twoKp; // 2 * proportional gain (Kp)
pommzorz 6:40ac13ef7290 12 float twoKi; // 2 * integral gain (Ki)
pommzorz 6:40ac13ef7290 13 float integralFBx, integralFBy, integralFBz; // integral error terms scaled by Ki
pommzorz 6:40ac13ef7290 14 float q0, q1, q2, q3; // quaternion of sensor frame relative to auxiliary frame
pommzorz 6:40ac13ef7290 15 float ax, ay, az, gx, gy, gz;
pommzorz 6:40ac13ef7290 16 float sample_freq;
pommzorz 6:40ac13ef7290 17 float offset[6];
pommzorz 6:40ac13ef7290 18 Timer timer_us;
pommzorz 6:40ac13ef7290 19 float dt_us;
pommzorz 6:40ac13ef7290 20 float cycle_nb;
pommzorz 6:40ac13ef7290 21
pommzorz 6:40ac13ef7290 22
pommzorz 6:40ac13ef7290 23 //Functions
pommzorz 6:40ac13ef7290 24 void getOffset();
pommzorz 6:40ac13ef7290 25 void getValues(float * values);
pommzorz 6:40ac13ef7290 26 void AHRS_update(float gx, float gy, float gz, float ax, float ay, float az);
pommzorz 6:40ac13ef7290 27 void getQ(float * q);
pommzorz 6:40ac13ef7290 28
pommzorz 6:40ac13ef7290 29 public:
pommzorz 6:40ac13ef7290 30 GurvIMU();
pommzorz 6:40ac13ef7290 31 void init();
pommzorz 6:40ac13ef7290 32 void getYawPitchRollRad(float * ypr);
pommzorz 6:40ac13ef7290 33 void getVerticalAcceleration(float * av);
pommzorz 6:40ac13ef7290 34
pommzorz 6:40ac13ef7290 35 };
pommzorz 6:40ac13ef7290 36
pommzorz 6:40ac13ef7290 37 //Fast Inverse Square Root
pommzorz 6:40ac13ef7290 38 float invSqrt(float number);
pommzorz 6:40ac13ef7290 39
pommzorz 6:40ac13ef7290 40 #endif /* _GURVIMU_H_ */