简体   繁体   English

Android:磁力计数据出现偏差

[英]Android: Magnetometer data deviates

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. 我正在尝试的是握在手中的电话,笔直地走了15步,并且我正在尝试估算上面链接中给出的欧拉角。 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. 我的问题是:如何估算欧拉角,以使它们指示我在直线上行走。

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. 我曾经在这样的环境中,将指南针向桌子下移动三英尺会导致其旋转180度。

As an aside: you almost never want Euler angles. 顺便说一句:您几乎永远不需要欧拉角。 They have degenerate cases. 他们的案件简直是简陋的。 Try to use transformation matrices or quaternions if you can. 如果可以,请尝试使用转换矩阵或四元数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM