与Android方向传感器奇怪的行为 [英] Strange behavior with android orientation sensor

查看:207
本文介绍了与Android方向传感器奇怪的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在尝试使用方向传感器的值,使用 getRotation()方式旋转3D魔方。当Android设备被一些界限以上的旋转有些意外行为观察。举例来说,如果我做的装置站起来中,卷的价值只是变得疯狂。

Currently, I'm trying to rotate 3D Cube using orientation sensor values, using getRotation() method. Some unexpected behaviors are observed when the android device is rotated above some bounds. For instance, if I make the device 'stand up', the value of the 'roll' just becomes crazy.

另外我遇到的现象类似于所谓的万向节锁定。唯一不同的是,我甚至在施加的传感器值的3D旋转遇到非常问题。当尝试通过旋转装置仅围绕'音调'轴改变'音高'值时,偏航值也根据音调的旋转而改变。这似乎完全没有道理给我。

Also I'm experiencing the phenomenon similar to so-called gimbal-lock. The only difference is I'm experiencing the very problem even before applying the sensor values to the 3D rotation. When I try to change the 'pitch' value by rotating the device around only 'pitch' axis, the 'yaw' value also changes according to the rotation of the pitch. It seems completely unreasonable to me.

可能有人帮助我吗?我卡在这个问题上一个月。

Could somebody help me?? I'm stuck in this problem for a month.

推荐答案

这是一个常见的​​问题与偏航,俯仰和横滚。你无法摆脱它,只要你使用的是偏航,俯仰和滚转(欧拉角)。 该影片解释了为什么。

This is a common problem with yaw, pitch and roll. You cannot get rid of it as long as you are using yaw, pitch and roll (Euler angles). This video explains why.

我使用旋转矩阵,而不是欧拉角在我的运动传感应用。旋转矩阵:

I use rotation matrices instead of Euler angles in my motion sensing application. Rotation matrices:

HTTP://gentlenav.google$c$c.com/files/ DCMDraft2.pdf

旋转矩阵的工作就像一个魅力。

Rotation matrices work like a charm.

四元也很受欢迎,据说是最稳定的。

Quaternions are also very popular and said to be the most stable.

[这个答案是从<复制的href="http://stackoverflow.com/questions/5010978/reducing-wiimote-pitch-roll-variations/5011314#5011314">here.]

这篇关于与Android方向传感器奇怪的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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