forward and inverse kinematics cse 3541 matt boggus

49
Forward and Inverse Kinematics CSE 3541 Matt Boggus

Upload: megan-atkins

Post on 17-Dec-2015

225 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Forward and Inverse Kinematics

CSE 3541Matt Boggus

Page 2: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Hierarchical Modeling

Relative motion

Constrains motion Reduces dimensionality

Parent-child relationshipSimplifies motion specification

Page 3: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Modeling & animating hierarchies

3 aspects1. Linkages & Joints – the relationships2. Data structure – how to represent such a hierarchy3. Converting local coordinate frames into global space

Page 4: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Terms

Joint – allowed relative motion & parameters

Joint Limits – limit on valid joint angle values

Link – object involved in relative motion

Linkage – entire joint-link hierarchy

End effector – most distant link in linkage

Pose – configuration of linkage using given set of joint angles

Page 5: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Forward vs. Inverse Kinematics

Forward KinematicsInput: joint anglesOutput: link positions and orientations end effector position

Inverse KinematicsInput: end effectorOutput: joint angles

Page 6: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Joints – relative movement

Every joint allowing motion in one dimension is said to have one degree of freedom (DOF)

Example: flying (Six DOF)• x, y, and z positions (prismatic or translation)• roll, pitch, and yaw (revolute or rotation)

Page 7: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Complex Joints

Page 8: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Hierarchical structure

Page 9: Forward and Inverse Kinematics CSE 3541 Matt Boggus

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

11l

X Y

1

0

0

1

Ty

x

e

e2l

X

Y

Example from Jehee Lee

Page 10: Forward and Inverse Kinematics CSE 3541 Matt Boggus

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

11l

X Y

2l

X

Y

Page 11: Forward and Inverse Kinematics CSE 3541 Matt Boggus

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 12: Forward and Inverse Kinematics CSE 3541 Matt Boggus

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 13: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Thinking of Transformations• In a view of body-attached coordinate system

11L

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 14: Forward and Inverse Kinematics CSE 3541 Matt Boggus

2

11L

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 15: Forward and Inverse Kinematics CSE 3541 Matt Boggus

2

11L

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 16: Forward and Inverse Kinematics CSE 3541 Matt Boggus

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 17: Forward and Inverse Kinematics CSE 3541 Matt Boggus

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 18: Forward and Inverse Kinematics CSE 3541 Matt Boggus

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 19: Forward and Inverse Kinematics CSE 3541 Matt Boggus

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 20: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Thinking of Transformations• In a view of global coordinate system

2

11L

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 21: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Controlling forward kinematics

• QWOP http://www.foddy.net/Athletics.html

Page 22: Forward and Inverse Kinematics CSE 3541 Matt Boggus

IK solution uniqueness

Images from http://freespace.virgin.net/hugo.elias/models/m_ik.htm

Zero One

Two Many

Page 23: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Inverse kinematics

Given goal position for end effectorCompute internal joint angles

Simple linkages analytic solutionOtherwise numeric iterative solution

Page 24: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Inverse kinematics – spaces

Configuration spaceReachable workspace

Page 25: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Analytic Inverse Kinematics

• Given target position (X,Y)– Compute angle with

respect to origin of linkage– Solve for angle of rotation

for each joint

• See reference text for solution and derivation

Page 26: Forward and Inverse Kinematics CSE 3541 Matt Boggus

IK - numeric

Remember: a pose is the position and orientation of all links for given a set of joint angles

- Compute the desired change from this poseVector to the goal, orMinimal distance between end effector and goal

- Compute set of changes to joint angles to make that change

Solve iteratively – numerically solve for step toward goal

Page 27: Forward and Inverse Kinematics CSE 3541 Matt Boggus

IK math notation

),,,,,(

),,,,,(

),,,,,(

),,,,,(

),,,,,(

),,,,,(

65432166

65432155

65432144

65432133

65432122

65432111

xxxxxxfy

xxxxxxfy

xxxxxxfy

xxxxxxfy

xxxxxxfy

xxxxxxfy

XFY

Given the values for each xi, we can compute each yi

Page 28: Forward and Inverse Kinematics CSE 3541 Matt Boggus

IK – chain rule

dt

x

x

f

dt

x

x

f

dt

x

x

f

dt

x

x

f

dt

x

x

f

dt

dx

x

f

dt

dy iiiiiii 6

6

5

5

4

4

3

3

2

2

1

1

XX

FY

The change in output variables (y) relative to the change in input variables (x)

Page 29: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Inverse Kinematics - Jacobian

JV Desired motion of end effector

Unknown change in articulation variables

The Jacobian is the matrix relating the two: describing how each coordinate changes with respect to each joint angle in our system

XX

FY

Page 30: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Inverse Kinematics - Jacobian

JV zyxzyx vvvV ,,,,, 654321 ,,,,,

61

1

621

zz

y

xxx

p

ppp

J

Change in position

Change in orientation

Jacobian

Change in articulation variables

Page 31: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Solving

VJ

JJJJVJJJ

JJVJ

JV

TTTT

TT

11

If J is not square, use of pseudo-inverse of JacobianIf J square, compute inverse, J-1

VJ

JV1

Page 32: Forward and Inverse Kinematics CSE 3541 Matt Boggus

IK – compute positional change vectors induced by changes in joint angles

Instantaneous positional change vectors

Desired change vector

One approach to IK computes linear combination of change vectors that equal desired vector

Page 33: Forward and Inverse Kinematics CSE 3541 Matt Boggus

IK - singularity

Some singular configurations are not so easily recognizable

Page 34: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Inverse Kinematics - Numeric

Given • Current configuration• Goal position

Determine • Goal vector• Positions & local coordinate systems of interior joints (in global coordinates)

Solve for change in joint angles & take small step – or clamp acceleration or clamp velocity

Repeat until:• Within epsilon of goal• Stuck in some configuration• Taking too long

Page 35: Forward and Inverse Kinematics CSE 3541 Matt Boggus

IK – cyclic coordinate descent

Consider one joint at a time, from outside inAt each joint, choose update that best gets end effector to goal position

In 2D – pretty simple

Heuristic solution

EndEffector

Goal

Ji

axisi

Page 36: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Cyclic-Coordinate Descent- Starting with the root of our effector, R, to our current endpoint, E.- Next, we draw a vector from R to our desired endpoint, D- The inverse cosine of the dot product gives us the angle between the vectors: cos(a) = RD ● RE

Page 37: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Cyclic-Coordinate DescentRotate our link so that RE falls on RD

Page 38: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Cyclic-Coordinate DescentMove one link up the chain, and repeat the process

Page 39: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Cyclic-Coordinate DescentThe process is basically repeated until the root joint is reached. Then the process begins all over again starting with the end effector, and will continue until we are close enough to D for an acceptable solution.

Page 40: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Cyclic-Coordinate Descent

Page 41: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Cyclic-Coordinate DescentWe’ve reached the root. Repeat the process

Page 42: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Cyclic-Coordinate Descent

Page 43: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Cyclic-Coordinate Descent

Page 44: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Cyclic-Coordinate Descent

Page 45: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Cyclic-Coordinate Descent

Page 46: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Cyclic-Coordinate Descent

Page 47: Forward and Inverse Kinematics CSE 3541 Matt Boggus

Cyclic-Coordinate DescentWe’ve reached the root again. Repeat the process until solution reached.

Page 48: Forward and Inverse Kinematics CSE 3541 Matt Boggus

IK – cyclic coordinate descent

Other orderings of processing joints are possible

Because of its procedural nature• Lends itself to enforcing joint limits• Easy to clamp angular velocity

Page 49: Forward and Inverse Kinematics CSE 3541 Matt Boggus

IK – 3D cyclic coordinate descent

First – goal has to be projected onto plane defined by axis (normal to plane) and EF

EndEffector

Goal

Ji

axisi

Projected goal

Second– determine angle at joint