inverse kinematicsmrl.snu.ac.kr/.../computeranimationlecturenote/6_inversekinematic… · forward...

28
Inverse Kinematics Jehee Lee Seoul National University

Upload: others

Post on 19-Aug-2020

11 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Inverse Kinematics

Jehee LeeSeoul National University

Page 2: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Forward and Inverse Kinematics

1q

2q

)F(),( iq=qp ),(F 1 qp-=iqForward Kinematics Inverse Kinematics

1q

2q

Page 3: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

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 4: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

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

2q

1q1l

2l

X

Y

),( ee yx

Page 5: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Analytic Solution for A Simple Example

2q

1q1l

2l

X

Y

tq

÷÷ø

öççè

æ --+-=

--+=-

÷÷

ø

ö

çç

è

æ

+

-++-=

+

-++=-

÷÷

ø

ö

çç

è

æ

+=

+=

-

-

-

21

2222

211

2

21

2222

21

2

221

22

22211

1

221

22

2221

1

22

1

22

2cos

2)cos(

2cos

2)cos(

cos

)cos(

llyxll

llyxll

yxl

lyxl

yxl

lyxl

yx

x

yx

x

ee

ee

ee

ee

ee

ee

ee

e

ee

e

pq

qp

qq

qq

q

q

t

t

t

t

),( ee yx

Page 6: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Redundancy in Human Arms

Page 7: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

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 8: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Iterative Methods

• Iteratively refine joint angles to the goal– Consider infinitesimal changes

),(from),,(compute 321 yxqqq

),(from),,(compute 321 yx ¶¶¶¶¶ qqq

),( yx ¶¶

3q¶

1q¶ 2q¶

Page 9: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Jacobians of Forward Kinematics Map

• Forward Kinematics Map

• Jacobian

÷÷÷

ø

ö

ççç

è

æ

÷÷÷÷

ø

ö

çççç

è

æ

¶¶¶

¶¶

¶¶

=

÷÷÷

ø

ö

ççç

è

æ

=÷÷ø

öççè

æ

3

2

1

321

321

3

2

1

qqq

qqq

qqq

qqq

!!!

!!!

!!

yyy

xxx

FFF

FFF

yx

J

),,(),(),( 321 qqqFFFyx yx ==),( yx ¶¶

3q¶

1q¶ 2q¶

Goal

Page 10: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Jacobian of Forward Kinematics Map

• If the inverse of the Jacobian can be computed, …

),( yx ¶¶

3q¶

1q¶ 2q¶

Goal

tt

ttt

yx

t

t

÷÷ø

öççè

æD+

÷÷÷

ø

ö

ççç

è

æ=

÷÷÷

ø

ö

ççç

è

æ

D+÷÷÷

ø

ö

ççç

è

æ=

÷÷÷

ø

ö

ççç

è

æ

-

+

!!

!!!

1

3

2

1

3

2

1

3

2

1

13

2

1

Jqqq

qqq

qqq

qqq

Page 11: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

A System of Linear Equations

• # of unkowns = the dimension of q = 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 Jacobianis required

Page 12: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

A Geometric Interpretation of Jacobian

• You don’t have to differentiate the forward kinematics map to compute Jacobian

• The colume vectors (j1, j2, j3) of Jare perpendicular to the corresponding vectors (p1, p2, p3) from the joint to the end-effector

Page 13: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Linear and Angular Velocities in 3D

• Velocity of a point due to rotating joints

wpv

p

ww

w

=

´=

p

p pv

Page 14: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Jacobian in 3D

• A serial chain with n revolute joints

÷÷ø

öççè

æ ´´´=

n

nn pppJ

wwwwww

!!

21

2211

÷÷÷÷÷

ø

ö

ççççç

è

æ

¶¶

=÷÷ø

öççè

æ

-

-

n

effectorend

effectorend Jv

q

qq

w !2

1

1w

1p

Page 15: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Jacobian in 3D

• A serial chain with n revolute joints

÷÷ø

öççè

æ ´´´=

n

nn pppJ

wwwwww

!!

21

2211

÷÷÷÷÷

ø

ö

ççççç

è

æ

¶¶

=÷÷ø

öççè

æ

-

-

n

effectorend

effectorend Jv

q

qq

w !2

1

2w 2p

Page 16: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

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 17: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

IK can be ill-conditioned

• A small change in the position of the end-effector could require substantial changes of joint angles

Page 18: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Singularity

• Singularities cause the rank of the Jacobian to change• Often ill-conditioned near singularities

Page 19: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Iterative Method Using Jacobian

• Jacobian should be computed at every time step

• Simple Euler integration can be used

• Singularity could result in numerical instability

Page 20: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Non-Linear Optimization

• Non-linear programming– Numerical method for finding the (local) minimum of a

non-linear function

• An efficient way of solving IK• The path may not look natural• Multiple goals can easily be handled

• We need to define– Objective function : ex) Place hands at specific positions

– Constraints : ex) Joint limits

Page 21: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Objective Function

• Position

• Orientation

• Direction

2)()( goalG pp -= qq

( ) 21 )(log)( qq qq-= goalG

2)()( goalG vv -= qq

Page 22: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Constrained Optimization

• Formulation

• Use a standard numerical technique– Gradient decent– Conjugate gradient– Sequential quadratic programming

iii ulG

££qq

subject to)( Minimize

Page 23: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Basic Idea of Numerical Techniques

• Pseudoinverse + Euler integration– Constant time step

Page 24: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Basic Idea of Numerical Techniques

• Direction selection + Line minimization– Least squares– Gradient– Conjugate gradient

Page 25: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Quick and Dirty

• Cyclic coordinate decent– Try to solve the problem with subset of joints– If it fails, add a joint

• Jacobian transpose method– Use the transpose of Jacobian, instead of

pseudoinverse– Do not guarantee the least-squares property

Page 26: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Hybrid Approach

• Arms and legs allow analytic solutions– Redundancy can be parameterized by

elbow circles

• Reduced-coordinate formulation– We can replace 7 dof for each limb by a

single elbow circle parameter– Hybrid formulation (numerical + analytic)– The numerical optimization can be done

with fewer number of parameters

Page 27: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

Data-Driven Approach

• IK is underdetermined– Many possible poses satisfy constraints– Some poses more likely than others– The likelihood of poses depends on the body shape

and style of the individual person

• Data-driven IK– Drive the likelihood function from human motion data– data-driven-ik.avi

Page 28: Inverse Kinematicsmrl.snu.ac.kr/.../ComputerAnimationLectureNote/6_InverseKinematic… · forward kinematics map to compute Jacobian • The colume vectors (j1, j2, j3) of J are perpendicular

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