如何在Android中获取气压高度?(How to get barometric altitude in Android?)

编程入门 行业动态 更新时间:2024-10-26 00:25:21
如何在Android中获取气压高度?(How to get barometric altitude in Android?)

计算气压高度需要哪些数据? 我如何得到它们然后计算高度?

气压与GPS高度相比还有多准确? 我试过GPS,但在网上搜索几个小时后,我无法找到合适的大地水准面图书馆。

请纠正我,如果我有任何概念很长。

What are the data needed for calculating barometric altitude? How do I get them and then calculate the altitude?

Also how accurate is the barometric compared to GPS altitude? I tried GPS but after searching hours in the web I cannot find a suitable Geoid library.

Please correct me if I got any concept long.

最满意答案

您需要使用压力传感器来测量压力,然后使用SensorManager.getAltitude(float,float)调用将测量压力与参考海平面压力一起转换为高度。

棘手的一点是用作参考压力。 这将随着天气而改变,并随着时间的推移而漂移。 通常情况下,您会进行某种校准来设置此值并可能对其进行更新。 这取决于你的用例是什么正确的解决方案。

如果正确校准的基于压力的高度更精确,那么基于GPS的高度尤其是如果你想要感兴趣的是高度差而不是绝对高度。 通过对原始压力传感器值进行一些过滤,您可以轻松检测到将手机保持在您想要使用GPS执行的面部水平或手臂长度以上。

You need to use the pressure sensor to measure the pressure then use the SensorManager.getAltitude(float, float) call to convert the measures pressure along with a reference sea level pressure to get the altitude.

The tricky bit is what to use as the reference pressure. This will change with the weather and will drift over time. Typically you would do some sort of calibration to set this values and possibly update it. It depends on your use case what the right solution is.

If properly calibrated pressure based altitude is considerably more accurate then gps based altitude especially if want you are interested in is altitude differences rather than absolute altitudes. With a bit of filtering on the raw pressure sensor values you can easily detect holding the phone at face level or arms length above your head which you want do with gps.

更多推荐

本文发布于:2023-07-24 01:46:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1240083.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:气压   高度   如何在   altitude   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!