# Articles & Tutorials

## Roll-pitch-yaw angles

Updated 4 August 2018

There is a lot of confusion around the terms Euler angles and roll-pitch-yaw angles. This stems from quite different, seemingly authoritative, definitions in textbooks and papers.  There is no clear right and wrong here, authors are using imprecise language and treating conventions in their particular field as rigid definitions.

Let’s go back to the fundamentals. Euler’s rotation theorem (from 1775) states that the orientation of one 3D coordinate frame with respect to another can be described by “successive rotation about three axes such that no two successive rotations are about the same axis”.  However  there are twelve different permutations of rotations about three axes that meet Euler’s criteria: XYX, XYZ, XZX, XZY, YXY, YXZ, YZX, YZY, ZXY, ZXZ, ZYX, ZYZ.

Why 12? For the first rotation I have 3 axes to choose from.  For the second rotation I can choose an axis not equal to the first, so only two choices.  For the third rotation I can  choose an axis not equal to the second, so again only two choices.  The number of choices is therefore 3x2x2 = 12.

We can divide these twelve permutations into two groups of six:

• Eulerian (after Euler) involves repetition, but not successively, of rotations about one particular axis: XYX, XZX, YXY, YZY, ZXZ, or ZYZ.
• Cardanian (after Cardano, also called Tait-Bryan angles) involve rotations about all three axes: XYZ, XZY, YZX, YXZ, ZXY, or ZYX.

In some references all twelve sequences are referred to as Euler angles, but here we will consider just the Eulerian sequences from above as Euler angles.  There are six different sequences to choose from, and the particular angle sequence is a convention within a particular technological field.  In aerospace the convention for Euler angles is ZYZ where the corresponding rotation matrix is

$$R(\phi,\theta,\psi) = R_z(\phi) R_y(\theta) R_z(\psi)$$

I personally don’t have a good physical insight into what these angles mean for the orientation of a body in space.  I can’t be alone because there is an alternative…

The Cardanian angles are also known as roll, pitch and yaw angles.  Confusingly there are two different versions in common use, the sequences XYZ and ZYX.  Text books are not at all consistent on this matter.  If there is any pattern to the inconsistency it is that the mobile robot community (drones, ground vehicles) uses ZYX while the robot manipulator community uses  XYZ.

Why might that be? When describing the attitude of vehicles such as ships, aircraft and cars the convention is that the x-axis points in the forward direction and the z-axis points either up or down. That means the y-axis must point sideways according to the cross-product rule.

Imagine trying to describe the attitude of an aircraft.  Our reference attitude is that the aircraft lies in the horizontal plane with its nose pointing in the direction of the world frame x-axis.  The first thing we will do is to point the nose to the correct compass heading, that’s a rotation within the xy-plane and about the world z-axis.  Next we are going to describe the pitch, the elevation of the front with respect to the horizontal plane, which is a rotation about the new y-axis.  Finally, we describe the roll, the rotation about the forward axis of the vehicle, which is a rotation about the new x-axis. This leads to the ZYX angle sequence where the rotation matrix is given by

$$R(r,p,y) = R_z(y) R_y(p) R_x(r)$$

When describing the attitude of a robot gripper, as shown in Fig. 2.16, the convention is that the z-axis points forward and the x-axis is either up or down. This leads to the XYZ angle sequence

$$R(r,p,y) = R_x(y) R_y(p) R_z(r)$$

More details in Chap 2 of Robotics, Vision & Control.

View all posts