mathgeometryaccelerometergyroscopempu

Improved calculation of Tilt and Roll angles for an accelerometer and gyroscope


I'm developing a 2axis gyro-stabilized Gibmbal. I use a 10DOF sensor :

MPU6050 (gyro & accelerometer) HMC5983 (magnetometer) MS5611-01BA (altimeter)

I've already calculeted the tilt and roll angles by THIS method

//Roll & Pitch Equations
roll  = (atan2(-fYg, fZg)*180.0)/M_PI;
pitch = (atan2(fXg, sqrt(fYg*fYg + fZg*fZg))*180.0)/M_PI;

These formulas use only the accelerometer's data. The calculations work fine. and servo motors respond very well to calculeted command until the sensor is pushed in any linear direction (by linear, I mean not rotational) in that case we have a temporary wrong results.

Normally, when we got only a linear movement or acceleration without any change in tilt & roll angles the result of calculation should remain unchanged witch is not the case.

I'm wondering if there is any enhanced calculation for tilt & roll angles ? maybe a more complex calculation which uses also the gyroscope's sensor beside accelerometer


Solution

  • I found two nice tutorial about this :

    http://www.starlino.com/imu_guide.html

    http://theboredengineers.com/2012/09/the-quadcopter-get-its-orientation-from-sensors/