Axis conventions
To describe the motion of an airplane it is necessary to define a suitable
coordinate system. For most problems dealing with aircraft motion, two
coordinate systems are used. One coordinate system is fixed to the earth and
may be considered for the purpose of aircraft motion analysis to be an inertial
coordinate system. The other coordinate system is fixed to the airplane and is
referred to as a body coordinate system. Figure 1 shows the two right-handed
coordinate systems.
xb
ye
yb
xe
zb
ze
Figure 1 Body fixed frame and earth fixed frame
The orientation of the airplane is often described by three consecutive
rotations, whose order is important. The angular rotations are called the Euler
angles. The orientation of the body frame with respect to the fixed earth frame
can be determined in the following manner. Imagine the airplane to be
positioned so that the body axis system is parallel to the fixed frame and then
apply the following rotations:
1. Rotate the body about its zb axis through the yaw angle
2. Rotate the body about its yb axis through the pitch angle
3. Rotate the body about its xb axis through the roll angle
xb
yb
zb
Figure 2 Body axes coordinate system
Direction cosine matrices
Certain types of vectors, such as directions, velocities, accelerations, and
translations, (movements) can be transformed between rotated reference
frames with a 3X3 matrix. We are interested in the plane frame of reference
and the ground frame of reference. It is possible to rotate vectors by
multiplying them by a matrix of direction cosines:
Qx
Q
Qy = a vector, such as a direction, velocity or acceleration
Qz
QP = a vector Q measured in the frame of reference of the plane
QG = a vector Q measured in the frame of reference of the ground
Eqn. 1
rxx rxy rxz
R
ryx ryy ryz = rotation matrix
rzx rzy rzz
QG = RQP
The relation between the direction cosine matrix and Euler angles is:
R=
coscos sinsincos
cossincossincos+ sinsin
sinsinsin+ coscos cossinsinsincos
cossin
sincos
coscos
Eqn. 2
sin
Equation 1 and equation 2 express how to rotate a vector measured in the
frame of reference of the plane to the frame of reference of the ground.
Equation 1 is expressed in terms of direction cosines. Equation 2 is
expressed in terms of Euler angles.
If we have the full direction cosine matrix, we can convert to Euler angles
from the last row and the first column of the matrix: = arcsin(rzx)
= atan2(rzy,rzz )
Eqn. 3
= atan2(ryx,rxx)
The pitch angle is between -90 degrees and +90 degrees. Note that we
must use atan2 in order to get a four quadrant result. Finally, note that the
atan2 function takes its arguments as (y,x), not (x,y). That often leads to
confusion.
Some people have run into problems in trying to apply equation 3 to
computing Euler angles using the direction cosines that are computed by the
firmware, such as MatrixPilot, that runs on the UAV DevBoard.
The main problem is that the UAV DevBoard does not use the coordinate
system shown in figures 1 and 2. Instead, the UAV DevBoard uses yb where
xb is in Figure 2, and it uses xb where yb is in Figure 2. The reason for that
is historical: the axis labels were placed on the board to align with the axes of
the three axis accelerometer chip. Later, we discovered that was not the
convention, but by then it was too late. The relationship between the direction
cosines used in the UAV DevBoard, and the ones given in Equation 1 and
Equation 2 is:
rmat[0] rmat[1] rmat[2] ryy
R
ryx ryz
=
rmat[3]rmat[4]rmat[5]
rxyrxx
rmat[6] rmat[7] rmat[8]rzy rzx
rxz
rzz
Eqn. 4
So, in terms of the elements of the array rmat[], the Euler angles are given
by: