c4dynamics.rotmat.rotmat.dcm321euler

Contents

c4dynamics.rotmat.rotmat.dcm321euler#

c4dynamics.rotmat.rotmat.dcm321euler(dcm)[source]#

Extract Euler angles (roll, pitch, yaw) from a Direction Cosine Matrix (DCM) of 3-2-1 order.

The form of a 3-2-1 rotation matrix:

\[\begin{split}R = \begin{bmatrix} c\theta \cdot c\psi & c\theta \cdot s\psi & -s\theta \\ s\varphi \cdot s\theta \cdot c\psi - c\varphi \cdot s\psi & s\varphi \cdot s\theta \cdot s\psi - c\varphi \cdot c\psi & s\varphi \cdot c\theta \\ s\varphi \cdot s\theta \cdot s\psi + s\varphi \cdot s\psi & s\varphi \cdot s\theta \cdot s\psi - s\varphi \cdot c\psi & c\varphi \cdot c\theta \end{bmatrix}\end{split}\]

where

  • \(c\varphi \equiv cos(\varphi)\)

  • \(s\varphi \equiv sin(\varphi)\)

  • \(c\theta \equiv cos(\theta)\)

  • \(s\theta \equiv sin(\theta)\)

  • \(c\psi \equiv cos(\psi)\)

  • \(s\psi \equiv sin(\psi)\)

Parameters:

dcm (numpy.array) – 3x3 Direction Cosine Matrix representing a rotation.

Returns:

out (tuple) – A tuple containing Euler angles (yaw, pitch, roll) in degrees.

Notes

Each set of Euler angles has a geometric singularity where two angles are not uniquely defined. It is always the second angle which defines this singular orientation:

  • Symmetric Set: 2nd angle is 0 or 180 degrees. For example the 3-1-3 orbit angles with zero inclination.

  • Asymmetric Set: 2nd angle is ±90 degrees. For example, the 3-2-1 angle of an aircraft with 90 degrees pitch.

Examples

>>> dcm321euler(np.eye(3)) 
(0, 0, 0)

A rotation matrix that represents the attitude of an aircraft with respect to an inertial earth frame is given by:

>>> BI = np.array([[ 0.866,     0, -0.5      ]
...                 , [ 0,      1,  0        ]
...                 , [ 0.5,    0,  0.866    ]])
>>> dcm321euler(BI) 
(0, 30, 0)