1. What Are Euler Angles?
The combination of three consecutive rotations of a rigid body relative to a fixed reference frame, the euler angles also represent the position of a rigid body mounted to a fixed frame , e.g. an IMU (inertial measurement unit). They are known as the three angles roll (ϕ), pitch (θ), and yaw (ψ) and refer to rotations around the body-axes, X, Y and Z respectively. Any 3-D attitude can be modeled by using the rotations in some specific order (the most widespread are the Z-Y-X or yaw-pitch-roll rotations).
2. The Reason to Use Euler Angles in the processing of IMU?
- Intuitive interpretation – roll, pitch and yaw map are directly interpreted to the aircraft/vehicle motion semantics and thus easy to debug and user interfaces.
- Compact representation – Decreased representation by three scalar quantities is required, versus three by three in the rotational matrix of a 3D object (nine elements), or four in a quaternion (four elements).
- Compatibility with legacy algorithms – most of the traditional sensor fusion filters (e.g. complementary filter, Mahony, Madgwick) provide Euler angles to the downstream navigation or control units.
3. Mathematical Formulation
Taking a right-handed coordinate system and the arrangement of yaw, pitch and roll rotation as Z-Y-X (yaw, pitch and roll), the total rotation matrix R is:
\( R = R_z(\psi) R_y(\theta) R_x(\phi) \)
Where
\[ R_x(\phi) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos\phi & -\sin\phi \\ 0 & \sin\phi & \cos\phi \end{bmatrix} \]
\[ R_y(\theta) = \begin{bmatrix} \cos\theta & 0 & \sin\theta \\ 0 & 1 & 0 \\ -\sin\theta & 0 & \cos\theta \end{bmatrix} \]
\[ R_z(\psi) = \begin{bmatrix} \cos\psi & -\sin\psi & 0 \\ \sin\psi & \cos\psi & 0 \\ 0 & 0 & 1 \end{bmatrix} \]
Each of the individual angles can be obtained as a measurement (rotation matrix) denoted
by R:
\[ \phi = \text{atan2}(R_{32}, R_{33}) \], \[ \theta = \text{atan2}(-R_{31}, \sqrt{R_{32}^2 + R_{33}^2}) \], \[ \psi = \text{atan2}(R_{21}, R_{11}) \]
Most IMU-fusion libraries are based on these formulae.
4. Common IMU-Based Flow of Computation
- Raw sensor acquisition – 3-axis accelerator, gyro, (optional) magnetometer.
- Pre-processing – bias removal, low pass filtering.
- Sensor fusion – Sensor fusion – run an AHRS filter (e.g., Madgwick, Mahony) to get a quaternion q.
- Quaternion-to-Euler conversion – use above equations to get roll, pitch, yaw to be used in downstream (navigation, control, UI).
The conversion step can often be captured in firmware libraries (e.g. AHRS guide ).
5. Advantages & Limitations
| Aspect | Advantage | Limitation |
|---|---|---|
| Human readability | Maps directly to flight-control terms (roll, pitch, yaw). | Uncertainty on whether rotation order is recorded or not. |
| Computational cost | Simple trigonometric operations | Prone to gimbal lock about the pitch, i.e., around the angles: ≈ ±90° (ONE DOF lost). |
| Integration with other representations | Quaternions/Rotation matrix conversion is done easily. | Several conventions(intrinsic vs. extrinsic, axis order) may lead to the mismatches . |
6. Practical Tips for IMU designers
- Establish the rotation order at an early stage and maintain it throughout the firmware, documentation as well as host side software.
- Identify and manage the gimbal-lock condition – transition to a quaternion-based control as the pitch nears ±90°.
- Calibrate magnetometer in case yaw is found using magnetic heading; otherwise use the gadgets of gyroscopes and correct the drift.
- Fast Publish Euler angles in degrees when using UI (usually in the automotive/robotics), but store all internal computations in radians in order to avoid a loss in precision.
8. Summary
Euler angles offer an easy human readable method of representing the attitude of an IMU equipped device. Knowing the underlying order of rotation, conversion formulas, and intrinsic weaknesses (particularly gimbal lock), engineers can be able to easily blend the results of Euler angles into the pipeline of navigation, control, and visualization. In cases of high-speed or single-position Euler representation failure e.g. in high-speed scenarios, in high-speed quaternions as a complement.
