Quote:
Originally Posted by mikets
The accelerometer doesn't give you "absolute heading", it gives you the G force that was applied to each axis. It's perfect for detecting tilt using the Z-axis because if you are flat on the ground, the Z-axis will read 1 G. But if you are tilted then by applying physics to split the G force vector into a two vectors (one perpendicular to the accelerometer: the Z-axis, another parallel to the surface of the accelerometer), you can see the Z-axis will have a value smaller than 1 G. The more it is tilted, the smaller the Z-axis value). So to determine the tilt angle, you can do an arccosine to the Z value.
|
Precisely. This is what I was suggesting.
Arctangent actually.