Angular distance#
- ahrs.utils.metrics.angular_distance(R1: ndarray, R2: ndarray) float#
The angular distance between two rotations \(\mathbf{R}_1\) and \(\mathbf{R}_2\) in SO(3), as defined in [HTDL13]:
\[d(\mathbf{R}_1, \mathbf{R}_2) = \|\log(\mathbf{R}_1\mathbf{R}_2^T)\|\]where \(\|\mathbf{x}\|\) represents the usual euclidean norm of the vector \(\mathbf{x}\).
- Parameters:
R1 (numpy.ndarray) – 3-by-3 rotation matrix.
R2 (numpy.ndarray) – 3-by-3 rotation matrix.
- Returns:
d – Angular distance between rotation matrices
- Return type:
float
Examples
>>> import ahrs >>> R1 = ahrs.DCM(rpy=[0.0, 0.0, 0.0]) >>> R2 = ahrs.DCM(rpy=[90.0, 90.0, 90.0]) >>> ahrs.utils.angular_distance(R1, R2) 1.5707963267948966 >>> R1 = ahrs.DCM(rpy=[10.0, -20.0, 30.0]) >>> R2 = ahrs.DCM(rpy=[-10.0, 20.0, -30.0]) >>> ahrs.utils.angular_distance(R1, R2) 1.282213683073497