问题
I am trying to estimate heading from the accelerometer, gyro and magnetometer data. I have implemented A Complementary Filter from here.
What I am trying is that I am holding the phone in my hand and I walked 15 steps in a straight line and I am trying to estimate Euler angles as given in the link above. But when I plot the raw data, I observe that the magnetometer data deviates. Here are the images of raw sensor data.
My question is: how do I estimate Euler angles so that they indicate I am walking in straight line.
回答1:
Were you walking indoors, or somewhere there might be electrical or magnetic fields? Judging by the magnetometer graph, that's what's happening. If so, I'm afraid there's no solution to your problem.
Try running a compass app, or even carrying a toy compass, and then walk the same path. I bet you'll see the compass swing as you walk.
I've been environments where moving a compass three feet down a table can cause it to swing 180 degrees.
As an aside: you almost never want Euler angles. They have degenerate cases. Try to use transformation matrices or quaternions if you can.
来源:https://stackoverflow.com/questions/30529272/android-magnetometer-data-deviates