Given a set of Euler Angles, (Pitch, Yaw, Roll) how to find alternate set that describes same 3D orientation?

时光怂恿深爱的人放手 提交于 2019-12-13 06:32:03

问题


I have a nice quaternion to euler equation that is sometimes returning a non-intuitive set of angles.

For example:

  • Pitch: 129
  • Yaw: -85
  • Roll: 126

I would like to programatically find alternate rotations such that Pitch and Roll are between -90 and 90. Yaw can be 0 to 360.

[EDIT] Pitch is constrained to -90 to +90 and Roll is constrained to -180 to +180.


回答1:


Basically, you want to prevent the orientation to go beyond the pole. It is very easy to do that:

First, check if pitch is beyond the pole (i.e. greater than 90° or smaller than -90°). In that case, do the following:

add 180° to yaw
add 180° to roll
set new pitch to 180° - old pitch (or -180° - old pitch in the case of south pole)

This is basically all. You can also adapt the new angles as follows:

while(yaw < 0)
    yaw += 360
while(yaw > 360)
    yaw -= 360
while(roll < -180)
    roll += 360
while(roll > 180)
    roll -= 360


来源:https://stackoverflow.com/questions/37146033/given-a-set-of-euler-angles-pitch-yaw-roll-how-to-find-alternate-set-that-d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!