Transformations and Kinematics
Transcript of Transformations and Kinematics
Transformations and
Kinematics
Jehee Lee
Seoul National University
Transformations
• Linear transformations
• Rigid transformations
• Affine transformations
• Projective transformations
T
Global reference frame
Local moving frame
Linear Transformations
• A linear transformation T is a mapping between
vector spaces
– T maps vectors to vectors
– linear combination is invariant under T
• In 3-spaces, T can be represented by a 3x3 matrix
)()()()( 1100
0
NN
N
i
ii TcTcTccT vvvv
major) (Row
major)(Column )(
3331
1333
Nv
vMvT
Examples of Linear Transformations
• 2D rotation
• 2D scaling
y
x
y
x
cossin
sincos
ys
xs
y
x
s
s
y
x
y
x
y
x
0
0
yx, yx ,
Examples of Linear Transformations
• 2D shear
– Along X-axis
– Along Y-axis
y
dyx
y
xd
y
x
10
1
dxy
x
y
x
dy
x
1
01
Examples of Linear Transformations
• 2D reflection
– Along X-axis
– Along Y-axis
y
x
y
x
y
x
10
01
y
x
y
x
y
x
10
01
Properties of Linear Transformations
• Any linear transformation between 3D spaces
can be represented by a 3x3 matrix
• Any linear transformation between 3D spaces
can be represented as a combination of rotation,
shear, and scaling
• Rotation can be represented as a combination
of scaling and shear
Affine Transformations
• An affine transformation T is an mapping
between affine spaces
– T maps vectors to vectors, and points to points
– T is a linear transformation on vectors
– affine combination is invariant under T
• In 3-spaces, T can be represented by a 3x3
matrix together with a 3x1 translation vector
)()()()( 1100
0
NN
N
i
ii TcTcTccT pppp
131333)( TpMpT
Homogeneous Coordinates
• Any affine transformation between 3D spaces
can be represented by a 4x4 matrix
• Affine transformation is linear in homogeneous
coordinates
110)(
131333 pTMpT
Examples of Affine Transformations
• 2D rotation
• 2D scaling
1100
0cossin
0sincos
1
y
x
y
x
yx, yx ,
11100
00
00
1
ys
xs
y
x
s
s
y
x
y
x
y
x
Examples of Affine Transformations
• 2D shear
• 2D reflection
11100
010
01
1
y
dyx
y
xd
y
x
11100
010
001
1
y
x
y
x
y
x
Examples of Affine Transformations
• 2D translation
11100
10
01
1
y
x
y
x
ty
tx
y
x
t
t
y
x
Examples of Affine Transformations
• 2D transformation for vectors
– Translation is simply ignored
00100
10
01
0
y
x
y
x
t
t
y
x
y
x
Properties of Affine Transformations
• Any affine transformation between 3D spaces can be
represented as a combination of a linear transformation
followed by translation
• An affine transf. maps lines to lines
• An affine transf. maps parallel lines to parallel lines
• An affine transf. preserves ratios of distance along a line
• An affine transf. does not preserve absolute distances
and angles
Rigid Transformations
• A rigid transformation T is a mapping between
affine spaces
– T maps vectors to vectors, and points to points
– T preserves distances between all points
– T preserves cross product for all vectors (to avoid
reflection)
• In 3-spaces, T can be represented as
1det and
where,)( 131333
RIRRRR
TpRp
TT
T
Rigid Body Rotation
• Rigid body transformations allow only rotation
and translation
• Rotation matrices form SO(3)
– Special orthogonal group
IRRRR TT
1det R
(Distance preserving)
(No reflection)
Rigid Body Rotation
• R is normalized – The squares of the elements in any row or column
sum to 1
• R is orthogonal – The dot product of any pair of rows or any pair
columns is 0
• The rows (columns) of R correspond to the vectors of the principle axes of the rotated coordinate frame
IRRRR TT
Taxonomy of Transformations
• Linear transformations – 3x3 matrix
– Rotation + scaling + shear
• Rigid transformations – SO(3) for rotation
– 3D vector for translation
• Affine transformation – 3x3 matrix + 3D vector or 4x4 homogenous matrix
– Linear transformation + translation
• Projective transformation – 4x4 matrix
– Affine transformation + perspective projection
Taxonomy of Transformations
Projective
Affine
Rigid
Kinematics
• How to animate skeletons
(articulated figures)
• Kinematics is the study of
motion without regard to
the forces that caused it
Hierarchical Models
• Tree structure of joints and links
– The root link can be chosen arbitrarily
• Joints – Revolute (hinge) joint allows rotation about a fixed axis
– Prismatic joint allows translation along a line
– Ball-and-socket joint allows rotation about an arbitrary axis
Human Joints
Forward and Inverse Kinematics
1
2
)F(),( iqp ),(F 1qp
iForward Kinematics Inverse Kinematics
1
2
Forward Kinematics: A Simple Example
• A simple robot arm in 2-dimensional space
– 2 revolute joints
– Joint angles are known
– Compute the position of the end-effector
)sin(sin
)cos(cos
21211
21211
lly
llx
e
e
2
1
1l
2l
),( ee yx
Forward Kinematics: A Simple Example
• Forward kinematics map as a coordinate transformation
– The body local coordinate system of the end-effector was initially
coincide with the global coordinate system
– Forward kinematics map transforms the position and orientation
of the end-effector according to joint angles
2
1
1l
X Y
1
0
0
1
Ty
x
e
e2l
X
Y
A Chain of Transformations
1
0
0
1
Ty
x
e
e
100
010
01
100
0cossin
0sincos
100
010
01
100
0cossin
0sincos 2
22
221
11
11
2211
ll
translrottranslrotT
2
1
1l
X Y
2l
X
Y
Thinking of Transformations
• In a view of body-attached coordinate system
100
010
01
100
0cossin
0sincos
100
010
01
100
0cossin
0sincos 2
22
221
11
11
2211
ll
translrottranslrotT
X
Y
X
Y
X
Y
Thinking of Transformations
• In a view of body-attached coordinate system
1X
Y
100
010
01
100
0cossin
0sincos
100
010
01
100
0cossin
0sincos 2
22
221
11
11
2211
ll
translrottranslrotT
Thinking of Transformations
• In a view of body-attached coordinate system
1
1LX
Y
X
Y
100
010
01
100
0cossin
0sincos
100
010
01
100
0cossin
0sincos 2
22
221
11
11
2211
ll
translrottranslrotT
2
1
1L
X
Y
Thinking of Transformations
• In a view of body-attached coordinate system
X
Y
100
010
01
100
0cossin
0sincos
100
010
01
100
0cossin
0sincos 2
22
221
11
11
2211
ll
translrottranslrotT
2
1
1L
X Y
2L
Thinking of Transformations
• In a view of body-attached coordinate system
X
Y
100
010
01
100
0cossin
0sincos
100
010
01
100
0cossin
0sincos 2
22
221
11
11
2211
ll
translrottranslrotT
Thinking of Transformations
• In a view of global coordinate system
X
Y
X
Y
100
010
01
100
0cossin
0sincos
100
010
01
100
0cossin
0sincos 2
22
221
11
11
2211
ll
translrottranslrotT
Thinking of Transformations
• In a view of global coordinate system
X
Y
2L
X
Y
100
010
01
100
0cossin
0sincos
100
010
01
100
0cossin
0sincos 2
22
221
11
11
2211
ll
translrottranslrotT
2
X Y
2L
Thinking of Transformations
• In a view of global coordinate system
X
Y
100
010
01
100
0cossin
0sincos
100
010
01
100
0cossin
0sincos 2
22
221
11
11
2211
ll
translrottranslrotT
Thinking of Transformations
• In a view of global coordinate system
21L
X Y
2L
X
Y
100
010
01
100
0cossin
0sincos
100
010
01
100
0cossin
0sincos 2
22
221
11
11
2211
ll
translrottranslrotT
Thinking of Transformations
• In a view of global coordinate system
2
1
1L
X Y
2L
X
Y
100
010
01
100
0cossin
0sincos
100
010
01
100
0cossin
0sincos 2
22
221
11
11
2211
ll
translrottranslrotT
How to Handle Ball-and-Socket Joints ?
• Three revolute joints whose axes intersect at a
point (equivalent to Euler angles), or
• 3D rotation about an arbitrary axis
1000
0100
00cossin
00sincos
1000
0cos0sin
0010
0sin0cos
1000
0cossin0
0sincos0
0001
21
zz
zz
yy
yy
xx
xx
zyx translrotrotrottranslT
Floating Base
• The position and orientation of the root segment
are added
1
2
3
221100 rottranslrottranslrottransltranslrotT rr
X
Y
Joint & Link Transformations
• Each segment has its own coordinate frame
• Forward kinematics map is an alternating multiple of
– Joint transformations : represents joint movement
– Link transformations : defines a frame relative to its parent
1L
3L
2L
3322110 JLJLJLJT
The position and orientation of
the root segment
1st link transformation
1st joint transformation
Joint & Link Transformations
• Both are rigid transformations in general
– Joint transformations may include translation
• Human joints are not ideal hinges
– Link transformations may include rotation
• Some links are twisted
Denavit-Hartenberg Notation
),(),(),(),( 11 iiiii ZRotdZTransaXTransXRotL
iiii
iiii
iiii
iiii
ZXX
ZXXd
XZZ
XZZa
about measured and between angle the
along measured to from distance the
about measured and between angle the
along measured to from distance the
1
1
1
1
Link Transformations
• How do you compute the link transform for the ith joint if
you know the position and orientation of the ith joint as
well as its parent’s position and orientation at the neutral
pose ?
1iT
iL
iT
iii
iii
TTL
TLT
1
1
1
Representing Hierarchical Models
• A tree structure
– A node contains a joint transformation
– A arc contains a link transformation
0J
1J
2J
3J
1L
2L
3L
Forward and Inverse Kinematics
1
2
)F(),( iqp ),(F 1qp
iForward Kinematics Inverse Kinematics
1
2
Why Inverse Kinematics ?
• Environmental interactions
– Pick up an object or place feet on the ground
– Hard to do with forward kinematics
• The pose of the character is described in the joint angle space
• The environmental interaction is described in the work (Cartesian)
space
Inverse Kinematics: A Simple Example
• A simple robot arm in 2-dimensional space
– Two revolute joints
– The position of the end-effector is known
– Compute joint angles
2
1
1l
2l
X
Y
),( ee yx
Analytic Solution for A Simple Example
2
1
1l
2l
X
Y
21
222
2
2
11
2
21
222
2
2
12
22
1
2
2
222
11
1
22
1
2
2
222
11
22
1
22
2cos
2)cos(
2cos
2)cos(
cos
)cos(
ll
yxll
ll
yxll
yxl
lyxl
yxl
lyxl
yx
x
yx
x
ee
ee
ee
ee
ee
ee
ee
e
ee
e
),( ee yx
Redundancy in Human Arms
Why so difficult to get a closed-form solution ?
• Redundancies – Multiple solutions (# of unknowns > # of equations)
• Joint limit – The range of each unknown is bounded
• Reachable workspace – No solution, or
– A unique solution, or
– Multiple solutions
• Multiple goals – Four limbs may have constraints simultaneously
– Intermediate links can also be constrained
Iterative Methods
• Iteratively refine joint angles to the goal
– Consider infinitesimal changes
),(from),,(compute 321 yx
),(from),,(compute 321 yx
),( yx
3
1 2
Jacobians of Forward Kinematics Map
• Forward Kinematics Map
• Jacobian
3
2
1
321
321
3
2
1
yyy
xxx
FFF
FFF
y
xJ
),,(),(),( 321 FFFyx yx ),( yx
3
1 2
Goal
Jacobian of Forward Kinematics Map
• If the inverse of the Jacobian can be computed, …
),( yx
3
1 2
Goal
t
t
ttt
y
xt
t
1
3
2
1
3
2
1
3
2
1
13
2
1
J
A System of Linear Equations
• # of unkowns = the dimension of = n
• # of equations = the dimension of x = m
• J is a (m x n) matrix
• The solution maybe unique if m=n
• The linear system is under-specified if m<n
• The linear system is over-specified if m>n
xθJ
the pseudoinverse of Jacobian
is required
Redundancy
• A single solution must be chosen from multiple solutions
– “Closest” to the current configuration
• Pseudo inverse minimizes joint angle rates (locally)
– Move outermost links the most
• The outermost link sweeps a smallest region (visual change)
– Minimum time and effort
• Dynamics involves
– Secondary goal
• Additional constraints
– Natural looking
• Biomechanical experiments
Summary
• Very simple structure allows an analytic solution
• Most of complex articulated figures requires a
numerical solution
• May not always get the “right” answer
– Need to tweak the solution later