获取设备的移动方向没有GPS [英] Get Device Moving Direction without GPS

查看:201
本文介绍了获取设备的移动方向没有GPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与传感器我可以当设备被移动到一个方向在绝对坐标检测(例如移动到+ x或-x)。

With Which Sensor I Can Detect when device is moving to a direction In Absolute Coordinate(for example moving to +x or -x).

我需要准确的数据,所以我不能使用 GPS

I need accurate data,so i cannot use GPS.

在完成任务的油漆(计算机)与Android设备的传感器和这部分工作在未知的,我绘制。

the Complete Task is to plot in paint(in computer) with android device sensors and this part of task in unknown for me.

推荐答案

我对你问一个有点困惑。你希望把设备放在口袋里走动,使你到处走的情节?或者你想挥舞设备周围在你的手就像一个3-D的鼠标,绘画?

I'm a little confused about what you're asking. Do you want to put a device in your pocket and walk around, and make a plot of everywhere you walked? Or do you want to wave the device around in your hand like a 3-d mouse, for painting?

对于后者,见上面阿里的建议。如果你想要做的运动跟踪,这里是我可以告诉你:

For the latter, see Ali's suggestion above. If you want to do motion tracking, here is what I can tell you:

您可以轻松地使用加速度计(或重力如果可用),加上磁力结合 SensorManager.getRotationMatrix()来知道哪个方向该设备的面对

You can easily use accelerometer (or gravity if available) plus magnetometer combined with SensorManager.getRotationMatrix() to know which direction the device is facing.

其实,旋转传感器做这一切为您服务。你只需要足够的数学到四元数转换成变换矩阵;这是pretty的方便。

In fact, the ROTATION sensor does all this for you. You just need enough math to convert a quaternion into a transformation matrix; it's pretty easy.

(如果你想实现一个陀螺仪的鼠标,你可以停止阅读这里。)

(If you're trying to implement a gyro mouse, you can stop reading here.)

然后你可以用线性加速度传感器来确定设备移动的方向。这将是一种穷人的惯性导航系统。但是,假定该设备是坐着还是当你启动应用程序,并且它的传感器是真的precise足以做你想要的。

Then you can use the linear acceleration sensor to determine the direction the device is moving. This would be a sort of poor man's inertial navigation system. But that assumes the device is sitting still when you start the app, and that the sensors are really precise enough to do what you want.

加速会给你的设备坐标的载体。乘以载体由从旋转传感器或SensorManager.getRotationMatrix得到了矩阵(),以获得加速度矢量在世界坐标。然后整合该矢量随着时间的推移,以得到一个速度矢量,然后整合的的矢量随时间获得自启动该应用的距离和方向移动。

The acceleration will give you a vector in device coordinates. Multiply that vector by the matrix you got from the ROTATION sensor or SensorManager.getRotationMatrix() to get an acceleration vector in world coordinates. Then integrate that vector over time to get a velocity vector and then integrate that vector over time to get distance and direction moved since you started the app.

错误将迅速积累。该算法可能是好充其量几分钟就开始返回完全是胡说八道了。可以调整应用程序以检测何时所述设备不再移动,并利用这个机会复位的速度矢量为零。

Errors will accumulate rapidly. This algorithm is probably good for a few minutes at best before it starts returning complete nonsense. You could tune the application to detect when the device is no longer moving, and use that opportunity to reset the velocity vector to zero.

坦率地说,这是一个非常非常难解决的问题。有可能是一个博士或至少一对夫妇的试卷给你,如果你解决这个问题。搜索术语室内导航为更多的参考资料。

Frankly, this is a very very hard problem to solve. There's probably a PhD or at least a couple of papers in it for you if you solve it. Search for the term "indoor navigation" for more references.

但是记住,如果没有某种形式的位置服务(网络或GPS),真的没有办法,以确保其方向装置正在移动或者它在哪里。

But bear in mind that without some sort of location service (network or gps), there's really no way to be sure which direction the device is moving or where it is.

我的理解是,所有现有的室内导航算法依赖于得到偶尔的GPS修正,或明知被驾驶的室内空间的布局与使用它的线索,或通过了解附近的WiFi发射器的位置和使用他们的信号强项生成的修复。

My understanding is that all the existing indoor navigation algorithms depend on getting occasional GPS fixes, or by knowing the layout of the indoor space being navigated and using it for clues, or by knowing the locations of nearby WiFi transmitters and using their signal strengths to generate fixes.

说真的,除非你说非常小的距离在这里,GPS是你最好的选择。

Seriously, unless you're talking very small distances here, GPS is your best bet.

这篇关于获取设备的移动方向没有GPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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