Post · 1 min read· p. 93

DCM.to_axisangle

DCM.to_axisangle() → Tuple[ndarray, float] : Return axis-angle representation of the DCM.

code
Defining a *rotation matrix* R\mathbf{R}:

R=[r11r12r13r21r22r23r31r32r33]\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 R\mathbf{R} is obtained with:
θ=arccos⁡(tr(R)−12)\theta = \arccos\Big(\frac{\mathrm{tr}(\mathbf{R})-1}{2}\Big)
for the **rotation angle**, and:
k=12sin⁡θ[r32−r23r13−r31r21−r12]\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 −k-\mathbf{k} is the same as a rotation of θ\theta about k\mathbf{k}. Returns: : - **axis** (*numpy.ndarray*) – Axis of rotation. - **angle** (*float*) – Angle of rotation, in radians. Examples ```default

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) ```