Professional Documents
Culture Documents
Transformation
(Chapter 2)
Yunhui Liu
Dept. of Mechanical and Automation Engineering
The Chinese University of Hong Kong
Introduction
• The configuration of a robot manipulator is determined
by its joint variables such as joint angles or joint
distances.
• Task specification is usually given in a Cartesian space,
i.e. the desired position and orientation of the end-
effector are given in a Cartesian coordinates frame.
• Problem: How do we relate the joint variables to the
position and orientation of the end-effector?
2 3
Object Position and
1 Oreintation:
( x, φ )
x = f (q )
Kinematics equation
Forward Kinematics
x
Inverse Kinematics
• Definition: Given a position and orientation of
the end-effector, find the corresponding joint
variables of the robot manipulator.
1
f ( x)
Inverse kinematics equation
Inverse kinematics
x
Questions
x
Coordinate Frame
• Definition: A set of n linearly independent
vectors in R n is a coordinate system (frame) in .
n
R
x2 x
3 x4
x1
- Completene ss :
T
if y xi 0 i, then y 0
Representation of a Coordinate Frame
z
y1
y2
x2
C
45 x1 y
A
B
x
x2 y2 x y z
x1 y1 ì 2 ü
2 ì1 0 0ü
ï - ï
ì1 0ü ï ï
í ý B
ï 2
í
ï 2
2 ï
ý
ï
C í0 1 0ý
ï0 1ïþ
A 2
î0 1þ ïî 2 2 ïþ
î 0
Rotation Matrix
Rotation Matrix
• Rotation matrix represents the orientation of the
coordinate frame.
• By listing the directional vectors of the axes as the
column vectors, we obtain the rotation matrix of
the coordinate frame.
R x, y, z
• The rotation matrix R is an orthogonal matrix, i.e.
1
R R
T
Coordinates
• What are the coordinates of a point with
respect to a coordinate frame?
The coordinates of the point w.r. t. A yA
yB
xB
(1,2) 2
45 xA
The coordinates w.r.t. B ? 1
2 2
B
p1 (1 2) 2 , B
p2 (1 2) 2
2 2
2 2
Coordinates
• The i-th coordinate of a vector p w.r.t an
orthonormal coordinate frame :
S
pi = pT xi Unit vector of the axis
45 xA
2 2
B
p1 (1 2) 2 , B
p2 (1 2) 2
2 2
2 2
Coordinate Transform
• Given two coordinate frames with the same origin
point: y2
y1
x2
A : O x1 y1 z1 , {I } 45
o x1
B : O x2 y2 z2 , A
{ x1 A
x2 A
x3 }
45 A B A
o xA RB p = p
Inverse Coordinate Transform
A B A
RB p = p
B
p R
A
B
1 A A T A B A
p RB p RA p
B
RA R
A
B
1
RB
A T
Relation between 3 Frames
A
RB : the rotation matrix of frame B w.r.t. frame A
B
RC : the rotation matrix of frame C w.r.t. frame B
A
RC : the rotation matrix of frame C w.r.t. frame A
The direction of the x-axis of frame C w.r.t. zA
frame A can be calculated as follows zC yB
A A B
xC = R B xC
yC
zB
yA
A
RC = A R B éë B xC B
yC B
zC ùû = A R B B RC
xA xB
xC
Representation of Position and
Orientation of a Rigid Body
• Set up two frames zo
W : O xyz C
z z
y y
x
Rotation about x Rotation about y Rotation about z
Rotation about x
• Rotating a frame about its x-axis by an angle leads
to a new frame. The rotation matrix of the new
frame w.r.t. the original one is
z
1 0 0
Rot x ( ) 0 c s y
0 s c
x
Rotation about x
c cos , s sin
Rotation about y
• Rotating a frame about its y-axis by an angle
leads to a new frame. The rotation matrix of
the new frame w.r.t. the original one is
c 0 s
Rot y ( ) 0 0
y
1
s c
0
Rotation about y
Rotation about z
• Rotating a frame about its z-axis by an angle
leads to a new frame. The rotation matrix of
the new frame w.r.t. the original one is
z
c s 0
Rot z ( ) s c 0
0 1
0
Rotation about z
Composite rotation
• Rotate frame A about zA by angle => frame B
• Then rotate frame B about yB by angle =>frame C
zA zA
yB zC yB
yA yA
xC
xA xB xA xB
A
RB Rot z ( ) B
RC Rot y ( )
xB
xA
Post-multiplication of
rotation matrix
Rotation about Reference Frame
• Frame A: A reference frame
• Frame B: A frame to be rotated
• Rotate frame B about the k-th axis of frame A by
angle frame C zA
Rotation of frame A about its
own k-th axis by frame A’ zB yB
A
RA' Rotk ( )
as both C and A’ are
A'
RC ARB results of the same
rotation
xC
yA
xB
RC RA' RC Rotk ( ) RB
A A A' A xA xA’
1 0 0
RB 0 1 0
yA
yB
0 0 1 xB
xA
Example 1
zA
0 0 1 1 0 0
R B '' Rot y (90 ) RB ' 0 1 0 0 0 1
xB’’’
1 0 0 0 1 0
zB’’’
zB’’
yA
• After rotation about zB’’ yB’’ yB’’’
xB’’
RB''' RB'' Rotz (90 ) ... xA
Representation of a rotation matrix by three
angles
xT y 0
y T z 0
R x, y, z subject to T
x z 0
x y z 1
• A rotation matrix has 3 independent variables
because
• It is possible to represent a rotation matrix by three
angles, such as the Euler angles, Roll-Pitch-Yaw
angles, etc.
Euler Angles z
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
Z’’
Roll-Pitch-Yaw Angles
z
Y’
X’’
Euler Angles Rotation Matrix
• Given Euler angles rotation matrix: This is easy (see
previous slides)
• Given rotation matrix Euler angles: Solving the following
non-linear equation
r11 r12 r13 c c c s s c c s s c c s
R r21 r22 r23 s c c c s s c s c c s s
Given r31 r32 r33 s c s s c
2
s r132 r23 atan2( r13 r23 , r33 )
2 2
c r33
atan2 (r23 , r13 ) atan2(b, a)
if s 0
atan2 (r32 ,r31 )
a
r atan2 (r , r ) b
if s 0
33 21 22
90
- 90
r33
Equivalent Angle-Axis
• A rotation matrix can be also obtained by a
u1
rotation of angle about an equivalent axis u u2
u
3
(u , ) is called the equivalent
angle - axis of the rotation matrix
Given (u , ) the rotation matrix is
u12 v c u u v u s u u v u s
1 2 3 1 3 2
R(u , ) u1u 2 v u3 s u 22 v c u 2u3v u1s
u u v u s u u v u s u 2v c
1 3 2 2 3 1 3
v 1 c
Equivalent Angle-Axis
• Given a rotation matrix how to calculate the
equivalent angle axis?
Solve
u12 v c u1u 2 v u3 s u1u3v u 2 s
r11 r12 r13
r r23 u1u 2 v u3 s u 22 v c u 2 u3v u1s
21 r22
r
31 32 33 u1u3v u 2 s
r r u 2 u3v u1s u32 v c
Trace( R) 1
arccos
2
1 r32 r23
u r13 r31
2 sin r21 r12
Homogeneous Transformation
A
r : coordinates of point Q w.r.t. frame A
B
r : coordinates of point Q w.r.t. frame B
p : vector from origin of frame A to that of frame B
Mapping involving rotated frames
• Frames A and B have different orientations,
but their origins are the same
A
RB : rotation matrix of frameB w.r.t.frameA
A Br
A B
r
r RB r
A
Frame B
Frame A
Mapping involving general frames
RB A
A
TB p
013 1
• Homogeneous coordinates transformation:
A
r A r B
TB
1 1
Operators: Translation, Rotation
and Transformation
Translation Operator
• Translate a point Q by a vector p
r : the position before translation
r ': the position after translation
p
r' p r
r
r'
r ' I 33 p r
1 0 1
13 1
D( p) : Translational operator
Rotation Operator
• Rotate point about axis u by an angle
Introduce a frame B, which is obtained
by rotating frame A about u by Q
r u
frame A
rotation
frame B
point Q
point Q'
Q’
r'
Frame B
A B
r r' Frame A
A B r ' R(u , ) 031 r
r ' R r ' R(u , )r
1
B
0
13 1 1
Rot (u , ) : rotational operator
Transform Operator
• For operation involving both translation and
rotation
– First rotate point about an axis by angle
– Then translate it by a vector
u
r ' R(u , ) p r r
1 0
13 1 1
p r'
T ( R, p) : transformation operator
Transformation Arithmetic
Compound Coordinates Transformation
• Coordinates in 3 frames
Frame C
Frame A Frame B
A B C
r , r , r : homogeneous coordinates of a point w.r. t. the frames
A
TB , B TC , ATC : homogeneous transformation matrices among the frames
A B C A C
r TB r TB TC r ,
A A B
r TC r A
A
TC ATB BTC
Compound Transformation
• Transformation w.r.t. mobile frame
– Transform frame A by T1 (w.r.t. frame A)frame B
– Transform frame B by T2 (w.r.t. frame B) frame C
A
TB T1 , B
TC T2
A
TC T1T2
Compound Transformation
• Transformation w.r.t. a reference frame
– Transform frame A by T1 (w.r.t. frame A)frame B
– Transform frame B by T2 (w.r.t. frame A) frame C
A
TB T1 , T2 is a transform operator
A
TC T2 ATB T2T1
Summary on Compound Transformation
A
TB' T T B A
Pre-multiplication of T
Example 2
• Let r be the homogenous coordinates of a point w.r.t.
a frame A. Rotate the point about zA by 30 degrees.
Then translate it along zA by -1 and yA by 2. Find the
new coordinates of the point w.r.t. frame A
cos 30 sin 30 0 0
sin 30 cos 30 0 2 r
r'
0 0 1 1
0 0 0 1
Example 3
• Let r be the homogenous coordinates of a point
w.r.t. a frame A. Translate it along zA by -1 and yA
by 2. Then, rotate the point about zA by 30 degrees.
Find the new coordinates of the point w.r.t. frame
A
cos 30 sin 30 0 0 1 0 0 0
sin 30 0 1 0 2 r
r' cos 30 0 0
0 0 1 0 0 0 1 1
0 0 0 1 0 0 0 1
Example 4
• Let T0 be the position and orientation of an object
w.r.t. a frame A. Rotate the object about its own x-
axis by 60 degrees. Then translate it along zA by -1
and yA by 2. Furthermore, rotate the object about zA
by 30 degrees. Find the new position and orientation
of the object w.r.t. frame A
cos 30 sin 30 0 0 1 0 0 0 1 0 0 0
sin 30 cos 30 0 0 0 1 0 2 0 cos 60 sin 60 0
T' 1 0 sin 60 cos 60 0
T0
0 0 1 0 0 0 1
0 1 0
0 0 1 0 0 0 0 0 1
Inverse Transformation
• Inverse of a homogeneous transformation
matrix
Frame B
A
r A r
1
TB
B
r
1 1
B
T
A
B
1 A r
1 B
r
A A B
r p RB r A
r
p
A T A A T
B
r RB r RB p
A
B r A RBT p r
ARBT
1 013 1 1 Frame A
T
A
B
1
Inverse Transformation
T R p
013 1
1 R T
R T
p
T
013 1
Transformation Equation
• In robotics, many problems concern a set of
transformation forming a loop
A
TC TB TC
A B
b
To Tc T o Tb
b c
1
c 1 c 1
T o T1 T2
0 0 1 1 1 0 1 10
1 0 0 2 0 1 0 5
b
To
0 1 0 1 0 1 1 2
0 0 0 1 0 0 1
0
0 1 0 2 1 0 1 10
0 0 1 1 0 1 0 5 ...
1 0 0 1 0 1 1 2
0 0 0 1 0 1
0 0
Summary on Homogeneous
Transformation Matrix
1) It can be used for coordinates transformation
A A B
r TB r
2) It can be used to represent the relation between
two coordinate frames
zB
zA 5
xB
yA
xA- yB
0 1 0 0
1 0 0 5
A
TB
0 0 1 0
0 1
0 0
Summary on Homogeneous
Transformation Matrix
3) Represent position and orientation
zo
of an object
z yo
To C
object
4) Represent translation and rotation xo
y
O
I 33 p
Pure translation : D( p) x
013 1
Pure rotation : Rot ( R)
R 031
013 1
R
Translation & rotation : T ( R, p) p
013 1