简体   繁体   English

Android:有什么方法可以准确区分电话运动和旋转吗?

[英]Android: Any way to distinguish precisely between Phone-Movement and -Rotation?

I'm currently working on a VR-Framework. 我目前正在研究VR框架。 My Android Smartphone is used as stereoscopic display and controller. 我的Android智能手机用作立体显示和控制器。 I have headtracking working, but I want a simple positional tracking, too. 我正在使用headtracking,但是我也想要一个简单的位置跟踪。 I know that a precise tracking of the smartphones position is not possible. 我知道无法精确跟踪智能手机的位置。 At least as long as one is limited to the smartphone's sensors. 至少只要限制在智能手机的传感器上即可。 So the idea is to distinguish between a rotation of the smartphone (headtracking) and just any type of general motion. 因此,其想法是区分智能手机的旋转(头部跟踪)和任何类型的常规运动。 Of course with the consequence that I'm just able to move eg forward if motion is detected. 当然,如果检测到运动,我只能向前移动。 As I said, headtracking works fine with the android gyroscope. 就像我说的那样,headtracking在android陀螺仪上工作正常。 But the motion tracking is still not working as I want it to be. 但是运动跟踪仍然无法按我希望的那样工作。

The main problem is that when rotating the phone, this rotation is actually also an acceleration. 主要问题在于,旋转手机时,这种旋转实际上也是加速度。 So just looking at the acceleration's magnitude is not good enough to distinguish between acceleration(motion) and rotation. 因此,仅查看加速度的大小不足以区分加速度(运动)和旋转。 Furthermore, doing something like a threshold for the gyroscope: 此外,对陀螺仪执行阈值操作:

if(gyroscope.magnitude < EPSILON)
    if(accelerometer.magnitude > EPSILON)
        //this may be motion

does not yield the desired differentiation either, because there is always a degree of rotation going on with the phone while walking. 也不会产生所需的差异,因为在走路时手机始终会旋转一定程度。

Long story short: Is there any possible solution for this problem? 长话短说:这个问题有可能解决的办法吗? (Edit) And if yes, how is it done? (编辑)如果是,该怎么做? I want to be able to distinguish if the smartphone was moved or rotated. 我希望能够区分智能手机是移动还是旋转。 Ideally only with the usage of the gyroscope and accelerometer. 理想情况下,仅使用陀螺仪和加速度计。

Best regards and thanks for any feedback! 最好的问候,并感谢您的任何反馈!

I'd suggest to get familiar with the concept of quaternions and how they can be used to represent orientations (This might be a good start: http://run.usc.edu/cs520-s12/quaternions/quaternions-cs520.pdf ) 我建议您熟悉四元数的概念以及如何将它们用于表示方向(这可能是一个不错的开始: http : //run.usc.edu/cs520-s12/quaternions/quaternions-cs520.pdf
Also using heuristics as the "EPSILON" you suggest might not be sufficient since there are maybe some cases in which the heuristic fails but Im sure you know that already. 还建议您将启发式方法用作“ EPSILON”,因为在某些情况下启发式方法可能会失败,但是我确定您已经知道了。
Most of the time you have to care about bias in the raw data therefore you either have to make sure that the phone is at rest for a sufficient amount of time (depends on the number of sample you get in that time period = depends on the sample rate of your sensors) at the beginning of your measurement. 大多数情况下,您必须注意原始数据中的偏差,因此您要么必须确保手机处于静止状态足够长的时间(取决于该时间段内获得的样本数量=取决于测量开始时的传感器采样率)。 In that case you could calculate a mean on the axes and substract it. 在这种情况下,您可以在轴上计算平均值并减去。 This assumes to the bias to be constant over time and does not care fo bias instability (Take a look here: http://sensorwiki.org/doku.php/sensors/gyroscope ). 这假设偏差随时间变化是恒定的,并且不关心偏差的不稳定性(请在此处查看: http : //sensorwiki.org/doku.php/sensors/gyroscope )。 Bias instability doesnt only apply to gyros. 偏差不稳定不仅适用于陀螺仪。
In case you cant guarantee rest at the beginning of the process you also want to read something about Kalman Filters since they provide you with the possibility of estimating the bias. 如果您不能保证在过程开始时就休息,那么您还想阅读一些有关卡尔曼滤波器的信息,因为它们为您提供了估计偏差的可能性。 I've seen implementations of KF using the quaternions and the bias as a state ;) - just for starters. 我已经看到了使用四元数和偏倚作为状态的KF的实现;)-仅适用于初学者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android-设备移动无法正常运行 - Android - Device movement does not work precisely 有什么办法可以在Android手机本身上加载文件吗? - Is there any way to load files on the android phone itself? 有什么办法以编程方式区分最终参数数组和最终参数省略号? - Any way to programatically distinguish between final-param array and final-param ellipsis? 有什么办法可以区分字符串中的字符和数字 - Is there any way to distinguish Characters and digits from string 有什么方法可以在 React 本机 android 中检测最近的电话通话时间 - Is there any way to detect recent phone call duration in React native android LWJGL - 旋转和运动 = 问题 - LWJGL - Rotation and movement = problems 有没有办法区分主线程与它产生的任何线程? - Is there any way to distinguish the main Thread from any Threads that it spawns? 使用旋转的奇怪运动 - Strange Movement Using Rotation 有没有办法区分连接超时和套接字超时? - Is there any way to distinguish a connection timeout from a socket timeout? 有没有办法区分 Gatling 中的 2XX 和 304 响应并在报告中显示? - Is there a way to distinguish between 2XX and 304 responses in Gatling and show it in the report?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM