You are on page 1of 8

Chapter 2 – Spatial Descriptions & Transformations

Spatial Descriptions
Description of Position

z
p

Figure 1: Position Vector of a Point

The position of a point p, with respect to a reference frame A (coordinate system A), can be
described by a 3 x 1 position vector:
𝑝𝑝𝑥𝑥
𝐴𝐴 𝑝𝑝
𝒑𝒑 = � 𝑦𝑦 � (2.1)
𝑝𝑝𝑧𝑧

Reference frame A has three mutually orthogonal axes x, y and z.

Description of Orientation

v z
u

x
w

Figure 2: Rotation of Reference Frame B

To describe the orientation of a robotic manipulator with respect to the initial reference frame A, a
new reference frame B is attached to the manipulator. Reference frame B has three mutually
orthogonal axes u, v and w.

As the manipulator moves in 3D space, the orientation of frame B will change with respect to frame
A. The orientation of frame B with respect to frame A is described by a rotation matrix:
𝑢𝑢𝑥𝑥 𝑣𝑣𝑥𝑥 𝑤𝑤𝑥𝑥 𝑎𝑎11 𝑎𝑎12 𝑎𝑎13
𝐴𝐴 𝑢𝑢 𝑣𝑣𝑦𝑦 𝑤𝑤𝑦𝑦 � = �𝑎𝑎21 𝑎𝑎22 𝑎𝑎23 �
𝑅𝑅𝐵𝐵 = � 𝑦𝑦 (2.2)
𝑢𝑢𝑧𝑧 𝑣𝑣𝑧𝑧 𝑤𝑤𝑧𝑧 𝑎𝑎31 𝑎𝑎32 𝑎𝑎33
The position of a point p described with respect to frame B (Bp), can be described in terms of frame
A after a rotation, by multiplying the point vector by the rotation matrix:
𝐴𝐴
𝒑𝒑 = 𝐴𝐴𝑅𝑅𝐵𝐵 𝐵𝐵𝒑𝒑 (2.3)

A rotation matrix contains nine parameters: a11…a33. Since rotation is a motion with three degrees of
freedom, only three independent parameters are necessary to describe the orientation of a rigid body
in space. In order to achieve a more compact representation of a rotation, we introduce the Euler
angle representations.

When a rigid body performs a rotation of 𝜓𝜓 about the x-axis, the rotation matrix reduces to:
1 0 0
𝑅𝑅(𝑥𝑥, 𝜓𝜓) = �0 𝑐𝑐𝑐𝑐 −𝑠𝑠𝑠𝑠�
(2.4)
0 𝑠𝑠𝑠𝑠 𝑐𝑐𝑐𝑐

When a rigid body performs a rotation of 𝜃𝜃 about the y-axis, the rotation matrix reduces to:
𝑐𝑐𝑐𝑐 0 𝑠𝑠𝑠𝑠
𝑅𝑅(𝑦𝑦, 𝜃𝜃) = � 0 1 0� (2.5)
−𝑠𝑠𝑠𝑠 0 𝑐𝑐𝑐𝑐

When a rigid body performs a rotation 𝜙𝜙 about the z-axis, the rotation matrix reduces to:
𝑐𝑐𝑐𝑐 −𝑠𝑠𝑠𝑠 0
𝑅𝑅(𝑧𝑧, 𝜙𝜙) = �𝑠𝑠𝑠𝑠 𝑐𝑐𝑐𝑐 0�
(2.6)
0 0 1

Note that the direction of rotation about each axis is defined by the right-hand rule.

We also note that due to the orthogonality condition, rotation matrices have the following property:
𝐵𝐵
𝑅𝑅𝐴𝐴 = 𝐴𝐴𝑅𝑅𝐵𝐵−1 = 𝐴𝐴𝑅𝑅𝐵𝐵𝑇𝑇 (2.7)

Example

v
y
B
p u

Figure 3: Example Rotation

Frame B is rotated relative to frame A about the z-axis by 30 degrees. The image shows the frames
such that the z-axis and w-axis of each frame points out of the page. Given a point 𝐵𝐵𝒑𝒑 =
[0 2 0]𝑇𝑇 , determine its position in terms of frame A.

Solution:

For a 30-degree rotation about the z-axis:


𝑐𝑐𝑐𝑐𝑐𝑐(30) −sin(30) 0
𝐴𝐴
𝑅𝑅𝐵𝐵 = �𝑠𝑠𝑠𝑠𝑠𝑠 (30) cos(30) 0�
0 0 1
Given:
0
𝐵𝐵
𝒑𝒑 = �2�
0
We calculate 𝐴𝐴𝒑𝒑:
0.866 −0,5 0 0 −1
𝐴𝐴
𝒑𝒑 = 𝐴𝐴𝑅𝑅𝐵𝐵 𝐵𝐵𝑝𝑝 = � 0.5 0.866 0� �2� = �1.732�
0 0 1 0 0

Example

Vector 𝐵𝐵𝒑𝒑 = [0 1 0]𝑇𝑇 . Determine it’s location in terms of frame A (fixed frame). Assume that
frame A and B were initially coincident and frame B was first rotated 90o about the z-axis of the fixed
frame and then 90o about the y-axis of the fixed frame.

Solution:
𝐴𝐴
𝑝𝑝 = 𝑅𝑅(𝑦𝑦, 𝜃𝜃)𝑅𝑅(𝑧𝑧, 𝜙𝜙) 𝐵𝐵𝑝𝑝
𝑐𝑐𝑐𝑐 0 𝑠𝑠𝑠𝑠 𝑐𝑐𝑐𝑐 −𝑠𝑠𝑠𝑠 0
𝐴𝐴
𝒑𝒑 = � 0 1 0 � �𝑠𝑠𝑠𝑠 𝑐𝑐𝑐𝑐 0� 𝐵𝐵𝒑𝒑
−𝑠𝑠𝑠𝑠 0 𝑐𝑐𝑐𝑐 0 0 1
0 0 1 0 −1 0 0 0 0 1 0 0
𝐴𝐴
𝒑𝒑 = � 0 1 0� �1 0 0� �1� = �1 0 0� �1� = �0�
−1 0 0 0 0 1 0 0 1 0 0 1
Note that rotations are not commutative (i.e. the order of rotation matters). When you pre-multiply
a matrix by another matrix, the multiplier is on the left. In this instance, we have pre-multiplied the
first rotation matrix 𝑅𝑅(𝑧𝑧, 𝜙𝜙) by the second rotation matrix 𝑅𝑅(𝑦𝑦, 𝜃𝜃). When pre-multiplying rotation
matrices, the order of rotations proceeds from right to left. This is intuitive because matrix
multiplication takes place from right to left.

What would happen if we post-multiplied the first rotation matrix 𝑅𝑅(𝑧𝑧, 𝜙𝜙) by the second rotation
matrix 𝑅𝑅(𝑦𝑦, 𝜃𝜃)?

Answer: The second rotation would take place about the y-axis of the moving frame B instead of the
fixed frame A. Draw sketches to compare and contrast the results of pre- and post-multiplication.
Roll-Pitch-Yaw Angles (x-y-z fixed angles)
z w'' z z
w' v'' w''' 𝜙𝜙
v' v'''
𝜃𝜃
y y
u' 𝜓𝜓 y x x u'''
x u''

Figure 4: Roll-Pitch-Yaw Angles

Consider three successive rotations of frame B about a fixed frame A, where frame A and B initially
coincide with each other. We start with a rotation 𝜓𝜓 about the x-axis, then a rotation 𝜙𝜙 about the y-
axis and end the sequence with a rotation 𝜃𝜃 about the z-axis.

The resulting rotation matrix is obtained by my pre-multiplying the basic rotation matrices in the
order of rotation:

𝑅𝑅(𝜓𝜓, 𝜃𝜃, 𝜙𝜙) = 𝑅𝑅(𝑧𝑧, 𝜙𝜙)𝑅𝑅(𝑦𝑦, 𝜃𝜃)𝑅𝑅(𝑥𝑥, 𝜓𝜓) (2.8)

𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 − 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 + 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠


𝑅𝑅(𝜓𝜓, 𝜃𝜃, 𝜙𝜙) = �𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 − 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 − 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐�
(2.9)
−𝑠𝑠𝑠𝑠 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐

Given the roll, pitch and yaw angles(𝜓𝜓, 𝜃𝜃, 𝜙𝜙) , we can compute a complete rotation matrix as shown
in eq. 28. Note that the order of rotation cannot be changed arbitrarily. A different order would
provide a different matrix to that shown in eq. 2.8.

If the rotation matrix is provided and the roll, pitch and yaw angles are unknown, they can be
calculated from the elements of the matrix as follows:

𝜃𝜃 = sin−1 (−𝑎𝑎31 )
𝑎𝑎 𝑎𝑎
𝜓𝜓 = 𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴2� 32�𝑐𝑐𝑐𝑐 , 33�𝑐𝑐𝑐𝑐 �
𝑎𝑎 𝑎𝑎 (2.10)
𝜙𝜙 = 𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴2� 21�𝑐𝑐𝑐𝑐 , 11�𝑐𝑐𝑐𝑐 �

If 𝜃𝜃 = ±90 the solution degenerates since cos ±90 = 0. If cos 𝜃𝜃 ≠ 0, then there are two solutions to
the problem of calculating the angles. Two solutions exist because the arcsine function has two roots.

w-u-w Euler Angles


Consider three successive rotations of a rigid body about a moving frame B. Initially, the location of
the moving frame B coincides with a fixed frame A. Each successive rotation takes place about an axis
of the moving frame, where the new location of the frame depends on the previous rotations.
z z z
w'' v''
𝜙𝜙 w' w'''
v' 𝜓𝜓 v'''

y y y
x x x u'''
u' u'' 𝜃𝜃

Figure 5: w-u-w Euler Angles

1st Rotation: rotate frame B about the w-axis by angle 𝜙𝜙, from the (u, v, w) location to the (u’, v’, w’)
location.

2nd Rotation: rotate frame B about the u’-axis by angle 𝜃𝜃, from the (u’, v’, w’) location to the (u’’, v’’,
w’’) location.

3rd Rotation: rotate frame B about the w’’-axis by angle 𝜓𝜓, from the (u’’, v’’, w’’) location to the (u’’’,
v’’’, w’’’) location. For simplicity we drop the prime notation and refer to the final location as (u, v,
w).

In this case, each rotation is performed about the axes of the moving frame B, rather than the fixed
frame A. Sets of rotations about the axes of a moving frame are called Euler angles. We now
endeavour to identify a rotation matrix that describes the orientation of frame B with respect to frame
A. In other words, how do we determine 𝐴𝐴𝑅𝑅𝐵𝐵 ?

To identify the rotation matrix 𝐴𝐴𝑅𝑅𝐵𝐵 we imagine that frame B is fixed and frame A moves relative to
frame B. This would allow is to identify 𝐵𝐵𝑅𝑅𝐴𝐴 , which is to solve the inverse kinematics problem. We
solve the inverse kinematics problem by assuming that frame A first moves – 𝜙𝜙 about the w-axis,
followed by frame A moving −𝜃𝜃 about the u-axis, and finally frame A moves −𝜓𝜓 about the w-axis.
𝐵𝐵
𝑅𝑅𝐴𝐴 (−𝜙𝜙, −𝜃𝜃, −𝜓𝜓) = 𝐵𝐵𝑅𝑅𝐴𝐴 (𝑤𝑤, −𝜓𝜓) 𝐵𝐵𝑅𝑅𝐴𝐴 (𝑢𝑢, −𝜃𝜃) 𝐵𝐵𝑅𝑅𝐴𝐴 (𝑤𝑤, −𝜙𝜙) (2.11)

We note that 𝐴𝐴𝑅𝑅𝐵𝐵 = 𝐵𝐵𝑅𝑅𝐴𝐴−1 , and 𝐵𝐵𝑅𝑅𝐴𝐴−1 (𝑤𝑤, −𝜙𝜙) = 𝐵𝐵𝑅𝑅𝐴𝐴 (𝑤𝑤, 𝜙𝜙) (and so forth), therefore:
𝐴𝐴
𝑅𝑅𝐵𝐵 (𝜙𝜙, 𝜃𝜃, 𝜓𝜓) = � 𝐵𝐵𝑅𝑅𝐴𝐴 (−𝜙𝜙, −𝜃𝜃, −𝜓𝜓)�
−1 (2.12)

= 𝑅𝑅(𝑤𝑤, 𝜙𝜙)𝑅𝑅(𝑢𝑢, 𝜃𝜃)𝑅𝑅(𝑤𝑤, 𝜓𝜓)

𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 − 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 −𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 − 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠


= �𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 + 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 −𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 + 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 −𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 �
𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 𝑐𝑐𝑐𝑐

Take note of the order of multiplication of the rotation matrices for successive rotations about a
moving frame. We observe that the matrices are post-multiplied in order of rotation.

If the rotation matrix is provided the w-u-w Euler angles can be calculated from the elements of the
matrix as follows:

𝜃𝜃 = 𝑐𝑐𝑐𝑐𝑐𝑐 −1(𝑎𝑎33 ) (2.13)


𝑎𝑎 −𝑎𝑎
𝜙𝜙 = 𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴2� 13�𝑠𝑠𝑠𝑠 , 23�𝑠𝑠𝑠𝑠 �
𝑎𝑎 𝑎𝑎
𝜓𝜓 = 𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴2� 31�𝑠𝑠𝑠𝑠 , 32�𝑠𝑠𝑠𝑠�

If 𝜃𝜃 = 0 or 180o the solution degenerates and only the sum or difference of 𝜙𝜙 and 𝜓𝜓 can be calculated.

Location of a Rigid Body

w P v
z

O y
u
x
Figure 6: General Spatial Displacement

Consider Figure 6, where frame A has axes x, y, z and origin noted as point O. Frame B has axes u, v,
w and the origin is noted as point Q. The location of point P with respect to moving frame B is
���� = 𝐵𝐵𝑝𝑝. Point P can also be described with respect to the fixed frame A by
described by the vector 𝑄𝑄𝑄𝑄
���� = 𝐴𝐴𝑝𝑝 . The relationship between 𝐴𝐴𝑝𝑝 and 𝐵𝐵𝑝𝑝 is described by the following vector sum:
vector 𝑂𝑂𝑂𝑂
����
𝑂𝑂𝑂𝑂 = ����
𝑂𝑂𝑂𝑂 + ����
𝑄𝑄𝑄𝑄 (2.14)

Assuming that the orientation of frame B with respect to frame A is described by the rotation matrix
𝐴𝐴
𝑅𝑅𝐵𝐵 , we can rewrite equation 2.13 as:
𝐴𝐴
𝑝𝑝 = 𝐴𝐴𝑅𝑅𝐵𝐵 𝐵𝐵𝑝𝑝 + 𝐴𝐴𝑞𝑞 (2.15)

Equation 2.14 describes the location of point P with respect to fixed frame A as the combination of a
translation 𝐴𝐴𝑞𝑞 and a rotation 𝐴𝐴𝑅𝑅𝐵𝐵 . The general displacement of any rigid body can be described in
terms of the sum of a rotation and a translation.

Homogeneous Transformation Matrix


The Homogeneous Transformation matrix is a 4x4 matrix that is used for mapping a position vector
in one coordinator system to another. It is defined as follows:
𝑢𝑢𝑥𝑥 𝑣𝑣𝑥𝑥 𝑤𝑤𝑥𝑥 𝑝𝑝𝑥𝑥
𝐴𝐴
𝑅𝑅𝐵𝐵 (3 × 3) 𝐴𝐴
(3
𝑞𝑞 × 1) 𝑢𝑢 𝑣𝑣𝑦𝑦 𝑤𝑤𝑦𝑦 𝑝𝑝𝑦𝑦
𝐴𝐴
𝑇𝑇𝐵𝐵 = � � = � 𝑦𝑦 𝑤𝑤𝑧𝑧 𝑝𝑝𝑧𝑧 �
𝛾𝛾(1 × 3) 𝜌𝜌(1 × 1) 𝑢𝑢𝑧𝑧 𝑣𝑣𝑧𝑧 (2.16)
𝑑𝑑1 𝑑𝑑2 𝑑𝑑3 𝜌𝜌

The homogeneous transformation matrix accounts for translation and rotation of frames, as well as
scaling (shrinking or enlarging) and perspective transformations. The 𝛾𝛾(1 × 3) submatrix represents
a perspective transformation. The 𝜌𝜌(1 × 1) submatrix represents a scaling transformation. In
robotics the 𝛾𝛾 and 𝜌𝜌 submatrices are typically set to zero.
The columns of 𝐴𝐴𝑇𝑇𝐵𝐵 represent the 4 vectors describing a frame B in terms of frame A. The first three,
when normalized, are the direction cosines of the frame B axes relative to frame A. The last vector
locates the origin of frame B in the reference frame A.

The inverse of the homogeneous transformation matrix is given by:


𝐴𝐴 𝑇𝑇 𝐴𝐴 𝑇𝑇 𝐴𝐴
𝐴𝐴 −1
𝑇𝑇𝐵𝐵 = 𝐵𝐵𝑇𝑇𝐴𝐴 = � 𝑅𝑅𝐵𝐵 (3 × 3) − 𝑅𝑅𝐵𝐵 𝑞𝑞 �
0 0 0 1 (2.17)

In order to transform position vector 𝑩𝑩𝒑𝒑 to a vector relative to frame A 𝑨𝑨𝒑𝒑, it must first be
converted to homogeneous coordinates:
𝑩𝑩
𝒑𝒑 = [𝑝𝑝𝑢𝑢 𝑝𝑝𝑣𝑣 𝑝𝑝𝑤𝑤 1]𝑇𝑇 (2.18)

For a case of pure translation, the homogeneous transformation matrix becomes:


1 0 0 𝑝𝑝𝑥𝑥
𝐴𝐴 0 1 0 𝑝𝑝𝑦𝑦
𝑇𝑇𝐵𝐵 = � � (2.19)
0 0 1 𝑝𝑝𝑧𝑧
0 0 0 1

For a case of pure rotation, the homogeneous transformation matrix becomes:


𝑢𝑢𝑥𝑥 𝑣𝑣𝑥𝑥 𝑤𝑤𝑥𝑥 0
𝐴𝐴 𝑢𝑢 𝑣𝑣𝑦𝑦 𝑤𝑤𝑦𝑦 0
𝑇𝑇𝐵𝐵 = � 𝑦𝑦 � (2.20)
𝑢𝑢𝑧𝑧 𝑣𝑣𝑧𝑧 𝑤𝑤𝑧𝑧 0
0 0 0 1
Example

Point p relative to frame B is described by the vector 𝑩𝑩𝒑𝒑 = [−1 0 2 1]𝑇𝑇 in homogenous
coordinates. The same point is described by the vector 𝑨𝑨𝒑𝒑 = [0 10 −5 1]𝑇𝑇 in frame A.
Determine the transformation matrix 𝐴𝐴𝑇𝑇𝐵𝐵 if the spatial displacement between the two frames is a
pure translation.

Solution:

0 1 0 0 𝑝𝑝𝑥𝑥 −1
10 0 1 0 𝑝𝑝𝑦𝑦 0
� �=� �� �
−5 0 0 1 𝑝𝑝𝑧𝑧 2
1 0 0 0 1 1
Which can be written as:

0 = −1 + 𝑝𝑝𝑥𝑥
10 = 𝑝𝑝𝑦𝑦

−5 = 2 + 𝑝𝑝𝑧𝑧
Therefore:
1 0 0 1
𝐴𝐴
𝑇𝑇𝐵𝐵 = �0 1 0 10 �
0 0 1 −7
0 0 0 1
Example

v
y
u

Frame B is rotated relative to frame A by 30o about the z-axis and translated four units along the
positive x-axis and three units along the y-axis. Determine 𝐵𝐵𝑇𝑇𝐴𝐴 .

Solution:

First, we determine 𝐴𝐴𝑇𝑇𝐵𝐵 :


𝑐𝑐𝑐𝑐 −𝑠𝑠𝑠𝑠 0 𝑞𝑞𝑥𝑥 0.866 −0.500 0.000 4.0
0 𝑞𝑞𝑦𝑦
𝐴𝐴
𝑇𝑇𝐵𝐵 = �𝑠𝑠𝑠𝑠 𝑐𝑐𝑐𝑐 � = �0.500 0.866 0.000 3.0�
0 0 1 0 0.000 0.000 1.000 0.0
0 0 0 1 0 0 0 1

The origin of frame B in coordinates relative to frame B is noted by point 𝑨𝑨𝒒𝒒 = [𝑞𝑞𝑥𝑥 𝑞𝑞𝑦𝑦 𝑞𝑞𝑧𝑧 ]𝑇𝑇 =
[4.0 3.0 0.0]𝑇𝑇

Next, we determine 𝐴𝐴𝑅𝑅𝐵𝐵𝑇𝑇 and 𝐴𝐴𝑅𝑅𝐵𝐵𝑇𝑇 𝑨𝑨𝒒𝒒:


0.866 0.500 0.000
𝐴𝐴 𝑇𝑇
𝑅𝑅𝐵𝐵 = �−0.500 0.866 0.000�
0.000 0.000 1.000
0.866 0.500 0.000 4.0 4.964
𝐴𝐴 𝑇𝑇 𝐴𝐴
𝑅𝑅𝐵𝐵 𝑞𝑞 = �−0.500 0.866 0.000� �3.0� = �0.598�
0.000 0.000 1.000 0.0 0.000

Finally:

0.866 0.500 0.000 −4.964


𝐴𝐴 𝑇𝑇
𝐵𝐵
𝑇𝑇𝐴𝐴 = � 3) − 𝐴𝐴𝑅𝑅𝐵𝐵𝑇𝑇 𝐴𝐴𝑞𝑞 = −0.500 0.866 0.000 −0.598
𝑅𝑅𝐵𝐵 (3 ×
� � �
0 0 0 1 0.000 0.000 1.000 0.000
0 0 0 1

You might also like