LESSON

Angle-axis representation of rotation in 3D

Transcript

Another way we can think about the relationship between these two frames, frame A and frame B, is that they are related by a single rotation about some arbitrary axis in space. So, the challenge becomes to determine what is this axis of rotation, the vector we going to define is v and what is the amount of rotation around that vector, which we’re going to call Theta. So the problem is to discover what is v, and what is Theta, that allows us to rotate frame A into frame B.

In order to find the axis around which we rotate there is a key observation, and that is that the axis around which we are going to rotate must be unchanged by the rotation. Any point that lies on the rotation axis will be unchanged by rotation. That implies that the rotation axis must be an eigenvector of the matrix R. A rotation matrix has got three eigenvectors. There is one eigenvector which is guaranteed to have elements that are real numbers and it corresponds to the eigenvalue of 1. There are two complex eigenvectors and they correspond to complex eigenvalues which are functions of the rotation angle Theta.

To illustrate this, I am going to create a rotation matrix. It doesn't particularly matter what the value is. I am going to create it using Euler angles. 0.1, 0.2, 0.3. And there it is. And I can see what that orientation looks like by plotting it. There we see rotated coordinate frame corresponding to this rotation matrix.

Now, I am going to look at the eigenvalues of this rotation matrix. We see that there are 3 eigenvalues, we'd expect that since it's a 3x3 matrix and the last eigenvalue is equal to one. I can look at the eigenvectors as well by asking for two output arguments from the eig function. And now we see in the matrix v, each column of matrix v is an eigenvector and we're interested in the third eigenvector because the third eigenvalue was equal to one, and we can say that this third eigenvector is real. The imaginary part of all the elements are equal to zero.

In order to find the amount of rotation as well as the axis of rotation, we would use the Toolbox function tr2angvec and pass in the rotation matrix we're interested in, and it tells it that we need a rotation of 0.44 radians around this particular vector. Now, I can get it to put those into variables by providing two output arguments; tr2angvec, and the outward variable Theta has been set to 0.4466 and the output variable v has being set to the vector around which that rotation would occur.

So the problem comes down to finding the eigenvalues and eigenvectors of the matrix R. The eigenvector corresponding to the eigenvalue of one is a rotation axis V and from the complex eigenvectors, which are a function of Theta, we can determine the rotation angle that we require.

Now, let's consider we want to do the inverse; that we have the rotation angle Theta and we have the vector about which we rotate called v, and we want to find the rotation matrix. And the equation we need is the so-called Rodriguez Equation and it relates R to v and Theta.

The inverse operation is performed by the function angvec2r, converts an angle and vector representation to a rotation matrix. I parse in the rotation amount and I parse in the vector and here is the rotation matrix, and it's exactly the same as the rotation matrix that I started with.

You’ll notice that the matrix in here is a skew symmetric matrix and this is the type of matrix that we've encountered already, and we will encounter a few other times in this course of lectures.

The orientation of a body in 3D can also be described by a single rotation about a particular axis in space.

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.

Average

Discussion

1. Vignesh says:

Professor, can you please explain in the Matlab code of this session.
1. You show the Eigen Vector of Matrix R.
2. You show us and prove that this Eigen vector has 3 Eigen Vectors – 1st, 2nd = complex Eigen vectors. 3rd = Real eigen vector with a constant value of 1 – as said in lecture.
3. [v,e] = what does this show ?? what does the term “v”, “e” corresponds to ?. Can you please explain what are they. how did they become a Matrix ? why is the Matrix “e” have only Real values in the last row.

Request your support in helping this doubt.

1. Peter Corke says:

If you are ever in doubt about the meaning of a MATLAB function you can check the documentation. From inside MATLAB simply
>> help eig

and if you don’t have MATLAB just google “matlab eig”

2. SirClems says:

I don’t understand the matlab code you wrote after the question have been answered.

please explain. I only got answer to the question using common sense and knowledge of what I have learnt so far.

1. Peter Corke says:

Sorry for the delay, I’ve been on holiday… Which question: 1, 2 or 3?

3. SUN says:

Professor, I’ m confused about the Rodriguez formula, the formula showing at 3:30 is different with what I saw other form for there not contains a I3x3, just like this I + sinθ v + (1-cosθ)v^2.

1. SUN says:

1. Peter Corke says:

There are a few different ways to express this, yours is valid if v is a skew-symmetric matrix.

4. Winston says:

Hi Prof.! The last slide in this video (4:09) has an error. The signs of v_x and v_y in the last row should be swapped.

1. Peter Corke says:

Hi Winston, thanks for all the feedback. This is an error, thanks for picking that up.

5. Spandana says:

Dear Prof, thank you for the informative videos.I had a small query.I am using Matlab 2020 version and latest toolboxes (rtb 10.4 and mvtb 4.3) .Previously I got some errors using rotx and others.So I saw the comments and accordingly moved the RTB and MVTB files to top using set path.But while I run the eul2r for same values given in video I am getting different values in MATLAB.I am not sure why.Can you please help me figure it out?

1. Peter Corke says:

Could you post this question to tiny.cc/rvcforum, it seems more of a toolbox/install issue than a learning issue.

6. Sachin Nath says:

When I use eul2r in MATLAB it is not considering the values as radians but as angles, so each time I use that function I am multiplying the values wih 180/pi do I have an easier solution to that.
>> r = eul2r(0.1, 0.2, 0.3)

r =

1.0000 -0.0070 0.0035
0.0070 1.0000 0.0000
-0.0035 0.0000 1.0000

>> r = eul2r(0.1*180/pi, 0.2*180/pi, 0.3*180/pi)

r =

0.9021 -0.3836 0.1977
0.3875 0.9216 0.0198
-0.1898 0.0587 0.9801

1. Peter Corke says:

Most likely an installation problem and clash with another toolbox. See the FAQ page

7. Abhyuday says:

Professor,

what is the difference between eul2r() and rpy2r() functions?
according to euler’s rotation theorem both should give same rotation matrix when given same sequence of angles but they are giving different rotation matrices.

1. Daniel Onofre says:

they cannot give the same rotation matrix for the same angle sequences because each corresponds to a different sequence of rotations. Euler repeats the rotation about one axis, but rpy does not repeat it.

1. Daniel Onofre says:

>> eul2r(0.1,0.2,0.3)

ans =

0.9021 -0.3836 0.1977
0.3875 0.9216 0.0198
-0.1898 0.0587 0.9801

>> rpy2r(0.1,0.2,0.3)

ans =

0.9363 -0.2751 0.2184
0.2896 0.9564 -0.0370
-0.1987 0.0978 0.9752

2. Peter Corke says:

Because they involve rotations around different axes. Euler’s theorem says any rotation can be achieved by sequential rotation about 3 axes, but each axis must be different to the one before. eul2r() rotates about Y, then Z, then Y. rpy2r() rotates about X, then Y, then Z (if using the default setting for RTB9).

8. Amer says:

I thank Professor Peter.
This topic was hard to imagine for me when I studied it from the book, but after watching this video I understood it excellently.