简体   繁体   English

Android的“游戏旋转矢量”传感器是否忽略了绕垂直轴的旋转?

[英]Does Android's “Game Rotation Vector” sensor ignore rotation around vertical axis?

I'm developing an app that uses Android sensors to help vehicles navigate in an indoor location. 我正在开发一款使用Android传感器的应用程序,以帮助车辆在室内导航。 As part of my evaluation process of different sensors, I wanted to try the "rotation vector" sensors. 作为我对不同传感器的评估过程的一部分,我想尝试“旋转矢量”传感器。 For various reasons, magnetic field readings are not very useful for my location, so thus I wanted to try the "Game Rotation Vector" sensor (sensor fusion, available from API level 18 and later). 由于各种原因,磁场读数对我的位置不是很有用,因此我想尝试“游戏旋转矢量”传感器(传感器融合,可从API级别18及更高版本获得)。 The description states that it is identical to the regular Rotation Vector sensor except no magnetic field information is used to correct for gyroscope drift around the vertical axis. 描述表明它与常规旋转矢量传感器相同,除了没有使用磁场信息来校正垂直轴周围的陀螺仪漂移。

When looking for information about the Rotation Vector sensors, I came across an example from Google, where they show the Rotation Vector sensor using a 3d cube. 在寻找有关旋转矢量传感器的信息时,我发现了Google的一个示例 ,他们使用3d立方体显示旋转矢量传感器。 It works pretty well, except for being very sensitive to local magnetic fields (and me being far north, even worse, since the horizontal component is very small here). 它工作得非常好,除了对局部磁场非常敏感(我远北,更糟糕的是,因为这里的水平分量非常小)。

Since long term drift can be compensated by other reference data (map information), I wanted to use the Game Rotation Vector sensor for my app. 由于长期漂移可以通过其他参考数据(地图信息)进行补偿,我想为我的应用程序使用游戏旋转矢量传感器。 However, when changing all references from "TYPE_ROTATION_VECTOR" to "TYPE_GAME_ROTATION_VECTOR" in the example code, the cube no longer reacted to rotations around the vertical axis (eg. me spinning my chair, holding the device in front of me). 但是,在示例代码中将所有引用从“TYPE_ROTATION_VECTOR”更改为“TYPE_GAME_ROTATION_VECTOR”时,立方体不再对围绕垂直轴的旋转做出反应(例如,我旋转我的椅子,将设备放在我面前)。 Tilting the device in the other two directions moved the cube. 在另外两个方向上倾斜设备移动了立方体。 I also noticed the cube was a lot more "laggy" this time around, reacting very slowly to any movement. 我也注意到这次立方体更加“迟钝”,对任何运动反应都非常缓慢。

Is this the way the Game Rotation Vector sensor is supposed to work (eg. ignoring any Z axis rotations)? 这是游戏旋转矢量传感器应该工作的方式(例如,忽略任何Z轴旋转)? It would kind of make sense, since a gamer playing in the back seat shouldn't be affected by the vehicle turning, but at the same time it differs from the description provided by Google (my first link). 这是有道理的,因为在后排座位上玩的游戏玩家不应该受到车辆转弯的影响,但同时它与Google提供的描述(我的第一个链接)不同。 From the description I was under the impression that it would drift slowly, not ignore rotation all together. 根据描述,我的印象是它会慢慢漂移,而不是忽略所有的旋转。

I would be deeply grateful for any input on this issue. 对于这个问题的任何意见,我将深表感谢。

Best Regards, 最好的祝福,

John 约翰

Ok, just in case anyone happens to find this, here are my findings: 好的,万一有人碰巧发现这个,这是我的发现:

The Game Rotation Vector sensor does detect rotation around the vertical axis. 游戏旋转矢量传感器确实检测绕垂直轴的旋转。 It is quite accurate in most situations. 在大多数情况下它非常准确。

However, it has a couple of issues... First, while lying still it has accelerating horizontal drift (even when a gyroscope-based orientation has linear drift). 然而,它有几个问题......首先,在静止时它会加速水平漂移(即使基于陀螺仪的方向具有线性漂移)。 For my device, Game Rotation Vector started out good, but accelerated and finally drifted more than 400 degrees over the course of an hour. 对于我的设备,游戏旋转矢量开始很好,但加速,最后在一个小时内漂移超过400度。

Secondly, and even more disturbing, it does not seem to ignore magnetic fields, contrary to the official description (linked in the question). 其次,更令人不安的是,它似乎没有忽略磁场,这与官方描述(在问题中相关)相反。 I tried driving around the parking lot with my device fixed on the passenger seat, and the Game Rotation Vector fell behind largely (it was more than 180 degrees off after one full rotation over 40 seconds), while integrated gyroscope data was accurate within a few degrees. 我试着在停车场周围驾驶,我的设备固定在乘客座位上,游戏旋转矢量很大程度上落后(在一次完整旋转超过40秒后超过180度),而集成的陀螺仪数据准确无误度。 It also showed changes in rotation when the gyroscope was hovering around zero, suggesting that it was in fact compensating for a change in (what I presume to be) magnetic field. 当陀螺仪在零度左右徘徊时,它也显示出旋转的变化,这表明它实际上补偿了(我认为是)磁场的变化。

I still don't know why it acted wierd in the test app I linked to before, but I have since decided to use a complementary filter to combine accelerometer and gyro data instead. 我仍然不知道为什么它在我之前链接的测试应用程序中表现得很糟糕,但我已经决定使用互补滤波器来组合加速度计和陀螺仪数据。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM