archimedes.spatial.euler_to_quaternionΒΆ

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

Convert Euler angles in radians to unit quaternion.

This method uses the same notation and conventions as the SciPy Rotation class. See the SciPy documentation for more details. Some common examples:

  • β€˜xyz’: Extrinsic rotations about x, then y, then z axes (classical roll,

    pitch, yaw sequence)

  • β€˜ZXZ’: Rotation from perifocal (Ξ©, i, Ο‰) frame (right ascension of ascending

    node, inclination, argument of perigee) used by Kepler orbital elements to ECI (Earth-Centered Inertial) frame

Parameters:
  • angles (array_like, shape (N,) or (1, N) or (N, 1)) – Euler angles in radians. The number of angles must match the length of seq.

  • seq (str) – Specifies sequence of axes for rotations. Up to 3 characters belonging to the set {β€˜x’, β€˜y’, β€˜z’} or {β€˜X’, β€˜Y’, β€˜Z’}. Lowercase characters correspond to extrinsic rotations about the fixed axes, while uppercase characters correspond to intrinsic rotations about the rotating axes. Examples include β€˜xyz’, β€˜ZYX’, β€˜xzx’, etc.

Returns:

Unit quaternion [q0, q1, q2, q3] corresponding to the Euler angles, where q0 is the scalar part.

Return type:

np.ndarray, shape (4,)

Raises:

ValueError – If seq is not a valid sequence of axes, or if the shape of angles does not match the length of seq.