28
3D Kinematics Consists of two parts 3D rotation 3D translation The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis) Next, we will focus on the spatial (3D) rotation 2D (rigid body) kinematics C.M. translation and rotation Fall 2012 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 z- axis)

Embed Size (px)

Citation preview

Page 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 z- axis)

3D Kinematics

Consists of two parts 3D rotation 3D translation

The same as 2D

3D rotation is more complicated than 2D rotation (restricted to z-axis)Next, we will focus on the spatial (3D) rotation

2D (rigid body) kinematicsC.M. translation and rotation

Fall 2012 1

Page 2: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

3D Rotation Representations

Euler anglesAxis-angle3X3 rotation matrixUnit quaternion

Learning Objectives Representation

(uniqueness) Perform rotation Composition Interpolation Conversion among

representations …

Fall 2012 2

Page 3: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Euler Angles

Specify orientation in rotation along 3 axesVariation: which axes? global or local?

Fall 2012 3

Page 4: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Write a program …

From Mason’s book

Fall 2012 4

Page 5: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Euler AnglesRoll, pitch, yaw

Ref: http://www.fho-emden.de/~hoffmann/gimbal09082002.pdf

Gimbal lock: reduced DOF due to overlapping axes

Why gimbal lock a problem?

Fall 2012 5

Page 6: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Axis-Angle Representation

Rot(n,) n: rotation axis (global) : rotation angle (rad. or deg.) follow right-handed rule

Rot(n,)=Rot (-n,-)Problem with null rotation: rot(n,0), any nPerform rotation Rodrigues formula

Interpolation/Composition: poor Rot(n2,2)Rot(n1,1) =?= Rot(n3,3)

Fall 2012 6

Page 7: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Rodrigues Formula

v’=R v

r

v

v’

References:

http://mesh.caltech.edu/ee148/notes/rotations.pdf

http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/as5/rotation.htmlFall 2012 7

Page 8: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Rotation Matrix

Meaning of three columnsPerform rotation: linear algebraComposition: trivial orthogonalization

might be required due to FP errors

Interpolation: ?

Ax

uAxuAxuAx

uxuxuxx

uuuaA ij

ˆˆˆ

ˆˆˆ

ˆˆˆ

332211

332211

321

xRRxRRxRx

xRx

12122

1

Fall 2012 8

Page 9: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Gram-Schmidt Orthogonalization

If 3x3 rotation matrix no longer orthonormal, metric properties might change!

321321 ˆˆˆˆˆˆ vvvuuu

222

231

11

1333

111

1222

11

ˆˆˆ

ˆˆˆ

ˆˆ

ˆˆˆˆ

ˆˆˆ

ˆˆˆˆ

ˆˆ

vvv

vuv

vv

vuuv

vvv

vuuv

uv

Verify!

Fall 2012 9

Page 10: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Quaternion

A mathematical entity invented by HamiltonDefinition

jikki

ikjjk

kjiij

kji

qqkqjqiqqq

1222

03210

i

j k

Fall 2012 10

Page 11: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Quaternion (cont)

Operators Addition

Multiplication

Conjugate

Length

kqpjqpiqpqpqp

kqjqiqqq

kpjpippp

33221100

3210

3210

qpqppqqpqppq 0000

qqq 0

* *** pqpq

23

22

21

20

* qqqqqqq Fall 2012 11

Page 12: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Unit Quaternion

Define unit quaternion as follows to represent rotation

Example Rot(z,90°)

q and –q represent the same rotation

nqn ˆsincos),ˆ(Rot 22 1q

22

22 00q

Why “unit”?

DOF point of view!

Fall 2012 12

Page 13: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

quaternion→axis-angle

Fall 2012 13

22

22 00 q

),ˆ(Rot,,,

ˆsincos),ˆ(Rot

3210

22

nqqqq

nqn

2

42

22

2

22

2

cos

sin

1,0,0

n

2

42

22

2

22

2

cos

sin

1,0,0

n

22

22 00 q

225

42

22

2

22

2

2

cos

sin

1,0,0

n

223

42

22

2

22

2

2

cos

sin

1,0,0

n

Use both values of sine and cosine to determine the

angle!!

Page 14: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Ex: q and –q are the same!

Fall 2012 14

60,30,cos,sin,1,0,0ˆ

00

223

221

2

21

23

n

q

60301802,30180,cos,sin,1,0,0ˆ

00

223

221

2

21

23

n

q

Page 15: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Example

x

y

z

x

y

z

22

22 00q

100

001

010

Rot (90, 0,0,1) OR Rot (-90,0,0,-1)

Fall 2012 15

Page 16: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Unit Quaternion (cont)

Perform Rotation

Composition

Interpolation Linear Spherical linear

)(22)(

...

020

*

xqqxqqxqqq

qxqx

****

*

)()( qpxqpqpxpqqxqx

pxpx

)(

)(,)1()( 21

tp

tpptppttp

Fall 2012 16

Page 17: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Example

x

y,x’

z,z’

y’

1

2

1

1

1

2

100

001

010

100

001

010

Rpp

R

Rot(z,90°)Rot(z,90°)

p(2,1,1)

Fall 2012 17

Page 18: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Example (cont)

1

2

1

1

0

0

0

2

1

)(0

0

2

112

002

1

1

2

)(

)(22)(

22

22

22

22

21

21

020

kji

pqqpqqpqqqp

2

222 00

1120

q

p

Fall 2012 18

Page 19: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Example

x

y,x’

z,z’

y’

)00()001(sincos

)00()100(sincos

22

22

290

290

2

22

22

290

290

1

q

q

x,x’

y

z,y’z’

)(

)00()00(

00

00

)00()00(

)00)(00(

:nCompositio

21

21

21

21

22

22

22

22

22

22

22

22

22

22

22

22

22

22

12

kji

qq

Fall 2012 19

Page 20: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Matrix Conversion

23

22

21

2010322031

103223

22

21

203021

2031302123

22

21

20

)(2)(2

)(2)(2

)(2)(2

qqqqqqqqqqqq

qqqqqqqqqqqq

qqqqqqqqqqqq

R

100

001

010

00 22

22

3210

R

qqqqq

Fall 2012 20

Page 21: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Matrix Conversion (cont)

33221123

33221122

33221121

33221120

14

1

14

1

14

1

14

1

rrrq

rrrq

rrrq

rrrq

32234

132

311341

31

211241

21

122141

30

311341

20

233241

10

rrqq

rrqq

rrqq

rrqq

rrqq

rrqq

Find largest qi2; solve the rest

Fall 2012 21

Page 22: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Slerp (Spherical Linear Interpolation)

33221100cos

sin

sin

sin

)1(sin)(

rqrqrqrq

rt

qt

ts

The computed rotation quaternion rotates about a fixed axis at constant speed

References:http://www.gamedev.net/reference/articles/article1095.asphttp://www.diku.dk/research-groups/image/teaching/Studentprojects/Quaternion/http://www.sjbrown.co.uk/quaternions.htmlhttp://www.theory.org/software/qfa/writeup/node12.html

q

r

unit sphere in R4

Fall 2012 22

Page 23: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Spatial Displacement

Any displacement can be decomposed into a rotation followed by a translationMatrix

Quaternion

TxxdR

Tz

y

x

x

dRxx

10

,

1

dqxqx *

Fall 2012 23

Page 24: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Write a program …

From Mason’s book

Fall 2012 24

Page 25: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

y

z

x

x’’’

y’’’

z’’’

Fall 2012 25

Page 26: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

Fall 2012 26

Page 27: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

From previous page

Fall 2012 27

3323131 ,sincostan rrr

Page 28: 3D Kinematics Consists of two parts 3D rotation 3D translation  The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z- axis)

From Lee and Koh (1995)

Euler angles in ASF

In v’=Mv convention

Fall 2012 28

,,,,,, xRotyRotzRotzRotyRotxRot

,,

,,,,,,

xRotzRot

zRotzRotxRotzRotzRotxRot