archimedes.spatial.dcm_to_quaternion

archimedes.spatial.dcm_to_quaternion(matrix: ndarray) ndarray

Create a Quaternion from a rotation matrix.

If the rotation matrix is R_BA that represents the attitude of a body B relative to a frame A, then the resulting quaternion represents the attitude of the body B relative to frame A.

Note that for the sake of symbolic computation, this method assumes that the input is a valid rotation matrix (orthogonal and determinant +1).

Implementation based on SciPy and reference [1].

Parameters:

matrix (array_like, shape (3, 3)) – Quaternion matrix.

Returns:

Unit quaternion [w, x, y, z] corresponding to the rotation matrix, where w is the scalar part.

Return type:

np.ndarray, shape (4,)

References