Inverse kinema tics - University of Southern Californiacsci520/slides/InverseKin.pdf · Inverse...

7
Inverse kinematics Kinematics The study of motion without regard to the forces that cause it Forward kinematics Given a joint configuration, what is the position of an end point on the structure? Inverse kinematics Given the position for an end point on the structure, what angles do the joints need to be to achieve that end point? Kinematics p θ φ σ θ, φ, σ = f (p) p θ φ σ p = f (θ, φ, σ) Which function is inverse kinematics? Why inverse? Specify fewer degrees of freedom (DOFs) More intuitive control Maintain environment constraints Calculate desired joint angles for control

Transcript of Inverse kinema tics - University of Southern Californiacsci520/slides/InverseKin.pdf · Inverse...

Page 1: Inverse kinema tics - University of Southern Californiacsci520/slides/InverseKin.pdf · Inverse kinema tics Kinema tics The study of motion without r egar d to the for ces that cause

Inverse kinematics

Kinematics

The study of motion without regard to the forces that cause it

Forward kinematics

Given a joint configuration, what is the position of an end point on the structure?

Inverse kinematics

Given the position for an end point on the structure, what angles do the joints need to be to achieve that end point?

Kinematics

p

!

!

!

!, ", # = f(p)

p

!

!

!

p = f(!, ", #)

Which function is inverse kinematics?

Why inverse?

Specify fewer degrees of freedom (DOFs)

More intuitive control

Maintain environment constraints

Calculate desired joint angles for control

Page 2: Inverse kinema tics - University of Southern Californiacsci520/slides/InverseKin.pdf · Inverse kinema tics Kinema tics The study of motion without r egar d to the for ces that cause

An interactive IK system

Create a handle on the character

Interactively pull the handle around

IK system figures out the appropriate the joint configurations

Joint configurations

q = x, y, z, !pelvis, "pelvis, #pelvis, !thigh, "thigh, #thigh, !knee, . . .

!pelvis,"pelvis,#pelvis

!thigh,"thigh,#thigh

!knee

!ankle,"ankle

Constraints

Position constraint

Orientation constraint

C(q) = h(q) ! p = 0

C(q) = d(q) ! v = 0

h(q)

p

Solutions

Closed form solutions can only be found for fairly simple mechanisms

Numerical solutions

No solution

Single solution

Multiple solution

Page 3: Inverse kinema tics - University of Southern Californiacsci520/slides/InverseKin.pdf · Inverse kinema tics Kinema tics The study of motion without r egar d to the for ces that cause

Under-specified problem

Multiple solutions

Mostly bad

How do we find the optimal solution?

Heuristics (move the outermost links first)

Closest to the current configuration

Energy minimization

Natural looking motion (whatever it means)

Ik methods

Iterative methods

Optimization methods

Unconstrained optimization

Constrained optimization

Iterative method

Use inverse of Jacobian to iteratively step all the joint angles towards the goal

Girard and Maciejewski, Computational modeling for the computer animation of legged figures, SIGGRAPH 85

Jacobian matrix

DOF (n)

Co

nst

rain

t (m

)!Ci

!qj

i

j

Jacobian is a m by n matrix

that relating differential

changes of to changes ofq C

Jacobian maps the velocity

in state space to velocities

in Cartesian space

Jacobian depends on

current state

Page 4: Inverse kinema tics - University of Southern Californiacsci520/slides/InverseKin.pdf · Inverse kinema tics Kinema tics The study of motion without r egar d to the for ces that cause

IK and the Jacobian

J =

!C

!q

!C = J!q

!q = J!1!C

qnew = q + !tJ!1!C Linearize about current q

Invert Jacobian

But Jacobian is most likely non-square

Compute the pseudo inverse Jacobian J+

!C = J!q

JT!C = JT J!q

(JT J)!1JT!C = (JT J)!1JT J!q

J+!C = !q

J+ = (JT

J)!1J

T = JT (JJ

T )!1

Optimization method

Find a solution that optimizes some numeric metric and satisfies constraints

Numeric metric

A function of q that measures the quantity to be minimized

Also called “objective function”

Optimization method

minq

G(q)

C(q) = 0subject to

Solve for joint configuration q

Page 5: Inverse kinema tics - University of Southern Californiacsci520/slides/InverseKin.pdf · Inverse kinema tics Kinema tics The study of motion without r egar d to the for ces that cause

Objective functions

Joint velocity

Power consumption

Similarity to the rest pose

Similarity to the natural pose

Constraint Derivatives

What do we want?

A direction to move joints in such way that the constraint handles move towards the goal

What do derivatives tell us?

A direction constraint handles move if joints move

Constraint derivatives

!C(q)

!q=

!h(q)

!q

h(q)

p

x, y, z, !0, "0, #0

!1

!2, "2

q = [x, y, z, !0, "0, #0, !1, !2, "2]

C(q) = h(q) ! p = 0

Need to know how to compute derivatives

for each transformation

!h(q)

!"1

= T(x, y, z)R("0, #0, $0)T!R("1)

!"1

TR("2, #2)hk

h(q) = T(x, y, z)R(!0, "0, #0)TR(!1)TR(!2, "2)hk

hk : local coordinate of h

Constraint derivatives

h(q)

p

x, y, z, !0, "0, #0

!1

!2, "2

h(q) = T(x, y, z)R(!0, "0, #0)TR(!1)TR(!2, "2)hk

hk : local coordinate of h

What is the most efficient way to compute the ?!h(q)

!q

Page 6: Inverse kinema tics - University of Southern Californiacsci520/slides/InverseKin.pdf · Inverse kinema tics Kinema tics The study of motion without r egar d to the for ces that cause

Unconstrained Optimization

Treat each constraint as a separate metric and minimize weighted sum of all metrics

Also called penalty methods

each spring pulls on constraint with force proportional to violation of the constraint

Unconstrained optimization

Minimize F (q) = G(q) +!

i

wiCi(q)2

Move in the direction of

!

!F

!q= !

!G

!q! 2

!

i

wi

!Ci

!qCi

Update the state qnew = q ! !"F

"q

Search and step

Find direction and the step size that move joints closer

to constraints

Step size: where min!

F (q + !!q)!

Direction: !q = !

!F

!q

qnew = q + !!q

Unconstrained optimization

Pros:

simple and fast, no linear system to solve

near-singular configurations is less of a problem

Cons:

constraints fight against each other and the objective function

can’t maintain constraints exactly

linear convergence

Page 7: Inverse kinema tics - University of Southern Californiacsci520/slides/InverseKin.pdf · Inverse kinema tics Kinema tics The study of motion without r egar d to the for ces that cause

Constrained optimization

Solve a linear system comprised of Jacobians and the quadratic metric

Also called Lagrangian Multipliers

L(q, !) = G(q) ! ! · C

minq,!

L(q, !)

Constrained method

Pros

Enforce constraints exactly

Quadratic convergence

Cons

Large system of equations

Near-singular configurations cause instability