指南针给我的疯狂数据,则需要校准或者是传感器坏了? [英] Compass give me crazy data, is calibration needed or it's the sensor broken?

查看:361
本文介绍了指南针给我的疯狂数据,则需要校准或者是传感器坏了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作与Android传感器数据。我的应用程序中使用

I'm working with android sensor data. My application use

SensorManager.getRotationMatrixFromVector(
            mRotationMatrix , event.values);

和它一直很好,直到今天早上,当旋转矩阵开始了大量的噪声数据发送(n更改为W的第二个)。

and it has been working well until this morning, when the rotation matrix started to send a lot of noise data (Change N to W in a second).

这不是我的code的一个问题,因为上周五是工作,没有变更已完成。我已经使用了市场的罗盘应用程序,指南针是给随机数据。

It's not a problem with my code, because on friday was working and no changes have been done. I have used a compass app from the market, and the compass is giving random data.

我会试探我在另一个平板电脑的应用程序,而且运作良好。

I have tested my app on another tablet, and it is working well.

是否有人知道为什么会出现这种情况?与传感器有问题?是否需要校准?

Does someone know why is this happening? A problem with the sensor? Does it need a calibration?

推荐答案

我对手机这些电子罗盘和工作相当多的很可能是有什么不对您的code或传感器。

I've worked quite a lot with these electronic compasses on mobile phones and its quite possible that there is nothing wrong with your code or sensor.

相反,它很可能是你的环境有问题。有磁场与地球磁场的干扰所有的时间。从电力设备干扰的金属结构拿着一个建筑。在一天结束时指南针只是一个磁铁。如果你站在金属的大块旁边的罗盘将被吸引到它,并指向它,而不是磁北极。

Instead it could very well be a problem with your environment. There are magnetic fields interfering with the earth's magnetic fields all the time. From electrical equipment interference to the metal structure holding up a building. At the end of the day a compass is just a magnet. If you stand beside a large lump of metal the compass will be attracted to it and point to it rather than the magnetic north pole.

试试这个: 安装 GPS状态 然后关闭所有的过滤(设置... GPS和放大器,传感器...传感器滤波...没有过滤)。 执行校准(8个波浪形的东西数字),然后移动电话在你的办公桌......近显示器,电缆等,你会看到它发疯。该信息是完全不可靠的。我发现,在过去的移动电话几英寸到右边彻底改变了它的阅读。同样的情况与真正的指南针。严格来说不存在问题。该器件的指南针与最强的磁场分配本身。即使附近岩石的磁性内容可以用罗盘干扰。

Try this: Install GPS status then turn off all filtering (settings... gps & sensors...sensor filtering... no filtering). Do the calibration (figure of 8 wavy stuff) and then move the phone around your desk.. near monitors, cables, etc. You'll see it go crazy. The information is completely unreliable. I found in the past that moving the phone a few inches to the right completely changed its reading. The same happens with a real compass. Strictly speaking there is no "problem". The device's compass is assigning itself with the strongest magnetic field. Even the magnetic content of nearby rocks can interfere with the compass.

作为进一步的测试,我只是放在一个真实的(定向)罗盘在我的手机,它安装了指南针的应用程序。真正的指南针是指向现在到处都是,但磁北。这两个装置都相互干扰。

As a further test I've just placed a real (orienteering) compass over my phone which has a compass app installed. The real compass is now pointing everywhere but magnetic North. The two devices are interfering with each other.

所以我的建议是...去的地方在公开,像一个公园或野外,远离任何潜在的干扰和电源线,(如果你有一个带一个真正的指南针检查 GPS状态应用程序指向正确的方式),看看你的指南针可以作为你所期望的。

So my advice is.. go somewhere in the open, like a park or field, away from any potential interference and power lines, (if you have one bring a real compass to check that the GPS status app is pointing the right way), and see if your compass works as you'd expect.

额外的:从@resus答案也很重要校准时。旋转手机几次在每个轴。看起来愚蠢,但它确实正确校准。

Extra: The answer from @resus is also important when calibrating. Rotate the phone a few times in each axis. Looks silly but it does calibrate it properly.

特2:有没有可能/实际使用<一个href="http://developer.android.com/reference/android/location/Location.html#getBearing%28%29">compass轴承您的GPS吗?它需要将设备移动(行走速度应罚款),但你就不需要担心任何干扰。它应该给一个准确的读数提供您的GPS信号好。

Extra 2: Would it be possible/practical to use the compass bearing of your GPS? It would require that the device be moving (walking speed should be fine) but you would not need to worry about any interference. It should give an accurate reading provided your GPS signal is good.

额外3:另一种认为刚刚发生,我..你可以尝试使用低通滤波器的传感器。这意味着,在传感器读数的突然变化被过滤掉..看看此回答。如果不做好有很多在网络上算法您选择。

Extra 3: Another thought just occurred to me.. You could try apply a low pass filter to the sensor. This means that the sudden changes in the sensor reading are filtered out .. have a look at this answer. And if that doesn't do a good job there are lots of algorithms on the web for you to choose from.

这篇关于指南针给我的疯狂数据,则需要校准或者是传感器坏了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆