Accelerometer + Gyro - Help?


first sorry for any physics errors, but i nedd help.

Well, im using accelerometer data, but got a problem to "compensate" gravity.

searching in internet i found an equation that get the quaternions and get the gravity for axis. But they quaternions are derived from gyroscope, and the gyroscope has an oscillation in the moment of the movement and after back to "normal state". And this is so bad for me.

The equation:

gx = 2 * (q1*q3 - q0*q2); gy = 2 * (q0*q1 + q2*q3); gz = q0*q0 - q1*q1 - q2*q2 + q3*q3;

And i execute every when the gyroscope has a change.

The result is good when i do a moviment, but when the gyroscope back to the "normal" state the gravity back too.

Sorry for my bad english.

To subtract the acceleration due to gravity you need to know the orientation of the sensor very accurately. This software package will do that, if you have a 9 DOF sensor.

It also includes a function to remove the gravity vector, but the author explains why this usually does not work well: