Transformations and Kinematics

55
Transformations and Kinematics Jehee Lee Seoul National University

Transcript of Transformations and Kinematics

Page 1: Transformations and Kinematics

Transformations and

Kinematics

Jehee Lee

Seoul National University

Page 2: Transformations and Kinematics

Transformations

• Linear transformations

• Rigid transformations

• Affine transformations

• Projective transformations

T

Global reference frame

Local moving frame

Page 3: Transformations and Kinematics

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

Page 4: Transformations and Kinematics

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 ,

Page 5: Transformations and Kinematics

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

Page 6: Transformations and Kinematics

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

Page 7: Transformations and Kinematics

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

Page 8: Transformations and Kinematics

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

Page 9: Transformations and Kinematics

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

Page 10: Transformations and Kinematics

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

Page 11: Transformations and Kinematics

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

Page 12: Transformations and Kinematics

Examples of Affine Transformations

• 2D translation

11100

10

01

1

y

x

y

x

ty

tx

y

x

t

t

y

x

Page 13: Transformations and Kinematics

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

Page 14: Transformations and Kinematics

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

Page 15: Transformations and Kinematics

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

Page 16: Transformations and Kinematics

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)

Page 17: Transformations and Kinematics

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

Page 18: Transformations and Kinematics

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

Page 19: Transformations and Kinematics

Taxonomy of Transformations

Projective

Affine

Rigid

Page 20: Transformations and Kinematics

Kinematics

• How to animate skeletons

(articulated figures)

• Kinematics is the study of

motion without regard to

the forces that caused it

Page 21: Transformations and Kinematics

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

Page 22: Transformations and Kinematics

Human Joints

Page 23: Transformations and Kinematics

Forward and Inverse Kinematics

1

2

)F(),( iqp ),(F 1qp

iForward Kinematics Inverse Kinematics

1

2

Page 24: Transformations and Kinematics

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

Page 25: Transformations and Kinematics

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

Page 26: Transformations and Kinematics

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

Page 27: Transformations and Kinematics

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

Page 28: Transformations and Kinematics

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

Page 29: Transformations and Kinematics

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

Page 30: Transformations and Kinematics

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

Page 31: Transformations and Kinematics

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

Page 32: Transformations and Kinematics

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

Page 33: Transformations and Kinematics

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

Page 34: Transformations and Kinematics

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

Page 35: Transformations and Kinematics

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

Page 36: Transformations and Kinematics

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

Page 37: Transformations and Kinematics

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

Page 38: Transformations and Kinematics

Floating Base

• The position and orientation of the root segment

are added

1

2

3

221100 rottranslrottranslrottransltranslrotT rr

X

Y

Page 39: Transformations and Kinematics

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

Page 40: Transformations and Kinematics

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

Page 41: Transformations and Kinematics

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

Page 42: Transformations and Kinematics

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

Page 43: Transformations and Kinematics

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

Page 44: Transformations and Kinematics

Forward and Inverse Kinematics

1

2

)F(),( iqp ),(F 1qp

iForward Kinematics Inverse Kinematics

1

2

Page 45: Transformations and Kinematics

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

Page 46: Transformations and Kinematics

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

Page 47: Transformations and Kinematics

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

Page 48: Transformations and Kinematics

Redundancy in Human Arms

Page 49: Transformations and Kinematics

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

Page 50: Transformations and Kinematics

Iterative Methods

• Iteratively refine joint angles to the goal

– Consider infinitesimal changes

),(from),,(compute 321 yx

),(from),,(compute 321 yx

),( yx

3

1 2

Page 51: Transformations and Kinematics

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

Page 52: Transformations and Kinematics

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

Page 53: Transformations and Kinematics

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

Page 54: Transformations and Kinematics

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

Page 55: Transformations and Kinematics

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