to_axisangle#

DCM.to_axisangle() Tuple[ndarray, float]#

Return axis-angle representation of the DCM.

Defining a rotation matrix \(\mathbf{R}\):

\[\begin{split}\mathbf{R} = \begin{bmatrix} r_{11} & r_{12} & r_{13} \\ r_{21} & r_{22} & r_{23} \\ r_{31} & r_{32} & r_{33} \end{bmatrix}\end{split}\]

The axis-angle representation of \(\mathbf{R}\) is obtained with:

\[\theta = \arccos\Big(\frac{\mathrm{tr}(\mathbf{R})-1}{2}\Big)\]

for the rotation angle, and:

\[\begin{split}\mathbf{k} = \frac{1}{2\sin\theta} \begin{bmatrix}r_{32} - r_{23} \\ r_{13} - r_{31} \\ r_{21} - r_{12}\end{bmatrix}\end{split}\]

for the rotation vector.

Note

The axis-angle representation is not unique since a rotation of \(-\theta\) about \(-\mathbf{k}\) is the same as a rotation of \(\theta\) about \(\mathbf{k}\).

Returns:

  • axis (numpy.ndarray) – Axis of rotation.

  • angle (float) – Angle of rotation, in radians.

Examples

>>> R = DCM(rpy=[10.0, -20.0, 30.0])
>>> R.view()
DCM([[ 0.92541658, -0.31879578, -0.20487413],
     [ 0.16317591,  0.82317294, -0.54383814],
     [ 0.34202014,  0.46984631,  0.81379768]])
>>> R.to_axisangle()
(array([ 0.81187135, -0.43801381,  0.38601658]), 0.6742208510527136)