archimedes.spatial.euler_to_dcmΒΆ

archimedes.spatial.euler_to_dcm(angles: ndarray, seq: str = 'xyz') ndarrayΒΆ

Direction cosine matrix from Euler angles

If the Euler angles represent 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.

By default, the Euler angle sequence is assumed to follow the standard aerospace convention of an extrinsic roll-pitch-yaw sequence (β€œxyz”). However, it supports arbitrary sequences of non-repeating axes up to length 3. Both intrinsic (uppercase letters) and extrinsic (lowercase letters) sequences are supported.

In general, the Quaternion class should be preferred over Euler representations, although Euler angles are used in some special cases (e.g. stability analysis). In these cases, this function gives a more direct calculation of the transformation matrix without converting to the intermediate quaternion.

Parameters:
  • angles (array_like) – Euler angles in radians representing the orientation of frame B with respect to frame A. Shape must match the length of seq.

  • seq (str, optional) – Sequence of axes for Euler angles (up to length 3). Each character must be one of β€˜x’, β€˜y’, β€˜z’ (extrinsic) or β€˜X’, β€˜Y’, β€˜Z’ (intrinsic). Default is β€˜xyz’.

Returns:

Direction cosine matrix R_BA that transforms vectors from frame A to frame B.

Return type:

np.ndarray, shape (3, 3)