Inverse KinematicsMike [email protected] State Universitymjb – October 16, 2014Oregon State UniversityComputer Graphicsinversekinematics.pptxInverse KinematicsForward Kinematics solves the problem “if I know the link transformation parameters, where are the links?”.Inverse Kinematics (IK) solves the problem “If I know where I want the links to be (X*,Y*), what link transformation parameters will put them there?” 3(X*,Y*)232233121122mjb – October 16, 2014Oregon State UniversityComputer GraphicsGroundInverse Kinematics (IK):Things Need to Move – What Parameters Will Make Them Do That?mjb – October 16, 2014Oregon State UniversityComputer GraphicsRemember the Idea Behind Newton’s Method?“Pick an initial guess of the input parameter and keep refining it until thePick an initial guess of the input parameter and keep refining it until the answer it produces is close enough”dyyyxdx1.haveyxdydx2.dxxxx3.3.mjb – October 16, 2014Oregon State UniversityComputer GraphicsNow we just need to do it with more than one input parameterJacobian MethodOur input parameters (in this case) are the three rotation angles. If (X*, Y*) are where we want the end of the third link to end up, then:*()Xf*()YgdIf you have a good guess for , which currently produce an (X*, Y*) that is notquite what you want then you can refine your values forand123(,,)Xf123(,,)Ygand123(, , )123()is not quite what you want, then you can refine your values for and try again. The fundamental equations for this are:123(,,)33*22*11***XXXXXXapprox33*22*11***YYYYYYapproxmjb – October 16, 2014Oregon State UniversityComputer GraphicsOi tifThe Jacobian MatrixOr, in matrix form:YXYYYXXX21***3*2*1*33212 x 33 x 12 x 1***XXXThe matrix:3*2*1*321YYYis called the Jacobian, and is abbreviated as [ J ]:YXJ21mjb – October 16, 2014Oregon State UniversityComputer GraphicsY3N t th t [J] i t t i thi t f ti t bSolving the EquationsNote that [J] is not a square matrix, so this system of equations cannot be solved for directly. But, if we pre-multiply by the transpose of [ J ], we get:YXJJJTT][][21Y33 x 12 x 1 )2 x 3 )( 3 x 2( 3 x 23 x 12 x 1 )2 x 3 )( 3 x 2( 3 x 23 x 13 x 3 3 x 1which is solvable because it is 3-equations-3-unknowns. b b h h f l ll mjb – October 16, 2014Oregon State UniversityComputer GraphicsIt is not obvious, but this is the Least Squaresformulation. It will give an optimum (ΔΘ1, ΔΘ2,ΔΘ3) to make (X*,Y*) move closer to the desired values.Diff ti tthti dIterating to get a Solution (note similarity to Newton’s Method)*()Xf*()YDifferentiate the equations andPick a starting Θ1, Θ2, and Θ31. Compute X*approxand Y*approxfrom123(,,)123(,,)Xf123(,,)Ygpapproxapprox2. Compute ∆X=X*-X*approxand ∆Y=Y*-Y*approx3. If |∆X| and |∆Y| are “small enough”, we’re done 123()4. Compute: 3*2*1*3*2*1*,,,,, YYYXXX5. Form the Jacobian [ J ]6. Solve the system of equations:XJJJTT][][21YJJJ][][32mjb – October 16, 2014Oregon State UniversityComputer Graphics7. Refine:11 12 2 233 3;; The Calculus Product Rule Tells us How toDifferentiate Scalar Variables that have been Multipliedcab()dc d ab da dbbabaddd d mjb – October 16, 2014Oregon State UniversityComputer GraphicsThe Calculus Product Rule Tells us How toDifferentiate Matrices that have been Multiplied[][][]([ ][ ]) [ ][] []MTRdTR dRdM dT([ ][ ]) [ ][] [][][]dTR dRdM dTRTddd d 0cos sin 00 sin cos 00 sin cos 00 cos sin 00[]0010 0 0000001 0 000dRddd 0001 0 000 mjb – October 16, 2014Oregon State UniversityComputer GraphicsNumerical DifferentiationRather then explicitly differentiating an equation, it is often easier to calculate the derivative numerically. This is known as the Central Difference method, h l k b th f d d b k d t h th d d twhere you look both forward and backwards to see how the dependent variable is changing with respect to the independent variable:()()2XXXPick a delta that is small but not so small that floating point accuracy becomes an issuePick a delta that is small, but not so small that floating point accuracy becomes an issuemjb – October 16, 2014Oregon State UniversityComputer GraphicsNumerical DifferentiationIf there are other independent variables, hold them constant:1 123 1 123( ,,) ( ,,)XXX 112mjb – October 16, 2014Oregon State UniversityComputer GraphicsNumerical DifferentiationIn case you ever need it, here is how to compute the second derivative2()2()()XX X X22As before, if there are other independent variables, hold them constant:mjb – October 16, 2014Oregon State UniversityComputer GraphicsAnother IK Approach:Cyclic Coordinate Descent (CCD) MethodThe idea is to change Θ1 so that (X,Y) are as close to (X*,Y*) as possible.Then change Θ2.Then changeΘ3.Then change Θ3.Then change Θ1.Then change Θ2.Then change Θ3.Then changeΘ13Then change Θ1.. . .12(X*,Y*)Ground(X,Y)mjb – October 16, 2014Oregon State UniversityComputer GraphicsChanging Θ1Holding Θ2 and Θ3 constant, rotate Θ1 so that the blue lines line up.312(X*,Y*)Ground(X,Y)mjb –
View Full Document