archimedes.spatial.quaternion_to_dcmΒΆ
- archimedes.spatial.quaternion_to_dcm(quat: ndarray) ndarrayΒΆ
Direction cosine matrix from unit quaternion
If the quaternion represents the attitude of a body B relative to a frame A, then this function returns the matrix R_BA that transforms vectors from frame A to frame B. Specifically, for a vector v_A expressed in frame A, the corresponding vector in frame B is given by
v_B = R_BA @ v_A.The inverse transformation can be obtained by transposing this matrix:
R_AB = R_BA.T.Note that this function assumes the scalar-first convention, and assumes the quaternion is normalized.
- Parameters:
quat (array_like, shape (4,)) β Unit quaternion representing rotation from frame A to frame B, in the format [w, x, y, z] where w is the scalar part.
- Returns:
Direction cosine matrix R_BA that transforms vectors from frame A to frame B.
- Return type:
np.ndarray, shape (3, 3)