“重力"和“重力"有什么区别?和“加速"Android中的传感器? [英] What is the difference between "gravity" and "acceleration" sensors in Android?

查看:43
本文介绍了“重力"和“重力"有什么区别?和“加速"Android中的传感器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android 中的重力和加速度传感器有什么区别?在我看来,两种情况下的物理价值是相同的.

What is the difference between gravity and acceleration sensors in Android? From my point of view the physical value is the same in both cases.

哪个测量作用在设备内部单位质量上的力?

Which one measures the force acting on unit mass inside the device?

添加

问题是:这些传感器测量的是什么物理量?根据等效原理,加速度和重力无法区分,测量两者的唯一方法是通常(但是 3d) 弹簧平衡.

The question is: what physical quantity is measured by these sensors? According to equivalence principle the acceleration and gravity are indistinguishable and the only way to measure both is by usual (but 3d) spring balance.

推荐答案

加速度传感器返回施加到设备上的所有力的总和,而重力传感器仅返回重力的影响.如果您想从加速度中排除重力,您可以使用高通滤波器或仅从加速度传感器值中减去重力传感器值——不确定哪种方法能提供更好的精度.

Acceleration sensor gives you back the sum of all forces applied to your device, while Gravity sensor returns only the influence of gravity. If you want to exclude the gravity from acceleration, you may use a high-pass filter or just subtract the gravity sensor values from acceleration sensor values -- not sure which method gives better precision.

另一种方法可能是使用 Sensor.TYPE_LINEAR_ACCELERATION,它提供准确的(加速度 - 重力),但是您应该检查它是否在设备上可用.我发现了一些设备,它们的 ACCELERATION 传感器可以工作,但 GRAVITY 或 LINEAR_ACCELERATION 传感器没有响应.

Another method could be using Sensor.TYPE_LINEAR_ACCELERATION, which gives exactly (acceleration - gravity), however you should check if it's available on the device. I've found a few devices, which have ACCELERATION sensor working, but no response from GRAVITY or LINEAR_ACCELERATION sensors.

这篇关于“重力"和“重力"有什么区别?和“加速"Android中的传感器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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