Suppose I have a cellphone with accelerometer and magnetometer, and want to determine its absolute (wrt North/East/South/West) 3d position. Imagine the phone is laid vertically, with the screen facing me, the "up" vector pointing to the ceil. Whenever I tilt, the accelerometer allows me to get the "up" vector info change. The problem is that if I tilt the device and put it horizontally (screen now facing ceil, and "up" vector pointing to the opposite of where I am), then the up vector doesn't get updated any more if I rotate the phone horizontally on the table. This is something that clearly is detected by the magnetometer now. So, the question is, when to know where to use acc or mag for each case? Is there a generic way to achieve this?
A:
Investigate what happens when you move the device in the X/Y/Z axises while running a tool on the device that displays readouts from both magnetometer and accelerometer simultaneously. Write down the values on the device's screen as you move it.
Then write your code to take into account your findings.
Without having the actual piece of hardware or mentioning what device it is, there is very little that anyone here can tell you about your specific device, and how the magnetometer/accelerometers work, so you'll have to experiment.
sheepsimulator
2009-07-27 16:25:18