Kinematics Primer

Download Report

Transcript Kinematics Primer

Kinematics Primer
Jyun-Ming Chen
Contents
General Properties of Transform
2D and 3D Rigid Body Transforms




Representation
Computation
Conversion
…
Transforms for Hierarchical Objects
Math Primer
Kinematic Modeling
Two interpretations of
transform

“Global”:
 An operator that
“displaces” a point
(or set of points) to
desired location

“Local”:
 specify where
objects are placed
in WCS by moving
the local frame
Next, explain these
concepts via 2D
translation
Verify that the same
holds for rotation,
3D, …
Ex: 2D translation
y
p
The transform, as an operator, takes
p to p’, thus changing the coordinate
of p:
p’
Tr(t)
Tr(t) p = p’
x
1 0 3 1  1  3  4
0 1 2   2    2  2    4 

  
  
0 0 1 1  1  1
Ex: 2D translation (cont)
y’
y
The transform moves the xy-frame to
x’y’-frame and the point is placed
with the same local coordinate.
p’
p
Tr(t)
x
x’ To determine the corresponding
position of p’ in xy-frame:
T x ' y 'p xy p
xy
x' y'
xy
x' y'
xy
x' y'
p : the coordinate of p in xy - frame
p : the coordinate of p in x' y'-frame
1 0 3 1  1  3  4
0 1 2   2    2  2    4 

  
  
0 0 1 1  1  1
T : the transform that take s xy - frame to x' y' frame
Properties of Transform
Transforms are
usually not
commutable

TaTb p  TbTa p (in
general)
Rotation axis n
passes thru origin
Rigid body transform:


the ones preserving
the shape
Two types:
 rotation rot(n,q)
 translation tr(t)
Rigid Body Transform
transforming a point/object

rot(n,q) p; tr(t) p
not commutable

rot(n,q) tr(t) p  tr(t) rot(n,q) p
two interpretations (local vs. global
axes)
2D Kinematics
1 0 t x 
Rigid body transform 
Tr( t x , t y )  0 1 t y 
only consists of
0 0 1 
 Tr(x,y)
cos q  sin q 0
 Rot(z,q)
Rot(z, q )   sin q cos q 0
Computation:
 0
0
1
 3x3 matrix is
In general,
sufficient
cos q  sin q t x 
T   sin q cos q t y   Tr( t x , t y ) Rot(z, q )
 0
0
1 
3D Kinematics
Consists of two
parts


3D rotation
3D translation
 The same as 2D
3D rotation is more
complicated than 2D
rotation (restricted to zaxis)
Next, we will discuss
the treatment for spatial
(3D) rotation
3D Rotation Representations
Axis-angle
3X3 rotation matrix
Unit quaternion
Learning Objectives






Representation
Perform rotation
Composition
Interpolation
Conversion among
representations
…
Axis-Angle Representation
Rot(n,q)



n: rotation axis (global)
q: rotation angle (rad. or deg.)
follow right-handed rule
Perform rotation

Rodrigues formula
Interpolation/Composition: poor

Rot(n2,q2)Rot(n1,q1) =?= Rot(n3,q3)
Rodrigues Formula
r
v
a
v’
v’=R v
Rodrigues (cont)
http://mesh.caltech.edu/ee148/notes/ro
tations.pdf
http://www.cs.berkeley.edu/~ug/slide/p
ipeline/assignments/as5/rotation.html
Rotation Matrix
Meaning of three
columns
Perform rotation:
linear algebra
Composition: trivial

orthogonalization
might be required
due to FP errors
Interpolation: ?

A  aij  uˆ1 uˆ2


uˆ3 

x  x1uˆ1  x2uˆ2  x3uˆ3
 
 x1 Auˆ1  x2 Auˆ2  x3 Auˆ3
 Ax
x  R1 x
x  R2 x  R2 R1 x  R2 R1 x
Gram-Schmidt Orthogonalization
If 3x3 rotation matrix no longer
orthonormal, metric properties might
change!

uˆ uˆ
 1 2

 
uˆ3   vˆ1 vˆ2
 
Verify!

vˆ3 

vˆ1  uˆ1
uˆ2  vˆ1
vˆ2  uˆ2 
vˆ1
vˆ1  vˆ1
uˆ3  vˆ1
uˆ3  vˆ2
vˆ3  uˆ3 
vˆ1 
vˆ2
vˆ1  vˆ1
vˆ2  vˆ2
Quaternion
A mathematical entity invented by
Hamilton
Definition

q  q0  q1i  q2 j  q3 k  q0  q
i 2  j 2  k 2  1
ij   ji  k
jk  kj  i
ki  ik  j
i
k
j
Quaternion (cont)
Operators

Addition
p  p0  p1i  p2 j  p3k
q  q0  q1i  q2 j  q3k
p  q   p0  q0    p1  q1 i   p2  q2  j   p3  q3 k

Multiplication

Conjugate

    
pq  p0 q0  p0 q  q0 p  p  q  p  q

q  q0  q
*

 pq *  q* p*
Length
q  q*q  q02  q12  q22  q32
Unit Quaternion
Define unit quaternion as follows to
represent rotation
Rot (nˆ,q )  q  cos q2  sin q2 nˆ
q 1
Example

Rot(z,90°) q   22 0 0
2
2

Why “unit”?
DOF point
of view!
Unit Quaternion (cont)
Perform Rotation
x  qxq*  ...
 

 
2
 (q0  q  q ) x  2q0 q  x  2q (q  x)
Composition
x  pxp*
Interpolation


x  qxq*  q pxp* q*  (qp) x(qp)*
p (t )  (1  t ) p1  tp 2
p (t )
p
p (t )
Example
y,x’
x
y’
z,z’
p(2,1,1)
Rot(z,90°)
0  1
R  1 0
0 0
0
p  Rp  1
0
0
0
1
 1 0 2  1
0 0 1    2 
0 1 1   1 
Example (cont)
p  0 2 1 1
q

2
2
0 0
2
2

 

 
p  (q02  q  q ) p  2q0 q  p  2q (q  p )
i j
 2
 ( 12  12 ) 1   2 22 0 0
2 1
1 
 1 0  1
  2   0   2 
 0  1  1 
k  0
 0 ( 2 )
2
2

2 
  2
1   22 
Example q
2
2
90
90

cos

sin
(
0
0
1
)

(
0
0
1
2
2
2
2 )
Compositio n :
2
2
90
90
q2  cos

sin
(
1
0
0
)

(
0 0)
2 2 2
2
2
22
2
q2 q1  ( 2
0 0)( 2 0 0 2 )
2
y,x’
x
y’
z,z’
y

2
2
2
2

2
2
(
2
2
0 0) 
i j k
  22 0 0   (
 0 0 22 
 ( 12 12 21 12 )
2
2
(0 0
2
2
0 0)  (0 0
2
2
2
2
x,x’
Interpolat ion :
middle : q1.5  12 q1  12 q2  (
z,y’
z’
normalize :
q1.5
2
2
2
4
0
2
4
)
)
)
Interpolat ion :
middle : q1.5  12 q1  12 q2  (
2
2
2
4
0
2
4
)
normalize :
q1.5 (
q

q1.5
2
2
2
4
0
3
2
4
)
2
Correspond ing axis - angle :
nˆ  (
1
2
0
1
2
), cos q2 
2
3
(
2
3
1
6
0
1
6
)
Spatial Displacement
Any displacement can be decomposed
into a rotation followed by a translation
Matrix x  Rx  d
 x

 

y
 
x   , T  

z
 

1
 

Quaternion
R
0
x  qxq*  d

d 
 x  Tx


1
Hierarchical Objects
For modeling articulated objects

Robots, mechanism, …
Goals:


Draw it
Given the configuration, able to compute
the (global) coordinate of every point on
body
Ex: Two-Link Arm (2D)
Configuration


Link 1: Box (6,1);
bend 45 deg
Link 2: Box (8,1);
bend 30 deg
Goals:


Draw it
find tip position
y
y
x
x
Ex: Two-Link Arm
Tip Position:
0
Rot(z,45)  Tr(0,6)  Rot(z,30)  
8
T for link1:
Rot(z,45) Tr(0,6) Rot(z,30)
Tip pos:(0,8)
Rot(z,30)
Tr(0,6)
Rot(z,45)
T for link2:
Rot(z,45)
Ex: Two-Link Arm
Rot(z,45)
Tr(0,6’)
0
Rot(z" ,30)  Tr(0,6' )  Rot(z,45)  
8
It can be shown that
T(q1" , p1" )  T(q 2 ' , p2 ' )  T(q 3 , p3 )
 T(q 3 , p3 )  T(q 2 , p2 )  T(q1 , p1 )
Rot(z”,30)
Tip pos:(0’”,8’”)
Thus, two views are equivalent
The latter might be easier to
visualize.
Ex: Two-Link Arm (VRML syntax)
Transform {
rotation 0 0 1 45
children
Link1
Transform {
translation 0 0 6
children
Transform {
rotation 0 0 1 30
children
Link2
}
}
}
Classes in Javax.vecmath
• Conversion Methods:
Exercises
Study the references of Rodrigues
formula
Verify equivalence of these 2 ref’s
Compute inverse Rodrigues formula