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
Diff: GurvIMU.h
- Revision:
- 6:40ac13ef7290
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GurvIMU.h Sat Jun 22 11:23:45 2013 +0000 @@ -0,0 +1,40 @@ +#ifndef _GURVIMU_H_ +#define _GURVIMU_H_ + +#include "mbed.h" +#include "MPU6050.h" + +class GurvIMU { + private: + //Variables + MPU6050 mpu; + float twoKp; // 2 * proportional gain (Kp) + float twoKi; // 2 * integral gain (Ki) + float integralFBx, integralFBy, integralFBz; // integral error terms scaled by Ki + float q0, q1, q2, q3; // quaternion of sensor frame relative to auxiliary frame + float ax, ay, az, gx, gy, gz; + float sample_freq; + float offset[6]; + Timer timer_us; + float dt_us; + float cycle_nb; + + + //Functions + void getOffset(); + void getValues(float * values); + void AHRS_update(float gx, float gy, float gz, float ax, float ay, float az); + void getQ(float * q); + + public: + GurvIMU(); + void init(); + void getYawPitchRollRad(float * ypr); + void getVerticalAcceleration(float * av); + +}; + +//Fast Inverse Square Root +float invSqrt(float number); + +#endif /* _GURVIMU_H_ */ \ No newline at end of file