Transcript
Page 1: CPSC 441:  Forward kinematics and inverse kinematics

CPSC 441: Forward kinematics and inverse

kinematicsJinxiang Chai

Page 2: CPSC 441:  Forward kinematics and inverse kinematics

Outline

Kinematics– Forward kinematics– Inverse kinematics

Page 3: CPSC 441:  Forward kinematics and inverse kinematics

Kinematics

The study of movement without the consideration of the masses or forces that bring about the motion

Page 4: CPSC 441:  Forward kinematics and inverse kinematics

Degrees of freedom (Dofs)

The set of independent displacements that specify an object’s pose

Page 5: CPSC 441:  Forward kinematics and inverse kinematics

Degrees of freedom (Dofs)

The set of independent displacements that specify an object’s pose

• How many degrees of freedom when flying?

Page 6: CPSC 441:  Forward kinematics and inverse kinematics

Degrees of freedom (Dofs)

The set of independent displacements that specify an object’s pose

• How many degrees of freedom when flying?

• So the kinematics of this airplane permit movement anywhere in three dimensions

• Six• x, y, and z positions• roll, pitch, and yaw

Page 7: CPSC 441:  Forward kinematics and inverse kinematics

Degrees of Freedom

• How about this robot arm?

• Six again

• 2-base, 1-shoulder, 1-elbow, 2-wrist

Page 8: CPSC 441:  Forward kinematics and inverse kinematics

Work Space vs. Configuration Space

• Work space– The space in which the object exists– Dimensionality

• R3 for most things, R2 for planar arms

• Configuration space– The space that defines the possible object

configurations– Degrees of Freedom

• The number of parameters that are necessary and sufficient to define position in configuration

Page 9: CPSC 441:  Forward kinematics and inverse kinematics

Forward vs. Inverse Kinematics

• Forward Kinematics– Compute configuration (pose) given individual

DOF values

• Inverse Kinematics– Compute individual DOF values that result in

specified end effector position

Page 10: CPSC 441:  Forward kinematics and inverse kinematics

Example: Two-link Structure

• Two links connected by rotational joints

BaseEnd Effector

θ2

θ1 X=(x,y)

l2l1

Page 11: CPSC 441:  Forward kinematics and inverse kinematics

Example: Two-link Structure

• Animator specifies the joint angles: θ1θ2

• Computer finds the position of end-effector: x

BaseEnd Effector

θ2

θ1

x=f(θ1, θ2)

l2l1

(0,0)

X=(x,y)

Page 12: CPSC 441:  Forward kinematics and inverse kinematics

Example: Two-link Structure

• Animator specifies the joint angles: θ1θ2

• Computer finds the position of end-effector: x

BaseEnd Effector

θ2

θ1

x = (l1cosθ1+l2cos(θ2+ θ2)

y = l1sinθ1+l2sin(θ2+ θ2))

(0,0)

θ2 l2l1

X=(x,y)

Page 13: CPSC 441:  Forward kinematics and inverse kinematics

Forward kinematics

BaseEnd Effector

θ2

θ1

(0,0)

θ2 l2l1

• Create an animation by specifying the joint angle trajectories

θ1

θ2

X=(x,y)

Page 14: CPSC 441:  Forward kinematics and inverse kinematics

Inverse kinematics

• What if an animator specifies position of end-effector?

Base

End Effector

θ2

θ1

(0,0)

θ2 l2l1

X=(x,y)

Page 15: CPSC 441:  Forward kinematics and inverse kinematics

Inverse kinematics

• Animator specifies the position of end-effector: x

• Computer finds joint angles: θ1θ2

Base

End Effector

θ2

θ1

(0,0)

θ2 l2l1

(θ1, θ2)=f-1(x)

X=(x,y)

Page 16: CPSC 441:  Forward kinematics and inverse kinematics

Inverse kinematics

• Animator specifies the position of end-effector: x

• Computer finds joint angles: θ1θ2

Base

End Effector

θ2

θ1

(0,0)

θ2 l2l1

X=(x,y)

Page 17: CPSC 441:  Forward kinematics and inverse kinematics

Why Inverse Kinematics?

• Basic tools in character animation - key frame generation

- animation control - interactive manipulation

• Computer vision (vision based mocap)• Robotics• Bioninfomatics (Protein Inverse Kinematics)

Page 18: CPSC 441:  Forward kinematics and inverse kinematics

Inverse kinematics

• Given end effector position, compute required joint angles

• In simple case, analytic solution exists– Use trig, geometry, and algebra to solve

Page 19: CPSC 441:  Forward kinematics and inverse kinematics

Inverse kinematics

• Analytical solution only works for a fairly simple structure

• Iterative approach needed for a complex structure

Page 20: CPSC 441:  Forward kinematics and inverse kinematics

Iterative approach

• Inverse kinematics can be formulated as an optimization problem

Page 21: CPSC 441:  Forward kinematics and inverse kinematics

Iterative approaches

Find the joint angles θ that minimizes the distance between the character position and user specified position

Base

θ2

θ1

(0,0)

θ2 l2l1

C=(Cx,Cy)

i

ii Cf 2)(minarg

Page 22: CPSC 441:  Forward kinematics and inverse kinematics

Iterative approaches

Find the joint angles θ that minimizes the distance between the character position and user specified position

Base

θ2

θ1

(0,0)

θ2 l2l1

C=(c1,c2)

2221211

2121211

,))sin(sin())cos(cos(minarg

21

cllcll

Page 23: CPSC 441:  Forward kinematics and inverse kinematics

Iterative approach

Mathematically, we can formulate this as an optimization problem:

The above problem can be solved by many nonlinear optimization algorithms:

- Steepest descent

- Gauss-newton

- Levenberg-marquardt, etc

i

ii cf 2)(minarg

Page 24: CPSC 441:  Forward kinematics and inverse kinematics

Gauss-newton approach

Step 1: initialize the joint angles with

Step 2: update the joint angles:

0

kkk 1

Page 25: CPSC 441:  Forward kinematics and inverse kinematics

Gauss-newton approach

Step 1: initialize the joint angles with

Step 2: update the joint angles:

0

kkk 1

How can we decide the amount of update?

Page 26: CPSC 441:  Forward kinematics and inverse kinematics

Gauss-newton approach

Step 1: initialize the joint angles with

Step 2: update the joint angles:

ii

kki cf

2)(minarg

0

kkk 1

Page 27: CPSC 441:  Forward kinematics and inverse kinematics

Gauss-newton approach

Step 1: initialize the joint angles with

Step 2: update the joint angles:

ii

kki cf

2)(minarg

0

kkk 1

Known!

Page 28: CPSC 441:  Forward kinematics and inverse kinematics

Gauss-newton approach

Step 1: initialize the joint angles with

Step 2: update the joint angles:

ii

kki cf

2)(minarg

0

kkk 1

Taylor series expansion

Page 29: CPSC 441:  Forward kinematics and inverse kinematics

Gauss-newton approach

Step 1: initialize the joint angles with

Step 2: update the joint angles:

ii

kki cf

2)(minarg

2

)(minarg

ii

kkik

i cf

f

0

kkk 1

Taylor series expansion

rearrange

Page 30: CPSC 441:  Forward kinematics and inverse kinematics

Gauss-newton approach

Step 1: initialize the joint angles with

Step 2: update the joint angles:

ii

kki cf

2)(minarg

2

)(minarg

ii

kkik

i cf

f

0

kkk 1

Taylor series expansion

rearrange

Can you solve this optimization problem?

Page 31: CPSC 441:  Forward kinematics and inverse kinematics

Gauss-newton approach

Step 1: initialize the joint angles with

Step 2: update the joint angles:

ii

kki cf

2)(minarg

2

)(minarg

ii

kkik

i cf

f

2

))((minarg

i

kii

kki fcf

0

kkk 1

Taylor series expansion

rearrange

This is a quadratic function of

Page 32: CPSC 441:  Forward kinematics and inverse kinematics

Gauss-newton approach

• Optimizing an quadratic function is easy

• It has an optimal value when the gradient is zero

),...,(

),...,(

),...,(

...

...

1

122

11

2

1

2

2

2

2

1

2

1

2

1

1

1

NiN

N

Ni

N

N

MM

N

M

N

N

fc

fc

fc

fff

fff

fff

2

))((minarg

i

kii

kki fcf

Page 33: CPSC 441:  Forward kinematics and inverse kinematics

Gauss-newton approach

• Optimizing an quadratic function is easy

• It has an optimal value when the gradient is zero

),...,(

),...,(

),...,(

...

...

1

122

11

2

1

2

2

2

2

1

2

1

2

1

1

1

NiN

N

Ni

N

N

MM

N

M

N

N

fc

fc

fc

fff

fff

fff

2

))((minarg

i

kii

kki fcf

bJ Δθ

Linear equation!

Page 34: CPSC 441:  Forward kinematics and inverse kinematics

Gauss-newton approach

• Optimizing an quadratic function is easy

• It has an optimal value when the gradient is zero

),...,(

),...,(

),...,(

...

...

1

122

11

2

1

2

2

2

2

1

2

1

2

1

1

1

NiN

N

Ni

N

N

MM

N

M

N

N

fc

fc

fc

fff

fff

fff

2

))((minarg

i

kii

kki fcf

bJ Δθ

Page 35: CPSC 441:  Forward kinematics and inverse kinematics

Gauss-newton approach

• Optimizing an quadratic function is easy

• It has an optimal value when the gradient is zero

),...,(

),...,(

),...,(

...

...

1

122

11

2

1

2

2

2

2

1

2

1

2

1

1

1

NiN

N

Ni

N

N

MM

N

M

N

N

fc

fc

fc

fff

fff

fff

2

))((minarg

i

kii

kki fcf

bJ Δθ

bJJJ TT 1)(

Page 36: CPSC 441:  Forward kinematics and inverse kinematics

Jacobian matrix

• Jacobian is a M by N matrix that relates differential changes of θ to changes of C

• Jacobian maps the velocity in joint space to velocities in Cartesian space

• Jacobian depends on current state

N

MMM

N

N

fff

fff

fff

21

2

2

2

1

2

1

2

1

1

1

...

...

Dofs (N)

The

num

ber

of c

onst

rain

ts (

M)

Page 37: CPSC 441:  Forward kinematics and inverse kinematics

Jacobian matrix

• Jacobian maps the velocity in joint angle space to velocities in Cartesian space

(x,y)

θ1

θ2

Page 38: CPSC 441:  Forward kinematics and inverse kinematics

Jacobian matrix

• Jacobian maps the velocity in joint angle space to velocities in Cartesian space

(x,y)

θ1

θ2

A small change of θ1 and θ2 results in how much change of end-effector position (x,y)

Page 39: CPSC 441:  Forward kinematics and inverse kinematics

Jacobian matrix

• Jacobian maps the velocity in joint angle space to velocities in Cartesian space

2

1

2

1

1

2

2

1

1

1

ff

ff

y

x

(x,y)

θ1

θ2

A small change of θ1 and θ2 results in how much change of end-effector position (x,y)

Page 40: CPSC 441:  Forward kinematics and inverse kinematics

Jacobian matrix: 2D-link structure

2221211

2121211

,))sin(sin())cos(cos(minarg

21

cllcll

Base

θ2

θ1

(0,0)

θ2 l2l1

C=(c1,c2)

Page 41: CPSC 441:  Forward kinematics and inverse kinematics

Jacobian matrix: 2D-link structure

2221211

2121211

,))sin(sin())cos(cos(minarg

21

cllcll

Base

θ2

θ1

(0,0)

θ2 l2l1

C=(c1,c2)

f1f2

Page 42: CPSC 441:  Forward kinematics and inverse kinematics

Jacobian matrix: 2D-link structure

2221211

2121211

,))sin(sin())cos(cos(minarg

21

cllcll

)sin(sin

)cos(cos

212112

212111

llf

llf

Base

θ2

θ1

(0,0)

θ2 l2l1

C=(c1,c2)

N

MMM

N

N

fff

fff

fff

21

2

2

2

1

2

1

2

1

1

1

...

...

Page 43: CPSC 441:  Forward kinematics and inverse kinematics

Jacobian matrix: 2D-link structure

2221211

2121211

,))sin(sin())cos(cos(minarg

21

cllcll

)cos()cos(cos

)sin()sin(sin

21221211

21221211

lll

lllJ

Base

θ2

θ1

(0,0)

θ2 l2l1

C=(c1,c2)

Page 44: CPSC 441:  Forward kinematics and inverse kinematics

Jacobian matrix: 2D-link structure

2221211

2121211

,))sin(sin())cos(cos(minarg

21

cllcll

)cos()cos(cos

)sin()sin(sin

21221211

21221211

lll

lllJ

Base

θ2

θ1

(0,0)

θ2 l2l1

C=(c1,c2)

Page 45: CPSC 441:  Forward kinematics and inverse kinematics

Jacobian matrix: 2D-link structure

2221211

2121211

,))sin(sin())cos(cos(minarg

21

cllcll

)cos()cos(cos

)sin()sin(sin

21221211

21221211

lll

lllJ

Base

θ2

θ1

(0,0)

θ2 l2l1

C=(c1,c2)

1

21211

1

1 ))cos(cos(

llf

Page 46: CPSC 441:  Forward kinematics and inverse kinematics

Jacobian matrix: 2D-link structure

2221211

2121211

,))sin(sin())cos(cos(minarg

21

cllcll

)cos()cos(cos

)sin()sin(sin

21221211

21221211

lll

lllJ

Base

θ2

θ1

(0,0)

θ2 l2l1

C=(c1,c2)

2

21211

2

2 ))sin(sin(

llf

Page 47: CPSC 441:  Forward kinematics and inverse kinematics

Gauss-newton approach

Step 1: initialize the joint angles with

Step 2: update the joint angles:

0

kkk 1

Step size: specified by the user

Page 48: CPSC 441:  Forward kinematics and inverse kinematics

Another Example

• A 2D lamp with 6 degrees of freedom

1

2

3

3c

2c

1c

0p

),,( 0yx0c

base

Upper arm

lower arm

middle arm

How to compute forward kinematics?

Page 49: CPSC 441:  Forward kinematics and inverse kinematics

Another Example

• A 2D lamp with 6 degrees of freedom

1

2

3

3c

2c

1c

0p

03221100 )()0,()()0,()(),0()(),( pRlTRlTRlTRyxTp ),,( 0yx0c

base

Upper arm

lower arm

middle arm

Page 50: CPSC 441:  Forward kinematics and inverse kinematics

Another Example

• A 2D lamp with 6 degrees of freedom

1

2

3

3c

2c

1c

0p

03221100 )()0,()()0,()(),0()(),( pRlTRlTRlTRyxTp ),,( 0yx0c

base

Page 51: CPSC 441:  Forward kinematics and inverse kinematics

Another Example

• A 2D lamp with 6 degrees of freedom

1

2

3

3c

2c

1c

0p

03221100 )()0,()()0,()(),0()(),( pRlTRlTRlTRyxTp ),,( 0yx0c

base

Upper arm

Page 52: CPSC 441:  Forward kinematics and inverse kinematics

Another Example

• A 2D lamp with 6 degrees of freedom

1

2

3

3c

2c

1c

0p

03221100 )()0,()()0,()(),0()(),( pRlTRlTRlTRyxTp ),,( 0yx0c

base

Upper arm

middle arm

Page 53: CPSC 441:  Forward kinematics and inverse kinematics

Another Example

• A 2D lamp with 6 degrees of freedom

1

2

3

3c

2c

1c

0p

03221100 )()0,()()0,()(),0()(),( pRlTRlTRlTRyxTp ),,( 0yx0c

base

Upper arm

lower arm

middle arm

Page 54: CPSC 441:  Forward kinematics and inverse kinematics

More Complex Characters?

• A 2D lamp with 6 degrees of freedom

1

2

3

3c

2c

1c

0p

032211003210 )()0,()()0,()(),0()(),(),,,,,( pRlTRlTRlTRyxTyxf ),,( 0yx0c

base

Upper arm

lower arm

middle arm

Page 55: CPSC 441:  Forward kinematics and inverse kinematics

More Complex Characters?

• A 2D lamp with 6 degrees of freedom

1

2

3

3c

2c

1c

0p

032211003210 )()0,()()0,()(),0()(),(),,,,,( pRlTRlTRlTRyxTyxf ),,( 0yx0c

base

Upper arm

lower arm

middle arm

If you do inverse kinematics with position of this point

What’s the size of Jacobian matrix?

Page 56: CPSC 441:  Forward kinematics and inverse kinematics

More Complex Characters?

• A 2D lamp with 6 degrees of freedom

1

2

3

3c

2c

1c

0p

032211003210 )()0,()()0,()(),0()(),(),,,,,( pRlTRlTRlTRyxTyxf ),,( 0yx0c

base

Upper arm

lower arm

middle arm

If you do inverse kinematics with position of this point

What’s the size of Jacobian matrix?

2-by-6 matrix

Page 57: CPSC 441:  Forward kinematics and inverse kinematics

Human Characters

xRRTRTRRRTRRRzyxTf )()()()()()()()()(),,( 332

321

21110

1000000 57

Page 58: CPSC 441:  Forward kinematics and inverse kinematics

Inverse kinematics

• Analytical solution only works for a fairly simple structure

• Iterative approach needed for a complex structure

Page 59: CPSC 441:  Forward kinematics and inverse kinematics

Inverse kinematics

• Is the solution unique?

• Is there always a good solution?

Page 60: CPSC 441:  Forward kinematics and inverse kinematics

Ambiguity of IK

• Multiple solutions

Page 61: CPSC 441:  Forward kinematics and inverse kinematics

Ambiguity of IK

• Infinite solutions

Page 62: CPSC 441:  Forward kinematics and inverse kinematics

Failures of IK

• Solution may not exist

Page 63: CPSC 441:  Forward kinematics and inverse kinematics

Inverse kinematics

• Generally ill-posed problem when the Dofs is higher than the number of constraints

Page 64: CPSC 441:  Forward kinematics and inverse kinematics

Inverse kinematics

• Generally ill-posed problem when the Dofs is higher than the number of constraints

• Additional objective– Minimal Change from a reference pose θ0

Page 65: CPSC 441:  Forward kinematics and inverse kinematics

Inverse kinematics

• Generally ill-posed problem when the Dofs is higher than the number of constraints

• Additional objective– Minimal Change from a reference pose θ0

2

0

2)(minarg

iii cf

Page 66: CPSC 441:  Forward kinematics and inverse kinematics

Inverse kinematics

• Generally ill-posed problem when the Dofs is higher than the number of constraints

• Additional objective– Minimal Change from a reference pose θ0

2

0

2)(minarg

iii cf

Satisfy the constraints Minimize the difference between the solution and a reference pose

Page 67: CPSC 441:  Forward kinematics and inverse kinematics

Inverse kinematics

• Generally ill-posed problem when the Dofs is higher than the number of constraints

• Additional objective– Minimal Change from a reference pose θ0

– Naturalness g(θ) (particularly for human characters)

Page 68: CPSC 441:  Forward kinematics and inverse kinematics

Inverse kinematics

• Generally ill-posed problem when the Dofs is higher than the number of constraints

• Additional objective– Minimal Change from a reference pose θ0

– Naturalness g(θ) (particularly for human characters)

)()(minarg2

gcf

iii

Page 69: CPSC 441:  Forward kinematics and inverse kinematics

Inverse kinematics

• Generally ill-posed problem when the Dofs is higher than the number of constraints

• Additional objective– Minimal Change from a reference pose θ0

– Naturalness g(θ) (particularly for human characters)

)()(minarg2

gcf

iii

Satisfy the constraints How natural is the solution pose?

Page 70: CPSC 441:  Forward kinematics and inverse kinematics

Interactive Human Character Posing

• video


Recommended