convert linear acceleration into world frames in android

1.4k views Asked by At

I have orientation sensor giving me the orientation angles (or quaternion) in the world's coordinate. Now I get the Linear acceleration from TYPE_LINEAR_ACCELERATION, which gives the acceleration in phone's coordinates. Now the question is how I convert the acceleration from phone's coordinates to world coordinates? thanks

1

There are 1 answers

0
fakturk On BEST ANSWER

First of all you need Rotation matrix not orientation values

If you have orintation angles you can convert them a rotation matrix

Rotation Matrix from Euler Angles

After you get the rotation matrix if you multiply it with the acceleration in the earth coordinate system you will get the acceleration in the phone coordinate system

a_p = acceleration in the phone coordinate system

R = Rotation Matrix

a_e = acceleration in the earth coordinate system

a_p = R * a_e

and inverse of the rotation matrix is equal to its transpose

R^-1 = R^T

a_e = R^T * a_p

it means if you multiply the transpose of rotation matrix with phones reading you will get acceleration in the earth coordinate system