Euler and Quaternion Angles: Differences and Why it Matters

Posted by Will Dillingham on Aug 18, 2020 1:20:25 PM

Inertial Labs logo - new2-1

Purpose: To explain the orientation angles used for Inertial Labs devices and how they relate to one another.

Last Updated: August 2019

What's the difference and why does it matter?

Euler angles are generally what most people consider when they picture 3D space. Each value represents the rotation in degrees (it could technically be in any units) around one of the 3 axes in 3D space. Most of the time you will want to create angles using Euler angles because they are conceptually the easier to understand. The flaw is that Euler angles have a problem known as the gimbal lock that prevents certain rotations when two axes align. The solution: quaternions.

How to convert between Quaternion and Euler angles?

Coordinate system definition

Fig. 1.

Define coordinate system 'xoyozo' to be fixed to the carrier object where 'xo' axis is lateral and directed to the right, 'yo’ axis is longitudinal and directed forward, 'zo' axis is normal and directed vertical. At usual installation of the unit on carrier object the units appropriate axes should be parallel to the axes as above Fig. 1. shows. Also, it is possible to install the unit in any known position relative to the object with known alignment angles (see APPENDIX B of the units Interface Control Document (ICD) for details).

The Inertial LabsTM unit calculates orientation of the coordinate system ‘xoyozo’ fixed to the carrier object with respect to Cartesian geographical reference frame ‘xyz’ where axes ‘x' and ‘y’ are in the level and directed to the East and North, and 'z’ axis is directed up. Such reference frame is also known as ENU (East-North-Up) Earth-level frame.

Measured angles are the standard Euler angles of rotation from the Earth-level frame to the object frame: heading K is first, then pitch q, and then roll g -- see Fig. 2.


1. Positive direction of heading is clock-wise. So heading K is shown with minus sign on Fig. 2.

2. In different applications “heading” is also known as “azimuth” or “yaw”; “pitch” is also known as “elevation” or “tilt”; “roll” is also known as “bank”.

Due to the definition of Euler angles there is a mathematical singularity when the object longitudinal y0-axis is pointed up or down (i.e. pitch approaches ±90°). This singularity is not present in the quaternion or directional cosine matrix (rotation matrix) presentation.

Orientation AnglesFig. 2. Transformation of coordinate systems

Directional cosine matrix (DCM) is the rotation matrix C from the object body reference frame ‘xoyozo' to the geographical reference frame 'xyz’. According to Fig. 1, DCM can be represented through Euler angles as:

C-MatrixEquation 1

Or, Euler angles can be calculated from elements cij of directional cosine matrix C:

K EquationEquation 2

Also the Inertial LabsTM unit provides orientation output in quaternion Q form which is a hyper-complex number with four components

Q PointsEquation 3

where q0 is real part, q1, q2, q3 are vector part. In other words, q0 represents the magnitude of the rotation, and the other three components represent the axis about which that rotation takes place.

With only four components, quaternion representation of orientation is computationally efficient. However, manipulation of quaternions is not intuitive, so their use in place of directional cosine matrices may increase the chances of mistakes being made.

Quaternion Q is converted to directional cosine matrix C using the next expressions:

C Matrix EquationsEquation 4

The reverse conversion from directional cosine matrix C to quaternion Q is following:

Q reverse conversionEquation 5

The expressions above in Equation 5 are widely used but they have singularity at q0 = 0. Therefore the Inertial LabsTM unit uses other expressions that have no singularity:

q equationsEquation 6

At necessity to calculate Euler angles from quaternion, calculate elements c12, c22, c31, c32, c33, according to Equation 6, and then use Equation 2:

Euler AnglesEquation 7

where arctan is four-quadrant inverse tangent.


Topics: MRU, AHRS, IMU, INS, AHRS-II, Angles, Quaternion, Euler, Gimbal, Lock

      Knowledge Base Documents