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

GurvIMU.h

Committer:
pommzorz
Date:
2013-06-22
Revision:
6:40ac13ef7290

File content as of revision 6:40ac13ef7290:

#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_ */