Spatial Descriptions & Transformations: Berke Gür
Spatial Descriptions & Transformations: Berke Gür
Berke Gür
Robotics 3/15/2021
Berke Gür 1
Chapter Objectives
• Our aim in this lecture is to learn how the position & orientation of an object can be
represented in the 3D space
• For this purpose, we will use tools and methods from linear algebra
• Material covered in this lecture will form the foundation of the kinematic, static, &
dynamic analysis of manipulators that we will study in the subsequent weeks
Robotics 3/15/2021
Berke Gür 2
Position of a Point
{0} ≡ [ o0 zˆ0 ]
T
xˆ0 yˆ 0
Robotics 3/15/2021
Berke Gür 3
Position of a Point
• The position of the point can
p = px
T
0
py pz
geometrically be expressed in terms of
the position vector = px ⋅ xˆ0 + p y ⋅ yˆ 0 + pz ⋅ zˆ0
• We will use the coordinate & position
vectors interchangeably
0
p≡ p 0
0
0
p= p
x̂0
Robotics 3/15/2021
Berke Gür 4
Position of a Point
• Note that textbooks use slightly different notations to represent point p with respect
to frame {0}
– Class notes notation 0p is equivalent to Spong’s book notation p0
Be careful about these notational differences!
• Also note that the origin of a frame {1} is described by the point o1
• If you want to represent the origin of frame {1} with respect to frame {0}, this is
shown by the vector 0o1
Robotics 3/15/2021
Berke Gür 5
Orientation of an Object
• It is sufficient to define the position
vector for a point ẑ1
• For an object, we need to define both {0} ẑ0 {1}
ŷ1
the position & the orientation
• To describe the orientation of an o1
0
object, we attach a frame {1} to the o1
object
o0 x̂1
• This object frame {1} is different than ŷ0
the reference frame {0}
x̂0
Robotics 3/15/2021
Berke Gür 6
Orientation of an Object
• Describing the object in space is
equivalent to describing the frame {1} ẑ1
attached to the object with respect to {0} ẑ0 {1}
the reference frame {0} ŷ1
• Frame {1} is described relative to
frame {0} by the position vector 0o1 0 o1
o1
and by the rotation matrix (e.g., 01R)
o0 x̂1
ŷ0
x̂0
0
{1} = { 0 o1 0
1 R}
Robotics 3/15/2021
Berke Gür 7
The Rotation Matrix
• The rotation matrix is a 3×3 matrix that describes the unit coordinate vectors of a
frame with respect to the coordinate vectors of the reference frame
• The rotation matrix can be computed from the scalar product of the unit vectors of
the two frames
T
xˆ1 xˆ0 yˆ1 xˆ0 zˆ1 xˆ0
=0 T
R = ˆ
x yˆ ˆ
y yˆ ˆ
z yˆ 0
xˆ 1 0
yˆ 1 0
zˆ 1
T
1 1 0 1 0 1 0
xˆ1 zˆ0 yˆ1 zˆ0 zˆ1 zˆ0
xˆ0 xˆ1 yˆ 0 xˆ1 zˆ0 xˆ1
= xˆ0 yˆ1 =yˆ 0 yˆ1 zˆ0 yˆ1 =
1
xˆ 0 1 yˆ 0 1 zˆ 0 1
R
0
Robotics 3/15/2021
Berke Gür 9
Properties of the Rotation Matrix
2. The rotation described by the matrix 10R reverses the rotation associated by the
0 R matrix
1
0
1 R ⋅ 01 R =
I
3. Combining the first and second properties yields
=
1
0R =
0
RT
1
0
1 R −1
0
1 R ⋅ 21 R ≠ 21 R ⋅ 01 R
Robotics 3/15/2021
Berke Gür 10
Properties of the Rotation Matrix
ẑ0 ẑ0
ŷ0 ŷ0
x̂0 x̂0
ẑ0 ẑ0
Rzˆ0 (π 2 )
Rxˆ0 (π 2 )
ŷ0 ŷ0
x̂0 x̂0
ẑ0 ẑ0
Rzˆ0 (π 2 )
Rxˆ0 (π 2 )
ŷ0 ≠ ŷ0
x̂0 x̂0
Robotics 3/15/2021
Berke Gür 11
Properties of the Rotation Matrix
xˆ=
yˆ xˆ=
zˆ yˆ=
zˆ 0
xˆ= yˆ= zˆ= 1
6. Since 10R = 01RT, the rows of the rotation matrix R are also orthonormal unit
vectors
Robotics 3/15/2021
Berke Gür 12
Properties of the Rotation Matrix
7. Any column (or unit vector) of the rotation matrix can be computed from the other
two columns. Thus, knowing only 2 columns (6 entries) of the rotation matrix is
sufficient
xˆ =
yˆ × zˆ , yˆ =
zˆ × xˆ , zˆ =
xˆ × yˆ
Robotics 3/15/2021
Berke Gür 13
Properties of the Rotation Matrix
8. The rotation matrix can also be specified with 3 elements using Cayley’s Formula
(I − S) −1 (I + S)
R=
0 − sz sy
=S sz 0 − sx
− s y sx 0
Robotics 3/15/2021
Berke Gür 14
Mapping
• Mapping is changing the description of a point from one frame to another frame
• There are three types of mapping
1. Translational Mapping: If the two frames
have the same orientation, the
{1}
mapping between these two frames is expressed as a vector sum
ẑ1 p
{0} 1
ẑ0 0 p
p ŷ1
o1
=
0
p 0
o1 + 1 p
o0
0
o1 x̂1
ŷ0
x̂0
Robotics 3/15/2021
Berke Gür 15
Mapping
2. Rotational Mapping: If the origins of the two frames are coincident but the frames have
different orientations, the mapping is expressed as a matrix product
{0}
{1} ẑ
=
0
p 0
1 R⋅ p
1 1 ẑ0
p
ŷ1
ŷ0
o0,1
x̂0
x̂1
Robotics 3/15/2021
Berke Gür 16
Example: Rotational Mapping
• Given 1p = [0 2 0]T , find 0p where frame {1} is obtained by rotating frame {0} by 30
degrees about the positive z0 axis
Robotics 3/15/2021
Berke Gür 17
Mapping
3. General Mapping: Any general mapping between two arbitrary positioned and oriented frames
can be expressed as a rotational mapping followed by a translational mapping
{1}
ẑ1
0
p= 0
1 R ⋅ 1 p + 0 o1
p
1 ŷ1
{0} ẑ0 p
ẑ1 0 o1
p
0
o1
o0 ŷ1 x̂1
ŷ0
x̂0
x̂1
Robotics 3/15/2021
Berke Gür 18
Mapping
• The mapping between two arbitrary frames can compactly be expressed in terms
of the 4×4 homogeneous transform matrix
0 p 01 R 0
o1 1 p
= ⋅
1 0 0 0 1 1
1
p
= 1A ⋅
0
1
Robotics 3/15/2021
Berke Gür 19
Example: General Mapping
• Given 1p = [3 7 0]T , find 0p where frame {1} is obtained by rotating frame {0} by 30
degrees about the positive z0 axis and translated in the x0 direction by 10 units and
the y0 direction by 5 units
Robotics 3/15/2021
Berke Gür 20
Spatial Operations
• Spatial operators are mathematical tools for moving points and rotating vectors
• Spatial operations are different than mappings in the sense that all operations are
done in the same reference frame (ie., no transformation between frames)
• There are three types of spatial operators
1. Translational Operator (D): Moving a point 0p in the direction of a vector 0q by an amount of q
= |q| can be expressed as a vector sum
0
=
v 0
p + 0q
or a matrix operation
=
0
v Dq (q ) ⋅ 0 p
Robotics 3/15/2021
Berke Gür 21
Spatial Operations
where the translation operator is defined as
1 0 0 qx qx
0 q = q
1 0 qy y
Dq (q ) =
qz
0 0 1 qz
0 0 0 1 q = q = qx2 + q y2 + qz2
Robotics 3/15/2021
Berke Gür 22
Spatial Operations
2. Rotational Operator (R): Rotating a vector 0p about a vector 0k by an angle of θ can be
expressed as a matrix product
=
0
v 0
R ⋅ 0p
or a matrix operation
=
0
v R k (θ ) ⋅ 0 p
3. Transformation Operator (A): The combination of rotating and translating a vector 0p to obtain
a new vector 0v can be also be expressed as a matrix operation
=
0
v 0
A ⋅ 0p
Robotics 3/15/2021
Berke Gür 23
Example: Compund (Multiple) Rotations
• Find the rotation matrix 01R that describes frame {1} obtained first by a rotation of
π/6 about the x0 axis and then by a rotation of π/6 about the z0 axis
Robotics 3/15/2021
Berke Gür 24
Example: Compund (Multiple) Transformations
• Given 2p, find 0p if the intermediate transformations 01A and 12A are given.
Robotics 3/15/2021
Berke Gür 25
Example: Compund (Multiple) Transformations
• Given the relations 01A = 02A · 21A and 01A = 03A · 34A · 41A find 34A.
Robotics 3/15/2021
Berke Gür 26
Example: Inverse Homogenous Transform
• Assume that you are given the homogenous transform
0
1R
0
o1
1A =
0
0 0 0 1
The inverse homogeneous transform can be obtained by taking the matrix inverse
1 A = (0 A)−1
0 1
• Prove that it also possible to compute 10A from 01A without any matrix inversions
Robotics 3/15/2021
Berke Gür 27
Parameterization of Rotations
Robotics 3/15/2021
Berke Gür 28
Simple Rotations
1 0 0
R x (ψ ) 0 cosψ
= − sinψ
0 sinψ cosψ
cosθ 0 sin θ
R y (θ ) = 0 1 0
− sin θ 0 cosθ
cos φ − sin φ 0
R zˆ0 (φ ) = sin φ cos φ 0
0 0 1
Robotics 3/15/2021
Berke Gür 29
Parameterization of Rotations
• It is difficult to visualize the physical rotation represented by the 3×3 rotation matrix
• The 9 element rotation matrix can be specified using only 3 variables (see Cayley’s
formula)
• However, there are many more physically meaningful ways to specify a compund
rotation using only 3 variables
• Any rotation can be specified in terms of the
– X-Y-Z Fixed Angles
– Z-Y-X Euler Angles
– Z-Y-Z Euler Angles
– Axis and Angle Representation
– X-Y-Z-W Quaternions
Robotics 3/15/2021
Berke Gür 30
X-Y-Z Fixed Angles
• Consider that we have two coincident frames with the same orientation
• Assume that frame {0} is the reference frame and frame {1} is the rotating frame
• The X-Y-Z fixed angles consist of three rotations performed as follows:
1. First, rotate frame {1} about the fixed x0 axis by an angle ψ
2. Then, rotate frame {1} about the fixed y0 axis by an angle θ
3. Finally, rotate frame {1} about the fixed z0 axis by an angle ϕ
Robotics 3/15/2021
Berke Gür 31
X-Y-Z Fixed Angles
• The resulting compound rotation matrix is
0
1 R zˆ0 yˆ0 xˆ0 (ψ ,θ ,φ ) = R zˆ0 (φ ) ⋅ R yˆ0 (θ ) ⋅ R xˆ0 (ψ )
cos φ − sin φ 0 cosθ 0 sin θ 1 0 0
= sin φ cos φ 0 ⋅ 0 1 0 ⋅ 0 cosψ − sinψ
0 0 1 − sin θ 0 cosθ 0 sinψ cosψ
c φ cθ c φ sθ sψ − s φ cψ c φ sθ cψ − s φ sψ
= s φ cθ s φ sθ sψ + c φ cψ s φ sθ cψ − c φ sψ
− sθ cθ sψ cθ cψ
Robotics 3/15/2021
Berke Gür 32
X-Y-Z Fixed Angles
• Given a rotation matrix
r11 r12 r13
0
R (φ , θ ,ψ ) = r r22 r23
1 zˆ1 yˆ1xˆ1 21
r31 r32 r33
the X-Y-Z fixed angles can be computed from (for cosθ ≠ 0 or −π / 2 < θ < π / 2)
Robotics 3/15/2021
Berke Gür 33
X-Y-Z Fixed Angles
θ = π / 2
ψ = arctan(r11 r22 )
φ =0
θ = −π / 2
ψ = − arctan(r11 r22 )
φ =0
Robotics 3/15/2021
Berke Gür 34
Z-Y-X Euler Angles
• The Z-Y-X Euler angles consist of three rotations performed as follows:
1. First, rotate frame {1} about the z1 axis by an angle ϕ
2. Then, rotate frame {1} about the current y1 axis by an angle θ
3. Finally, rotate frame {1} about the current x1 axis by an angle ψ
Robotics 3/15/2021
Berke Gür 35
Z-Y-X Euler Angles
• The resulting compound rotation matrix is
0
1 R zˆ1 yˆ1xˆ1 (φ ,θ ,ψ ) = R zˆ1 (φ ) ⋅ R yˆ1 (θ ) ⋅ R xˆ1 (ψ )
cos φ − sin φ 0 cosθ 0 sin θ 1 0 0
= sin φ cos φ 0 ⋅ 0 1 0 ⋅ 0 cosψ − sinψ
0 0 1 − sin θ 0 cosθ 0 sinψ cosψ
c φ cθ c φ sθ sψ − s φ cψ c φ sθ cψ − s φ sψ
= s φ cθ s φ sθ sψ + c φ cosψ s φ sθ cψ − c φ sψ
− sθ cθ sψ cθ cψ
• Note that the resulting rotation matrix is the same as that derived for X-Y-Z fixed
axis rotations
• Hence, computing the Z-Y-X Euler angles from the rotation matrix is the same as in
the X-Y-Z fixed angles
Robotics 3/15/2021
Berke Gür 36
Z-Y-Z Euler Angles
• The Z-Y-Z Euler angles consist of three rotations performed as follows:
1. First, rotate frame {1} about the z1 axis by an angle ϕ
2. Then, rotate frame {1} about the current y1 axis by an angle θ
3. Finally, rotate frame {1} again about the current z1 axis by an angle ψ
Robotics 3/15/2021
Berke Gür 37
Z-Y-Z Euler Angles
• The resulting compound rotation matrix is
0
1 R zˆ1 yˆ1zˆ1 (φ ,θ ,ψ ) = R zˆ1 (φ ) ⋅ R yˆ1 (θ ) ⋅ R zˆ1 (ψ )
c φ cθ cψ − s φ sψ − c φ cθ sψ − s φ cψ cφ sθ
= s φ cθ cψ + c φ sψ − s φ cθ sψ + c φ cψ s φ sθ
− sθ cψ sθ sψ cθ
Robotics 3/15/2021
Berke Gür 38
Z-Y-Z Euler Angles
• Given a rotation matrix, the Z-Y-Z Euler angles can be computed from (for sinθ ≠ 0 or
0 < θ < π)
Robotics 3/15/2021
Berke Gür 39
Z-Y-Z Euler Angles
θ = 0
= ψ arctan(− r12 r11 )
φ = 0
• Also, for θ = π
θ =π
= ψ arctan(r12 − r11 )
φ =0
Robotics 3/15/2021
Berke Gür 40
Z-X-Z Euler Angles
Robotics 3/15/2021
Berke Gür 42
Axis-Angle Representation
k x k x vθ + c θ k x k y vθ − k z s θ k x k z vθ + k y s θ
R k (θ ) = k k vθ + k s θ k y k y vθ + c θ k y k z vθ − k x s θ
x y z
k x k z vθ − k y s θ k y k z vθ + k x s θ k z k z vθ + c θ
r32 − r23
1
=θ acos[(r11 + r22 + r33 − 1) 2],=kˆ r13 − r31
2sin θ
r21 − r12
Robotics 3/15/2021
Berke Gür 43
Example: Axis-Angle Representation
• Find the transformation matrix that rotates frame {1} through an angle of 2π/3
about a unit vector k defined as the diagonal of a cube
Robotics 3/15/2021
Berke Gür 44
X-Y-Z-W Quaternions (Euler Parameters)
• Also termed to Euler parameters
• Very similar to Angle-Axis representations
• Mainly used in computer vision
x ε1 = k x sin(θ 2),
y ε 2 = k y sin(θ 2),
z ε 3 = k z sin(θ 2),
w ε 4 = cos(θ 2).
Robotics 3/15/2021
Berke Gür 45
X-Y-Z-W Quaternions (Euler Parameters)
• The resulting compound rotation matrix is
1 − 2ε 22 − 2ε 32 2(ε1ε 2 − ε 3ε 4 ) 2(ε1ε 3 + ε 2ε 4 )
R=
ε 2(ε ε
1 2 3 4 + ε ε ) 1 − 2ε 2
1 − 2ε 3
2
2(ε ε
2 3 + ε ε )
1 4
2(ε1ε 3 + ε 2ε 4 ) 2(ε 2ε 3 + ε1ε 4 ) 1 − 2ε12 − 2ε 22
• The Euler parameters can be obtained from the rotation matrix entries using the
relations
r32 − r23 r −r
=ε1 = ε 2 13 31
4ε 4 4ε 4
r21 − r12 1
ε 3= ε 4= 1 + r11 + r22 + r33
4ε 4 2
Robotics 3/15/2021
Berke Gür 46
Next Lecture
• Lecture topics
– Kinematics
• Reading assignment: Ch. 3 in textbook
• Questions?
Robotics 3/15/2021
Berke Gür 47