Strange behavior with android orientation sensor(android方向传感器的奇怪行为)
问题描述
目前,我正在尝试使用方向传感器值旋转 3D Cube,使用 getRotation() 方法.当 android 设备旋转超过某些范围时,会观察到一些意外行为.例如,如果我让设备站立",滚动"的价值就会变得疯狂.
我也遇到了类似于所谓的云台锁的现象.唯一的区别是我甚至在将传感器值应用于 3D 旋转之前就遇到了这个问题.当我尝试通过仅围绕俯仰"轴旋转设备来更改俯仰"值时,偏航"值也会根据俯仰的旋转而变化.在我看来这完全不合理.
有人可以帮我吗?我被这个问题困了一个月.
这是偏航、俯仰和滚动的常见问题.只要您使用偏航、俯仰和滚动(欧拉角),您就无法摆脱它.这个视频解释了原因.
我在我的运动感应应用程序中使用旋转矩阵而不是欧拉角.关于旋转矩阵的介绍,我推荐:
方向余弦矩阵 IMU:理论
旋转矩阵就像一个魅力.
四元数也很流行,据说是最稳定的.
[此答案复制自此处.]p>
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.
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. For an introduction to rotation matrices I recommend:
Direction Cosine Matrix IMU: Theory
Rotation matrices work like a charm.
Quaternions are also very popular and said to be the most stable.
[This answer was copied from here.]
这篇关于android方向传感器的奇怪行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:android方向传感器的奇怪行为
基础教程推荐
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01