I am developing an application in android that needs to determine the amount of acceleration in a car when braking. I have found out how to get the pitch and roll angles, but I am at a loss on how to calculate the relative acceleration coordinates using the angles.
For instance, if the device is sitting in a dock on the dash board, it is tilted forward at 15deg and tilted sideways at 5deg. When the person hits the brakes the acceleration due to braking will be distributed between the X, Y and Z axis. How do I use the pitch and roll to determine the acceleration in the Z direction relative to the earth?
I have included a picture for reference: In the picture I am trying to calculate Z(prime) based just off of the Y and Z axis, however in the real world, I will also need to use the X axis and also calculate Y(prime) and X(prime).
Thank you for your help. (and sorry for the bad handwriting)
How you are finding the moving direction ? Just take sqrt(x^2+y^2+z^2) -9.81) its is enough because you all the acceleration on phone is due to car.If possible apply low pass filter to remove changes due to road bumps .