LESSON

Rotation angle sequences in 3D

Transcript

Consider these two coordinate frames, frame A and frame B. They are both right-handed coordinate frames. And the problem we’re trying to solve is how do we describe the rotation of frame B with respect to frame A. Imagine we could pick up frame A and rotate it in space so that its axes were parallel to those of frame B. How do we do that? Well, a very famous Swiss mathematician, Leonhard Euler, came up with what’s called the Rotation Theorem. It states that two three-dimensional coordinate frames are related by a sequence of elementary rotations such as those about the x-axis, the y-axis, the z-axis. We need to apply no more than three of those, but the rotations in this sequence need to be about different axes; that is we’d rotate about x-axis, then the y-axis, then maybe the x-axis again or maybe about the z-axis. So any rotation can be expressed in terms of no more than three rotations as long as those three rotations are consecutively about different axes.

Let’s demonstrate this Rotation Theorem. Here, I have my world reference frame and here I have a coordinate frame that has got an arbitrary orientation in space. And so, the Rotation Theorem says that I should be able to take this coordinate frame and with simply three elementary rotations achieve an orientation like this. So, I’m going to take a copy of that world reference frame. And, first thing I’m going to do is to rotate it a little bit around the x-axis. Then, I’m going to rotate it a little bit around the y-axis, and then I’m going to rotate it a bit around the z-axis. And if I pick this axis up and put it in here, we’ll see that it now has a roughly the same orientation as the blue frame that I started with.

So, let’s write down all the possible sequences of rotation, where we apply this caveat that no two successive rotations are about the same axis. In fact, there are two of them and I’ve written them all down here. These rotations fall into two groups and the group shown here are referred to as Euler angles. And, they are the ones where there are two rotations about the same axis. The first one is rotation about X, then Y, then X again. Well, this one over here is Y, then Z, then Y again. So, in the Euler angle group, a particular axis will appear twice, but not twice consecutively.

This particular group; rotation around Z, then around Y, and then around Z is quite commonly called Euler angles, but in fact there are six Euler angles. So, we need to be very, very careful when we talk about an angle sequence. It’s in fact not good enough just to say Euler angles. We should be very specific and say ZYZ Euler angles. Different engineering communities use different conventions, and the ZYZ convention is pretty common in robotics and in aerospace, but there are other engineering disciplines where they use different conventions. Be very, very careful when you just talk about Euler angles.

Let’s experiment and here we’re talking about ZYZ sequence Euler angles. I’m going to use the Toolbox function eul2r, which takes three angular arguments, the three Euler angles. And, I’m just going to give them simple values: 0.1, 0. 2 and 0.3 radians respectively. And, here is the resulting rotation matrix that corresponds to the three Euler angles.

So you can think of this as two alternative representations for orientation of the coordinate frame. We can represent it as a 3 by 3 orthogonal matrix or we can represent it by three numbers which are the Euler angles. I can perform the inverse operation. I can convert a rotation matrix to Euler angles. To do that, I use the function tr2eul and I pass in the rotation matrix which we’ve just computed. And here we have the Euler angles. So I can convert Euler angles to a rotation matrix, a rotation matrix back to Euler angles.

Let’s have a look at a slightly different case where the middle Euler angle is a negative number and the result is rotation matrix. It’s a different rotation matrix to the one we had before because it’s a different set of Euler angles. Now I’ll convert this rotation matrix back to Euler angles. And we’ll see that the Euler angles that we end up with are not the Euler angles that we started with. So this is another important consideration when we look at representing orientation in terms of these three-angle sequences: that they are not unique, but they are two different sets of Euler angles which result in exactly the same rotation matrix. And just to verify that that is the case, I’m going to convert this different set of Euler angles to a rotation matrix. I’m going to parse that answer in and we can see the resulting rotation matrix. And we can see that it is exactly the same as this one here. So there are two sets of Euler angles which result in exactly the same orientation in space, the same rotation matrix.

The other group of rotation sequences are commonly called Cardan angles. These are named after a very famous, or infamous, Italian character who was a doctor, an astrologer and a gambler and spent some time in jail for heresy. But a very, very inventive person, he invented the combination lock and he invented the universal joint, the thing that transmits torque from an engine in the front of the car to the wheels at the back of the car. He also published widely on probability and was one of the first people to solve cubic and quartic polynomial equations. So a very, very bright person. The Cardan angles involve rotations around different axes. So no letter is repeated in the rotation sequence. The two of them are often referred to as roll, pitch and yaw angles. That’s the sequence XYZ or the sequence ZYX. And which particular one is used as roll, pitch, yaw angles depends a bit on the context of the problem.

Roll, pitch, yaw angles are a really common convention for orientation of bodies in three-dimensional space. We have the x-axis pointing forward and so the roll angle is rotation around the x-axis. So that’s the first rotation that we do. Now we perform a rotation around the y-axis and that’s referred to as pitch. So that’s this sort of motion. And then after that rotation, we do a rotation around the z-axis and we refer to that as yaw motion. So roll, pitch, yaw description of attitude is a rotation around the x-axis, then around the y-axis, and then around the z-axis.

A way to demonstrate this principle of three consecutive rotations is with this mechanism, a thing called a Gimbal mechanism. So, there are two coordinate frames here. We have the world reference coordinate frame here, the big red frame. And, we have a smaller coordinate frame in the middle here. Now, we can make a rotation around the x-axis, which is a motion like this. We can rotate around the y-axis, which is a rotation like this. And, we can rotate around the z-axis. So, I can put this inner coordinate frame at any orientation that I like and the gimbals will find the appropriate angles to allow that to happen. So this demonstrates very clearly shows that any orientation of this inner frame can be achieved by arbitrary choice of three rotation angles around the x, y, and z-axis.

Let’s have a look at some roll, pitch, yaw angles in practice. This is a schematic diagram of NASA’s lunar module from the late ’60s and early ’70s. We can see the coordinate frames indicated on here. We can see that they define roll as rotation around the z-axis which is toward the front of the vehicle and they have defined yaw as being around the x-axis which is the vertical axis for this particular vehicle.

The MATLAB functions for roll, pitch, yaw angles are very similar to those for Euler angles. We used the function rpy2r and we parse in the roll, pitch, yaw angles. I’ve just made up some simple numbers here. The roll angle is 0.1 radians. The pitch angle is 0.2 radians. And the yaw angle is 0.3 radians. And this is the resulting orthogonal rotation matrix. Once again, there is an inverse function. So tr2rpy, and I pass in the rotation matrix and the result are roll, pitch, yaw angles, the same as those that I started with.

The orientation of a body in 3D can be described by three angles, examples of which are Euler angles and roll-pitch-yaw angles.

Professor Peter Corke

Professor of Robotic Vision at QUT and Director of the Australian Centre for Robotic Vision (ACRV). Peter is also a Fellow of the IEEE, a senior Fellow of the Higher Education Academy, and on the editorial board of several robotics research journals.

Skill level

This content assumes high school level mathematics and requires an understanding of undergraduate-level mathematics; for example, linear algebra - matrices, vectors, complex numbers, vector calculus and MATLAB programming.

More information...

Rate this lesson

Average

Check your understanding

Leave a comment