Hi, I know this question is definitely solved somewhere many times already, please enlighten me if you know of their existence, thanks.
Quick rundown:
I want to compute from a 3 axis accelerometer the gravity component on each of these 3 axes.
I have used 2 axes free body diagrams to work out the accelerometer's gravity component in the world X-Z, Y-Z and X-Y axes. But the solution seems slightly off, it's acceptable for extreme cases when only 1 accelerometer axis is exposed to gravity, but for a pitch and roll of both 45 degrees, the combined total magnitude is greater than gravity (obtained by Xa^2+Ya^2+Za^2=g^2; Xa, Ya and Za are accelerometer readings in its X, Y and Z axis).
More detail:
The device is a Nexus One, and have a magnetic field sensor for azimuth, pitch and roll in addition to the 3-axis accelerometer.
In the world's axis (with Z in the same direction as gravity, and either X or Y points to the north pole, don't think this matters much?), I assumed my device has a pitch (P) on the Y-Z axis, and a roll (R) on the X-Z axis. With that I used simple trig to get:
Sin(R)=Ax/Gxz
Cos(R)=Az/Gxz
Tan(R)=Ax/Az
There is another set for pitch, P.
Now I defined gravity to have 3 components in the world's axis, a Gxz that is measurable only in the X-Z axis, a Gyz for Y-Z, and a Gxy for X-Y axis.
Gxz^2+Gyz^2+Gxy^2=2*G^2
the 2G is because gravity is effectively included twice in this definition.
Oh and the X-Y axis produce something more exotic... I'll explain if required later.
From these equations I obtained a formula for Az, and removed the tan operations because I don't know how to handle tan90 calculations (it's infinity?).
So my question is, anyone know whether I did this right/wrong or able to point me to the right direction?
Thanks!
Dvd