如何使用陀螺仪和加速度计计算行驶距离?
我想构建一个应用程序,使用陀螺仪+加速度计准确计算 iPhone 行驶的距离(不是长距离)。这里不需要GPS。
我应该如何解决这个问题?
I want to build an app that calculates accurate Distance travelled by iPhone (not long distance) using Gyro+Accelerometer. No need for GPS here.
How should I approach this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我尝试了一下并放弃了(深夜,似乎没有取得任何进展)。这是针对 Unity3d 项目的。
如果有人想从我停下来的地方继续,我很乐意详细说明所有这些东西的作用。
基本上在一些结果被证明是误报之后,我想我应该尝试使用低通滤波器对其进行过滤,然后尝试通过查找趋势来消除反弹,然后 (acc_x[i-1]+acc_x[i] )/2.
看来误报仍然来自倾斜,我试图将其删除。
如果此代码有用或引导您到达某个地方,请告诉我!
I took a crack at this and gave up (late at night, didn't seem to be getting anywhere). This is for a Unity3d project.
If anyone wants to pick up where I left off, I would be happy to elaborate on what all this stuff does.
Basically after some of what turned out to be false positives, I thought I'd try and filter this using a low pass filter, then attempted to remove bounces by finding a trend, then (acc_x[i-1]+acc_x[i])/2.
It looks like the false positive is still coming from the tilt, which I attempted to remove..
If this code is useful or leads you someplace, please let me know!
(acc_x[i-1]+acc_x[i])/2 是一个低通滤波器,它是两个时间测量之间的平均值
也请看这里:http://www.freescale.com/files/sensors/doc/app_note/AN3397.pdf
页码:3
(acc_x[i-1]+acc_x[i])/2 is a low pass filter, it is the mean value between two measures in time
also look at here : http://www.freescale.com/files/sensors/doc/app_note/AN3397.pdf
pag :3
Navisens。
https://navisens.com/#how-work
这里是声明 - Navisens 正在申请专利的技术以独特的方式处理加速度计和陀螺仪数据来定位您的手机。
尝试了演示应用程序,该应用程序主要用于在初始位置和位置确定后无需定位服务或 WiFi 即可绘制移动地图。方向已设定。
iOS SDK - https://github.com/navisens/iOS-SDK
Android SDK - < a href="https://github.com/navisens/Android-SDK" rel="nofollow noreferrer">https://github.com/navisens/Android-SDK
注意:这不是开源
Navisens.
https://navisens.com/#how-work
Here the claim - Navisens patent-pending technology processes accelerometer and gyroscope data in a unique way to locate your phone.
Tried out the demo application, which works mostly in mapping the movements with out Location Services or WiFi once the inital location & direction are set.
iOS SDK - https://github.com/navisens/iOS-SDK
Android SDK - https://github.com/navisens/Android-SDK
Note: This is not open source
这是答案。之前有人问过。
有一个名为 RangeFinder 的应用程序可以做同样的事情(可用在应用商店)。
Here is the answer. Somebody asked before.
There is an app called RangeFinder doing the same thing ( available in App Store ) .
这个问题背后的基本演算在表达式
(以及 y 和 z 位移的类似表达式)和基本几何是毕达哥拉斯定理
因此,一旦您的加速度计信号通过低通滤波器并按采样间隔 dt 及时分箱,您可以找到 x 中的位移(请原谅我的 C...)
,对于 dy 和 dz 也类似。这里
包含从测量开始到结束在时间 0、dt、2*dt、3*dt、... (n-1)*dt 处的 x 加速度值。
要找到总位移,您只需做
陀螺仪,这不是必需的,但如果您测量线性距离,您可以使用陀螺仪读数来控制设备的旋转不要太大。如果旋转太强,请让用户重新进行测量。
Basic calculus behind this problem is in the expression
(and similar expressions for displacements in y and z) and basic geometry is the Pythagorean theorem
So, once you have your accelerometer signals passed through a low-pass filter and binned in time with sampling interval dt, you can find the displacement in x as (pardon my C...)
and similarly for dy and dz. Here
contains x-acceleration values from start to end of measurement at times 0, dt, 2*dt, 3*dt, ... (n-1)*dt.
To find the total displacement, you just do
Gyroscope is not necessary for this, but if you are measuring linear distances, you can use the gyroscope reading to control that rotation of the device was not too large. If rotation was too strong, make the user re-do the measurement.
您可以通过对线性加速度进行两次积分来获得位置,但是误差非常可怕。它在实践中毫无用处。
这是原因的解释(Google 技术讲座) 23:20。我强烈推荐这个视频。
类似问题:
在没有 GPS 的情况下跟踪 iphone 的小动作
手机加速度计用于定位时的真实准确度是多少?
如何计算手机从静止状态到垂直方向的移动量?
iOS:3D 空间中的运动精度
如何使用用于测量 Android 应用程序开发距离的加速计
加速度计移动的距离
更新(2013 年 2 月 24 日):@Simon 是的,如果您了解更多关于运动,例如一个人在行走并且传感器位于他的脚上,那么您可以做更多的事情。这些称为
领域特定假设。
如果假设不成立,它们就会惨遭破坏,而且实施起来可能会相当麻烦。然而,如果它们有效,你就可以做一些有趣的事情。请参阅我的答案中的链接室内定位时的 Android 加速计精度(惯性导航)。
You get position by integrating the linear acceleration twice 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.
Similar questions:
track small movements of iphone with no GPS
What is the real world accuracy of phone accelerometers when used for positioning?
how to calculate phone's movement in the vertical direction from rest?
iOS: Movement Precision in 3D Space
How to use Accelerometer to measure distance for Android Application Development
Distance moved by Accelerometer
Update (24 Feb 2013): @Simon Yes, if you know more about the movement, for example a person walking and the sensor is on his foot, then you can do a lot more. These are called
domain specific assumptions.
They break miserably if the assumptions do not hold and can be quite cumbersome to implement. Nevertheless, if they work, you can do fun things. See the links in my answer Android accelerometer accuracy (Inertial navigation) at indoor positioning.
您应该使用 Core Motion 界面,如简单 iPhone 运动检测中所述。特别是所有旋转都可以非常准确地跟踪。如果你打算做一些与线性运动相关的事情,这是非常困难的事情。查看使用 Core Motion 从加速度计数据中获取位移。
You should use the Core Motion interface like described in Simple iPhone motion detect. Especially all rotations can be tracked very accurately. If you plan to do something related to linear movements this is very hard stuff. Have a look at Getting displacement from accelerometer data with Core Motion.