简体   繁体   English

俯仰和偏航相互依赖

[英]Roll Pitch and Yaw interdependence

I am using this library in where I was hoping to find yaw rotation in degrees from the given reference frame . 我在这个库中使用库,希望从给定参考系中找到以度为单位的偏航旋转。

However when starting to test it out I am noticing the yaw changes drastically when slightly moving the device in roll and pitch fashion. 但是,当开始测试时,我注意到以滚动和俯仰方式稍微移动设备时,偏航角发生了巨大变化。 When having the device on a table and rotating in it seem to give the correct values. 将设备放在桌子上并旋转时,似乎可以提供正确的值。

I am also noticing when looking at the roll - which seem to give correct values when rotating it in rolling fashion - that slightly moving it in pitch suddenly drastically changes the value. 我还注意到,在查看滚动时-在滚动滚动时似乎提供了正确的值-稍微倾斜地将其突然倾斜会大大改变该值。

Are the values given not isolated from each other - rotation from the given referenceframe? 给出的值是否不是彼此隔离的-从给定的参考系旋转?


Notice that the library uses quaternion - so there should not be a gimbal lock problem - or does it arise from simply representing the rotation in degrees (with Euler angles)? 请注意,该库使用四元数-因此应该不存在万向节锁定问题-还是由于仅用度数(用欧拉角)表示旋转引起的?

Here is the source code 是源代码


Edit: I modified the react-native-sensors to give me CMDeviceMotions atttitude on iOS (roll, pitch, yaw). 编辑:我修改了react-native-sensors以在iOS上给我CMDeviceMotions姿态(滚动,俯仰,偏航)。 They gave me the rotation independently from each other - which solved the problem. 他们彼此独立地给我轮换-解决了这个问题。

The Gimbal lock is an inherent property of rotation representation using Euler angles (ie, yaw, pitch, roll or any other combination). 云台锁定是使用欧拉角(即偏航,俯仰,横滚或任何其他组合)表示旋转的固有属性。 While you are correct that quaternions don't suffer from this issue, the Euler angles representation you convert them to does. 当您确定四元数不会受到此问题的影响时,将四元数转换为的欧拉角表示就可以了。

A "solution" often used in practice, if you want to keep on using Euler angles to represent your rotations, is to switch from the yaw-pitch-roll (xyz) representation to a different combination that works better in your coordinate system - have a look at the wiki page for combinations you could try. 如果您想继续使用欧拉角来表示旋转,通常在实践中使用的“解决方案”是从偏航-俯仰-横摇(xyz)表示切换为在坐标系中更有效的其他组合-具有在Wiki页面上查看可以尝试的组合。 This essentially just places the gimbal lock to a different combination of angles, but for practical applications with well-defined ranges of values, this is often enough to avoid problems. 这实际上只是将万向架锁置于不同的角度组合上,但是对于具有明确定义的值范围的实际应用而言,这通常足以避免出现问题。

Depending on your use-case, a more "correct" solution could be to switch fully to quaternion representation, which avoids the problem altogether. 根据您的用例,更“正确”的解决方案可能是完全切换为四元数表示,从而完全避免了该问题。

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

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