如何从静止计算手机在垂直方向上的运动? [英] how to calculate phone's movement in the vertical direction from rest?

查看:32
本文介绍了如何从静止计算手机在垂直方向上的运动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 android 操作系统开发一个应用程序,我需要知道如何计算设备在垂直方向上的移动.

I am developing an app using android OS for which I need to know how can I calculate the movement of the device up in the vertical direction.

例如,设备处于静止状态(A 点),用户将其拿在手中(B 点),现在 A 点和 B 点之间存在高度变化,我该如何计算?

For example, the device is at rest (point A), the user picks it up in his hand (point B), now there is a height change between point A and point B, how would i calculate that?

我已经阅读了有关传感器和加速度计的文章,但我真的找不到任何可以帮助我解决的问题.有人有什么想法吗?

I have already gone through the articles about sensors and accelerometers, but I couldn't really find anything to help me with that. Anyone have any ideas?

推荐答案

如果你对加速度进行两次积分,你会得到位置,但错误是可怕的.在实践中是没有用的.这是 23:20 的 解释原因(Google 技术讲座).我强烈推荐这个视频.

If you integrate the acceleration twice you get position but the error is horrible. It is useless in practice. Here is an explanation why (Google Tech Talk) at 23:20. I highly recommend this video.

现在,您不需要任何准确的信息,这是另一回事.线性加速度在传感器融合后可用,如视频中所述.请参阅 SensorEvent 上的 Sensor.TYPE_LINEAR_ACCELERATION.我会首先尝试 高通滤波器 来检测线性的突然增加沿垂直轴的加速度.

Now, you do not need anything accurate and that is a different story. The linear acceleration is available after sensor fusion, as described in the video. See Sensor.TYPE_LINEAR_ACCELERATION at SensorEvent. I would first try a high-pass filter to detect sudden increase in the linear acceleration along the vertical axis.

我不知道它是否适合您的应用程序.

I have no idea whether it is good for your application.

这篇关于如何从静止计算手机在垂直方向上的运动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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