This is the second part of the tutorial on Euler angles and rigid kinematics. These tutorials are important for robotics and aerospace engineers. In this tutorial, we provide a clear explanation of Yaw, Pitch, and Roll Euler angles. We focus on the so-called 3-2-1 Yaw, Pitch, and Roll Euler angles. In the first part of this tutorial which can be found here, we focused on the classical Z-Z’-Z” Euler angles. The YouTube tutorial accompanying this post is given below.
Graphical Interpretation and Geometry of Yaw-Pitch-Roll Euler Angles and Rotations
The yaw-pitch-roll Euler angles are animated in the video shown below. Before continuing to read the rest of this tutorial, first, watch the video given below in order to better understand the geometry of yaw-pitch-roll Euler angles.
The yaw-pitch-roll angles and induced rotations are graphically explained in the figure below.
The coordinate system
We have three rotations
- Rotation around the
axis for the angle of . This is the yaw rotation. This rotation defines the coordinate system with the coordinate axes . - Rotation around the
axis for the angle of . This is the pitch rotation. This rotation defines the coordinate system with the coordinate axes . - Rotation around the
axis for the angle of . This is the roll rotation. This rotation defines the coordinate system with the coordinate axes .
In robotics and aerospace engineering, coordinate systems are also called frames. The coordinate system
The angles
Next, let us introduce the following notation. Let
(1)
An equivalent notation is valid for
(2)
The figure below illustrates the vector
This vector has the following projections in the coordinate system
(3)
We consider the following important problem.
We are given the angles of rotation
This problem is graphically illustrated in the figure below. We want to find the projections of the vector
To solve this problem, we need to use rotation matrices that are explained in our previous tutorials, given here, here, and here. Let us now look at the rotation
(4)
where
(5)
Next, by using the same logic, from Fig. 1. above, we obtain
(6)
where
(7)
Finally, by using the same logic, from Fig. 1 above, we have
(8)
where
(9)
By combining the equations (4), (6), and (8) we obtain
(10)
The last expression can be written compactly as follows
(11)
where
(12)
The matrix
(13)
where
The equation (11) solves our problem. The Python code given below is used to compute the direction cosine matrix
from sympy import *
import numpy as np
init_printing()
theta1=symbols('theta1')
theta2=symbols('theta2')
theta3=symbols('theta3')
Rtheta1=Matrix([[cos(theta1) , -sin(theta1) , 0],
[sin(theta1) , cos(theta1), 0],
[0 , 0, 1]
])
Rtheta2=Matrix([ [cos(theta2),0, sin(theta2)],
[0, 1, 0],
[-sin(theta2), 0, cos(theta2)]
])
Rtheta3=Matrix([ [1, 0, 0],
[0 ,cos(theta3),-sin(theta3)],
[0 ,sin(theta3) , cos(theta3) ]
])
# double check that inverses are transposes
simplify(Rtheta1.T*Rtheta1)
simplify(Rtheta2.T*Rtheta2)
simplify(Rtheta3.T*Rtheta3)
# determine the direction cosine matrix
M=Rtheta1*Rtheta2*Rtheta3
# print(M)
# double check the orthogonality
simplify(M.T*M)
simplify(M.T*M -eye(3))
# generate the latex script
print_latex(M)