log#

DCM.log#

Logarithm of DCM.

The logarithmic map is defined as the inverse of the exponential map [CSL09]. It corresponds to the logarithm given by the Rodrigues rotation formula:

\[\log(\mathbf{R}) = \frac{\theta(\mathbf{R}^T-\mathbf{R})}{2\sin\theta}\]

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

The angle of rotation \(-\pi < \theta < \pi\), satisfies \(1+2\cos\theta = \mathrm{tr}(\mathbf{R})\).

When \(\theta=0\), we have the trivial case \(\mathbf{R}=\mathbf{I}\):

\[\begin{split}\log\Bigg(\begin{bmatrix}1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1\end{bmatrix}\Bigg) = \begin{bmatrix}0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0\end{bmatrix}\end{split}\]
Returns:

log – Logarithm of DCM

Return type:

numpy.ndarray

Examples

>>> R = DCM(rpy=[10.0, -20.0, 30.0] * ahrs.DEG2RAD)
>>> R.view()
DCM([[ 0.92541658, -0.31879578, -0.20487413],
     [ 0.16317591,  0.82317294, -0.54383814],
     [ 0.34202014,  0.46984631,  0.81379768]])
>>> R.log
array([[ 0.        ,  0.26026043,  0.29531805],
       [-0.26026043,  0.        ,  0.5473806 ],
       [-0.29531805, -0.5473806 ,  0.        ]])