Presentation on theme: "My Adventure with Inverse Kinematics"— Presentation transcript:
1 My Adventure with Inverse Kinematics Chris Heckerdefinition six, inc.
2 What is this lecture about? the path I took while solving a problem with inverse kinematicshow I use math to model and [sometimes] solve problemsdecisions I made, both good and badlearn from my successes and failureswork in progress!
3 What isn’t this lecture about? not an IK tutorial or introductionnot going to give you the One True Way to do IKhas nothing to do with graphicsnot about my rock climbing gameExperimental Gameplay Workshop Friday, 4pm - 7pm
4 TakeawayYou will get insight into how IK on a whole human body is different from IK on a single arm.You will see how IK is a building block, but not a complete solution to character animation.
5 Prerequisites must be very comfortable with math doesn’t mean you know tons of mathdoes mean you follow quickly and aren’t afraid of itprobably best if you’ve implemented a simple IK systemfoot placement, arm grabbing door, etc.
6 Talk Structure (linear with occasional branches) ...attempted solutionproblem statement and discussionrelated theory
7 Problem: How to move a guy with the mouse? move like a [rock climbing] humaninteractivedirect body/limb controldid not want to use physics
8 Theory: How to move a guy with the mouse? inverse kinematics vs. forward kinematicsFK: p=f(q)IK: q = f-1(p)p is Euclidean, anglesq is configuration spacepgp = (x, y)q = (q1, q2)q2q1
9 Theory: How to move a guy with the mouse? (cont.) pq2q1degrees of freedom (DOF)incredibly important concept“ways in which system can change”configuration spacefind DOF of system to understand itcontrol & constrain DOF to control itexamplesphysical system, polynomial, etc.fundamental task of IK is to control degrees of freedom to attain goalp = (x, y)q = (q1, q2)
10 Solution: How to move a guy with the mouse? analytical IKinvert p = f(q) to get q from prelatively easy for the 2D arminverse trig, some vector algebragets complicated as n increases
11 Problem: Analytical IK can’t handle human. human has lots of DOFeven 2D arm with shoulder has more DOF than needed to reach goalsolving p = f(q) requires certain characteristicsq3gq2q1p = (x, y)q = (q1 , q2 , q3)
12 Theory: Analytical IK can’t handle human. pp = f(q) is a set of nonlinear equationsgenerally no closed formsmust iterate numericallymust be square, nDOF = ngoalover-, under-constrained system“redundant manipulator”ex. human reaching for point and/or orientationvast literature on solving f(q) = pq3q2q1p = (x, y)q = (q1 , q2 , q3)
13 Solution: Analytical IK can’t handle human. puse Cyclic Coordinate Descent (CCD) to solve armsiterative, recursive position-space algorithmfast, easy, robuststart from last positionnot path independent, but fasterI draw every outside iterationlooks like animation, but it’s notq3gq2q1p = (x, y)q = (q1 , q2 , q3)
14 Problem: CCD only handles serial chains. multiple goals are necessary for humanstack up vectors in p=f(q)coupled at branchesg2q3g1q5q4q2q1p = (x1, y1, x2, y2)q = (q1 , q2 , q3 , q4 , q5)
15 Theory: CCD only handles serial chains. p2p1coupling between goalseither solvable alone, neither solvable togetherhow to distribute desired-angle error?g2q3g1q5q4q2q1p = (x1, y1, x2, y2)q = (q1 , q2 , q3 , q4 , q5)
16 Solution: CCD only handles serial chains. p2p1simply average desired angles at branch parents to attain multiple goals and distribute errorq1 in example, imagine p1, p2 pulled in opposite directionsq3q5q4q2q1p = (x1, y1, x2, y2)q = (q1 , q2 , q3 , q4 , q5)
17 Problem: Drift on multiple goals. average can’t satisfy all goalsor even prioritize themI specifically want to drag climber hand with mouse and have other end effectors stay on holdsq
18 Theory: Drift on multiple goals. want a rigid constraint at end effectorsclosed loops are hard, CCD doesn’t handle them, nor do common IK algorithmsmust solve simultaneouslynot hierarchical anymoreclosed loops don’t have local behaviorq
19 Solution: Drift on multiple goals. attempt to “Gram-Schmidt” off any movement that would result in errorbca
20 Problem: Gram-Schmidt removes the wrong direction sometimes. could have tried real Jacobian force mapping Gram-Schmidt
21 Problem: Human is not rooted tree. Which end effector (hand, foot) is the root?There is no persistent fixed root in a rock climberor walking personCCD must start at a fixed root
22 Theory: Human is not rooted tree. switching root is basically a datastructure problemrelative angles must changejoint limits (see below)behavior will change slightly as well, since CCD isn’t symmetric with respect to the root
23 Solution: Human is not rooted tree. just type it ininvert tree to new rootCaml is pretty good at this sort of thingsee last year’s GDC talkdragging torso is done by inverting to a torso node, then changing the root positionthe hands and feet are all end-effectorshack!
24 Problem: Joint limits elbow can’t bend backwards should lend believability and intuition
25 Theory: Joint limits inequality constraints: q ³ qmin abandon all (most) hope of analytical solutionthese inequalities are axis aligned planes in configuration spaceqmaxqqmin
26 Solution: Joint limits CCD makes parent-child limits easydo min/max clamp in CCD inner iterationeasy, and rest of system compensatesissue: CCD doesn’t “know” about the joint limitsoften compensates, but doesn’t know to avoid them
27 Problem: Child-child limits parent-child not enough with moving rootpelvis example:left foot rootright foot rootchest root
28 Problem: Child-child limits parent-child not enough with moving rootpelvis example:left foot rootright foot rootchest root
29 Problem: Child-child limits parent-child not enough with moving rootpelvis example:left foot rootright foot rootchest root?
30 Theory: Child-child limits both angles are dependent on each other, coupledparent is fixed in CCDconstraints are now non-axis aligned planes in C-spacesimultaneous solution necessary at branches with child-child limits
31 Solution: Child-child limits Good solution should:satisfy constraints alwayshave zero error in goals if possiblehave least squares error if not possibleNonlinear Least Squares with Linear Inequalities: minimize (q1 - d1)2 + (q2 - d2)2 w.r.t. qmin12 £ q1 - q2 £ qmax12lots of literature on NLSLII convert to LCP and use Lemke’s algorithmworks great!
32 Accomplishments We extended CCD to handle: multiple end effector goals dynamically changing root nodearbitrary joint limits
33 Problems drift on multi-goals is still a problem CCD doesn’t know about joint limitssometimes non-physical movementCCD isn’t doing physics, not conserving energy, or anything else for that matterrooted hierarchies are inconvenienthow to control redundant DOF?
34 Body Knowledge System system to manage movement and keep it natural “situation” & “reaction”ex. joint limits handled in body knowledgehuge rules systemallocates redundant DOFthis is the key to natural movement!
35 Body Knowledge System (cont.) IK just a rough initial guess for body knowledge system; should be:physically plausibleno added energy, etc.easy to layer conflicting goalsable to cope with over-constrained goalsdon’t know enough about this yet, but I think it will be more important than IK for good dynamic animation
36 What I Didn’t Talk About development process stuffdeveloping on lower dimensional subproblemsusing visualizations to help debug mathMathematica and Matlab for development and debuggingrunning multiple techniques on top of each otherphysics-based techniques I tried
37 What I Didn’t TryI should have done a weighted average based on error for multi-goals, duh.even weighted average wouldn’t be rigidalthough could make weight very big...similar to a stiff systemWrong: “CCD must have fixed root”now that I understand better, this isn’t actualy truethe root’s position is just more DOFCCD probably wouldn’t deal with this very well?
38 What I Didn’t Try (cont.) pseudo-inverse methodsgive explicit control over redundant DOFdata-based methods (model-based)functions as lookup tablestotally ad-hoc methods
39 References two great theses: google & citeseer GDC talks Paolo BaerlocherChris Welmangoogle & citeseerGDC talksDavid WuKen PerlinJeff Lander’s articles & codeExperimental Gameplay Workshop
Your consent to our cookies if you continue to use this website.