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.
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.