Tutorial Series · Part 19 of 27
Attitude: Euler Angles, Rotation Matrices and Quaternions
Explain attitude representations and why quaternions are useful.
Navigation from First Principles
This article is part of an ordered course. Use the previous and next links to stay in sequence.
Navigation is not only about where something is. It is also about which way it is pointing. Inertial systems need attitude so they can rotate body-frame IMU measurements into a navigation frame. Groves’ navigation references cover coordinate frames, kinematics, attitude and strapdown inertial navigation.12
The problem
Roll, pitch and yaw are easy to understand, but they can become awkward for computation. Rotation matrices are explicit but must stay orthonormal. Quaternions are less intuitive but efficient and avoid the classic Euler-angle gimbal-lock problem.
Euler angles
One common aerospace convention uses roll , pitch and yaw . A rotation matrix can be built from elemental rotations. For example:
The exact order matters. A different order is a different convention.
Rotation matrix
A rotation matrix maps a vector from one frame to another:
It should satisfy:
and:
Quaternion
A quaternion can represent attitude as:
with unit norm:
A gyro-driven quaternion update is:
Interactive demo: attitude representation explorer
The explorer below keeps Euler sliders as the user-facing input, then derives the matrix and quaternion displays from that same orientation.
Attitude Representation Explorer
Drive the pose with Euler angles, then compare the same attitude as a direction cosine matrix and quaternion. Rotation order matters.
What to watch
- The same numeric angles produce different orientations when you change rotation order.
- Near pitch , the warning highlights where Euler-angle intuition becomes fragile.
- The matrix and quaternion remain well-defined even when Euler angles become awkward.
- Labelled axes make the frame convention explicit instead of implicit.
Try this
Set pitch near and then vary roll and yaw. The demo should show how Euler-angle intuition becomes fragile near gimbal lock. Then rotate with quaternions and observe that the underlying orientation remains smooth.
Where this breaks
This post should avoid pretending one convention is universal. Aerospace, robotics, computer graphics and phone APIs may use different axes, handedness and rotation order. The safest habit is to state the convention every time.
Footnotes
-
Paul D. Groves, Principles of GNSS, Inertial, and Multisensor Integrated Navigation Systems, Second Edition, Artech House, 2013. https://uk.artechhouse.com/Principles-of-GNSS-Inertial-and-Multisensor-Integrated-Navigation-Systems-Second-Edition-P1557.aspx - Core textbook reference for navigation systems, GNSS, INS, multisensor integration, coordinate frames, dead reckoning, feature matching and environmental aiding. Accessed 2026-06-11. ↩
-
Paul D. Groves, “Navigation Using Inertial Sensors”, IEEE Aerospace and Electronic Systems Magazine, 2015. https://ieee-aess.org/media/navigation-using-inertial-sensors - Tutorial covering inertial sensor technology, strapdown navigation, alignment, zero updates, motion constraints, pedestrian dead reckoning and fault detection. Accessed 2026-06-11. ↩