使用加速度计、陀螺仪和指南针计算设备在 3D 世界中的运动 [英] Using accelerometer, gyroscope and compass to calculate device's movement in 3D world

查看:13
本文介绍了使用加速度计、陀螺仪和指南针计算设备在 3D 世界中的运动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 android 应用程序,它可以计算设备在 6 个方向上的移动.我想我可以使用加速作为;

I'm working on an android application which can calculate device's movement in 6 direction. I think I can use acceleration as;

"x=a.t^2" 但 a 不是常数.这就是问题所在.如何计算总运动量?

"x=a.t^2" but a is not a constant. And this is the problem. How can I calculate the total movement??

推荐答案

加速度计为您提供三个方向(x、y、z).它们是加速度测量,很难知道设备的位置.但是,请记住加速度通过积分与位置相关:

The accelerometer gives you three directions (x, y, z). They are acceleration measurements which is harder to know what the position of the device is. But, remember acceleration is related to position through integration:

a(t) = a[x]
v(t) = a[x]t + c
x(t) = a[x]t ^ 2 + ct + d

问题是您无法知道 c 或 d,因为当您取导数时,常数会丢失.因此,在缺少 c 和 d 的情况下,您无法获得正确的数量.您可以尝试通过记住上次使用的值来进行补偿.因此,在抓取 3 个样本后,您可以开始从中计算位置.

Problem is you can't know c or d because as you take the derivative the constants drop out. So there is some amount you can't get right with c and d missing. You can attempt to compensate by remembering the values you used last for those. So after grabbing 3 samples you can start to calculate position from that.

有大量关于如何解释来自传感器的数据的信息.就像找出重力用于定向的位置,然后减去重力以获得线性加速度.

There is a significant amount of information about how to interpret the data from the sensors. Like figuring out where gravity is for orientation, and subtracting out gravity to get linear acceleration.

http://developer.android.com/reference/android/hardware/SensorEvent.html

这是一种使用加速度计以及用于详细查找位置的算法来确定位置的方法:

Here is a way to come up with position using an accelerometer along with an algorithm for finding position in detail:

https://www.nxp.com/docs/en/application-note/AN3397.pdf

这篇关于使用加速度计、陀螺仪和指南针计算设备在 3D 世界中的运动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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