Is there an algorithm for converting quaternion rotations to Euler angle rotations?

前端 未结 8 1629
臣服心动
臣服心动 2020-12-12 13:35

Is there an existing algorithm for converting a quaternion representation of a rotation to an Euler angle representation? The rotation order for the Euler representation is

相关标签:
8条回答
  • 2020-12-12 14:23

    I solve it this way:

    step 1: Make sure which convention for Euler rotation you want, say, zyx.

    step 2: Compute the analytical rotation matrix for the rotation. For example, if you want R(zyx),

    **R***zyx* = **R***x*( phi ) * **R***y*( theta ) * **R***z*( psi ), where the elements become

    R11 =  cos(theta)*cos(psi)
    R12 = -cos(theta)*sin(psi)
    R13 =  sin(theta)
    R21 =  sin(psi)*cos(phi) + sin(theta)*cos(psi)*sin(phi)
    R22 =  cos(psi)*cos(phi) - sin(theta)*sin(psi)*sin(phi)
    R23 = -cos(theta)*sin(phi)
    R31 =  sin(psi)*sin(phi) - sin(theta)*cos(psi)*cos(phi)
    R32 =  cos(psi)sin(phi) + sin(theta)*sin(psi)*cos(phi)
    R33 =  cos(theta)*cos(phi) 
    

    step 3: By inspection, you can find the sin or tan for the three angles using the elements above. In this example,

    tan(phi) = -R23/R33
    
    sin(theta) = -R13
    
    tan(psi) = -R12/R11
    

    step 4: Compute the rotation matrix from your quaternion (see wikipedia), for the elements you need to compute the angles as in 3) above.

    Other conventions can be computed using the same procedure.

    0 讨论(0)
  • 2020-12-12 14:26

    Here is a paper I wrote on converting a quaternion to Euler angles.

    Link 1

    I have also put a number of documents at this location discussing various aspects of quaternions, Euler angles and rotation matrices (DCM).

    Link 2

    0 讨论(0)
提交回复
热议问题