I am trying to measure the acceleration and deceleration of a car by using an 3 axis accelerometer which is build in an iPhone 5s. Placing the iPhone flat inside the car with the y axis to the top of the car this works pretty ok. But now I want to be able to place the iPhone basically arbitrary inside the car. (like in the picture below)
(source: everythingicafe.com)
Is there a way to calculate only the horizontal acceleration of the device in such a placement? (I am aware that you won't be able to differ a directional acceleration but that's sufficent for my project. If I am wrong, I would be glad to know if it would work)
To do the calculations the following data is available
- User Acceleration (uX,uY,uZ) - only the acceleration the user imparts to the device
- the total acceleration of the device (tX,tY,tZ) - user acceleration plus gravity
- Gyro Data (gX,gY,gZ) - the device’s rate of rotation around it's axes
- the attitude of the device (quaternion, rotation matrix, (pitch,roll,yaw))
Many thanks in advance!