In this robotics and aerospace tutorial, we explain the concept of rotation matrices. The rotation matrices are very important in robotics and aerospace engineering. In this tutorial, we derive the expression for the Z-axis rotation matrix.
We noticed that it is a common misconception among students studying robotics and aerospace that rotation matrices are actually rotating vectors. They are not rotating vectors, they are the consequence of two coordinate systems rotated with respect to each other. Usually, the so-called body coordinate system is fixed to the rotating object, and rotation matrices are used to transform the coordinates of a vector from the body frame to some other (usually inertial) frame. There is another mathematical interpretation in which the rotation matrices are rotating vectors in the same coordinate system, however, this interpretation is not used in robotics and aerospace.
Here is the tutorial we made that explains
- What are the rotation matrices.
- How to derive the rotation matrices
- How the rotation matrices are used to transform coordinates from one coordinate system to another.
The YouTube tutorial accompanying this tutorial is given below.
We consider the situation shown in the figure below.
We have two coordinate systems A and B, with the coordinates and . The coordinate systems are also called frames. The coordinate system is rotated with respect to the coordinate system around the axis for the angle . The unit vectors of the coordinate system are and . The unit vectors of the coordinate system are and . While reading this post, the reader should keep in mind that vectors are denoted by using bold letters.
Next, let us consider a vector shown in the figure below.
Problem: Knowing the coordinates of the vector in the coordinate system , and the angle of rotation , find the coordinates of the vector in the coordinate system .
To solve this problem, let us introduce the following notation. The notation
(1)
denotes the vector expressed in the coordinate system . Similarly, the notation
(2)
denotes the vector expressed in the coordinate system .
It should be kept in mind that the vectors and are actually denoting the same vector only expressed in different coordinate systems. The vector expressed in the coordinate system is
(3)
The vector expressed in the coordinate system is
(4)
Here one thing should always be kept in mind. The unit vectors of both coordinate systems and are actually expressed in the same basis. That is, they are expressed by using coordinates of some other coordinate system. That is why we can mathematically write:
(5)
That is, we have
(6)
By substituting (3) and (4) in (6), we have
(7)
By scalarly multiplying the equation (7) with , we obtain
(8)
By scalarly multiplying the equation (7) with , we obtain
(9)
By scalarly multiplying the equation (7) with , we obtain
(10)
Let us write the equations (8), (9), and (10) together
(11)
The last three equations can be written in the matrix form as follows
(12)
The last equation can be written compactly
(13)
where
(14)
The matrix is the rotation matrix. The superscript and subscript notations in mean that the rotation matrix transforms projections of a vector from the coordinate system into the coordinate system . Let us observe the figure shown below. This figure shows the top view of the unit vectors of the coordinate systems and .
Since the vectors and are unit vectors, we have
(15)
By substituting (15) in (14), we have
(16)
The matrix defined in (16) is the rotation matrix defining the rotation of two coordinate systems around the axis.
To summarize, the expression
(17)
implements a mapping. It transforms the projections of the vector expressed in the coordinate system , into the projections of the vector expressed in the coordinate system .
Another important property of the rotation matrices is that they are orthogonal, that is,
(18)
This is important since from (17), we can write
(19)
More about the properties of the rotation matrices can be found here.