0% found this document useful (0 votes)
182 views

Spatial Descriptions and Transformation: (Chapter 2)

- A coordinate frame consists of a set of orthogonal unit vectors that define an orientation in space. - The rotation matrix represents the orientation of a coordinate frame relative to another and is used to transform coordinates between frames. - Coordinate transforms allow expressing the position of a point with respect to one frame in terms of its coordinates in another frame.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
182 views

Spatial Descriptions and Transformation: (Chapter 2)

- A coordinate frame consists of a set of orthogonal unit vectors that define an orientation in space. - The rotation matrix represents the orientation of a coordinate frame relative to another and is used to transform coordinates between frames. - Coordinate transforms allow expressing the position of a point with respect to one frame in terms of its coordinates in another frame.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 59

Spatial Descriptions and

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, φ )

Cartesian Coordinate Frame


Forward Kinematics
• Forward kinematics:
 Given a set of joint
variables  , determine the position and
orientation x of the end-effector with respect to a
task (world, inertia) coordinate frame.

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

• How to represent a position?


• How to represent an orientation?
• How to define joint variables?
Representation of Position
• How to represent the position of a point?
– Define a coordinate frame
– Use a vector of coordinates with respect to
the coordinate frame to represent the position
• What is a coordinate frame?
• How to define a coordinate frame?
P

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

Which two axes form a coordinate frame?


Orthonormal Coordinate Frame
• A complete orthonormal set of linearly
independent vectors { x1, x2 ,..., xn } forms an
orthonormal coordinate frame in R n .
- Orthonorma l :
T 
xi x j  0 i j
T 
xi xi  1

- 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

Example: The coordinates of Vector

a point w.r.t.  A are (1,2). The yA


coordinates w.r.t.  B yB
xB


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 }

transform the coordinates of a point w.r.t. one frame to


those w.r.t. another frame.
æ3 2 ö
ç ÷ A
æ1 ö
B
p= ç 2 ÷
? p =ç ÷
ç
ç 2
÷
÷ è 2ø
è 2 ø
Coordinate Transform
• The rotation matrix Coordinate Transform
of frame B w.r.t.
 2   
frame A is   2 
3 3 2   2  2   1 
 2 2  2  2  2  2   2
     
A
RB   2 2   2   2 
 2 2   2 2  3 3 
   
 2 2   2 2  2   1 
 2 2  2   2 
  
yA  2 2  2 
yB
xB

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

A fixed reference frame: z yo

W : O  xyz C

An object frame fixed on the object: object


xo
 O : C  xo y o z o O
y

The position and orientation of the moving frame can represent


the position and orientation of the object
Position: vector OC
Orientation: rotation matrix of the object frame w.r.t.
the reference frame
Fundamental Rotation
• Rotation about a single axis is a fundamental
rotation

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 ( )

RC  ARB B RC  Rot z ( ) Rot y ( )


A
Rotation about non-reference frame
• Frame A: A reference frame
• Frame B: A frame to be rotated
• Rotate frame B about its own k-th axis by angle 
 frame C z A

zB yB
B
RC  Rotk ( )
A
RC  RB RC  RB Rotk ( )
A B A
xC
yA

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’

Pre-multiplication of rotation matrix


Example 1
• Frames A and B are coincident initially. Rotate frame B
about its x-axis by 90 degrees and then rotate the new frame
about the y-axis of frame A by 90 degrees. Finally rotate the
frame obtained after the previous rotation about its own z
axis by -90 degrees. Calculate the rotation matrix of the final
frame w.r.t. frame A. z A

Initially, the rotation matrix of frame B w.r.t frame A.


zB

1 0 0 
RB   0 1 0 
yA
yB
 0 0 1 xB
 
xA
Example 1
zA

• After the rotation about xB


yB’
1 0 0 
   zB’
RB'  RB Rot x (90 )   0 0  sin 90  yA
 0 sin 90  0 
 
xB’
• After the rotation about yA xA 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

• Rotation about z-axis by 


• Rotation about the new y-axis by 
• Rotation about the new z-axis by 

R  Rot z ( ) Rot y ( ) Rot z ( ) Y’

 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

• Rotation about z-axis by 


• Rotation about the new y-axis by 
• Rotation about the new x-axis by 

Y’

R  Rot z ( ) Rot y ( ) Rot x ( )

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 general approach for coordinate transformation


• Useful and important
Mapping: Changing descriptions
from frame to frame
• Mapping involving translated frames
• Frames A and B have the same orientation
and their origins are different
Point Q
B
A r
r
A  B 
r r  p 
p Frame B
Frame A

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

• Frames A and B have different origins and orientations


A
RB : rotation matrix of frame B w.r.t. frame A Frame B
p : vector from origin of A to origin of B.
B
• Introduce a frame C that is parallel to r Frame C
frame A and share the origin with frame B A
r 
A C  p
r r  p
C C B C B
r  R B r  RB r Homogeneous
 transformation
  A B matrix
r  p  RB r
Frame A
  
 A r   A RB p  B r 
   
   13
1 0 1  1  Homogeous coordinates
Homogeneous Transformation Matrix
• A 4*4 matrix, always full rank

 RB A 
A
TB   p
 013 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 33 p  r 
1   0 1 
   13 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 , ) 031  r 

r ' R r '  R(u , )r  
1 
B
 
0
 13 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  
   13 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

Frame A 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

Frame A Frame B Frame C

A
TB  T1 , T2 is a transform operator


A
TC  T2 ATB  T2T1
Summary on Compound Transformation

• Frame A: a reference frame


• Frame B: a moving frame
1) Transform frame B by an operator T w.r.t itself
A
TB'  T BT
A
Post-multiplication of T

2) Transform frame B by an operator T w.r.t. the


reference frame.

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   013 1  1  Frame A

T
A
B
1
Inverse Transformation


T  R p

 013 1

1  R T
 R T 
p
T  
 013 1 
Transformation Equation
• In robotics, many problems concern a set of
transformation forming a loop

A
TC  TB TC
A B

Given any two of transformation matrices, we


can calculate the other one.
Example 5
• A camera mounted on a robot arm
sees the base of the robot as
0 0 1 1 
1 0 0  2 object
T1  
0 1 0 1 
0 0 1 
 0
And it sees the object as
1 0 1 10 
 5 
T2   0  1 0
 2
Robot base
0 1 1
0 0 0 1 

Find the position and orientation of the
object w.r.t. the robot base
Example 5
• Solution:
b
To : the homogeneous transformation matrix of object w.r .t the base
b
Tc : the homogeneous transformation matrix of camera w.r.t the base
c
To : the homogeneous transformation matrix of object w.r .t the camera
c
Tb : the homogeneous transformation matrix of base w.r.t the camera

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 33 p 
Pure translation : D( p)    x
 013 1 
Pure rotation : Rot ( R)  
R 031 
 013 1 
 R 
Translation & rotation : T ( R, p)   p 

 013 1 

You might also like