Android:如何处理不正确的baromters? [英] Android: How does one deal with inaccurate baromters?

查看:101
本文介绍了Android:如何处理不正确的baromters?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用Samsung Galaxy S3在一个使用气压计估算用户海拔高度的应用程序上工作.我使用SensorManager.getAltitude(p0,p),并将p0设置为等于最近机场报告的海平面压力.我将p设置为气压计返回的值.

I have been using a Samsung Galaxy S3 to work on an app that uses the barometer estimate the user's altitude. I use SensorManager.getAltitude(p0, p), and set p0 equal to the sea-level pressure reported at the nearest airport. I set p equal to the value returned by the barometer.

不幸的是,返回的高度有系统地比实际高度高出20米左右.我确定气压计返回的压力值太低,因此SensorManager.getAltitude返回的高度更高.为了证明这一点,我什至开车去了机场,从那里我得到了海平面的压力,并将手机放在跑道上,以证明这一点.

Unfortunately, the altitude returned is systematically 20 meters or so higher than what it actually is. I'm certain that the barometer is returning pressure values that are too low, so SensorManager.getAltitude is returning a higher altitude. I've even driven to an airport from which I have gotten the sea-level pressures and laid my phone level with the runway, to prove this point.

在检查气压计的准确性(带有SensorEvent的准确性字段)时,它返回零值,表示传感器不受信任"或需要校准"(

When checking the accuracy of the barometer (with the accuracy field of the SensorEvent), it returns a value of zero, which means "the sensor cannot be trusted" or "calibration is needed" (https://developer.android.com/reference/android/hardware/SensorManager.html#SENSOR_STATUS_UNRELIABLE).

具体来说,我的问题是:

Specifically, my questions are:

  1. 这正常吗?我没有配备气压计的其他设备,因此无法检查.手机如何确定其传感器不可信任"?

  1. Is this normal? I don't have another device with a barometer, so I can't check. How does the phone determine it's sensor "cannot be trusted"?

有什么方法可以校准传感器?理想情况下,我可以检查用户气压计的准确性,然后进行校准(假设我知道气压值相差多少).

Is there any way to calibrate the sensor? Ideally, I could check the accuracy of a user's barometer, and then calibrate it (assuming I knew how much the barometric values were off by).

推荐答案

我用于校准的方法是调整P0以使海拔高度与校准点处的已知海拔高度匹配.我使用各种方法来获取已知的海拔高度,但是最自动的方法是获取gps位置,然后使用一种在线服务来查找海拔高度.

The method I use for calibrating is to adjust P0 to get the altitude to match the known altitude at the calibration point. I use various methods to get the known altitude but the most automatic is to get a gps position and then use one of the online services to look up the altitude.

通过这种方法,我不必担心气压计的绝对精度.如果压力读数始终高出0.5%,那实际上是不相关的.只要在静止时我能获得相对稳定的读数,我就很高兴.我应用了各种过滤功能,尤其是在计算累积的上升和下降数字时,我认为这是我为用户收集的最重要的统计信息.

With this sort of methodology I don't have to worry too much about the barometer absolute accuracy. if the pressure always reads high by 0.5% that is not really relevant. So long as I can get relatively stable readings when stationary I am happy. I apply various bits of filtering especially when calculating cumulative ascent and descent numbers which I believe are the most important stats I gather for my users.

这篇关于Android:如何处理不正确的baromters?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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