quaternion_to_euler

giant.rotations:

giant.rotations.quaternion_to_euler(quaternion, order='xyz')[source]

This function converts a rotation quaternion to 3 euler angles to be applied to the axes specified in order.

This function works by first converting the quaternion to a rotation matrix using quaternion_to_rotmat() and then using the function rotmat_to_euler() to find the euler angles. See the documentation for those two functions for more information.

This function is vectorized so multiple quaternions can be converted simultaneously by specifying them as columns.

Parameters:
  • quaternion (Sequence | ndarray | Rotation) – The quaternion(s) to be converted to euler angles

  • order (str) – The order of the rotations

Returns:

The euler angles corresponding to the rotation quaternion(s) acording to order

Return type:

Tuple[Sequence | ndarray | Real, Sequence | ndarray | Real, Sequence | ndarray | Real]