CS157 Computer Animation

Inverse Kinematics Lab 2




This is the second of two labs on inverse kinematics. Last time you wrote a program to compute the Jacobian of a simple linked structure. You also modified an SVD demo to compute the pseudo inverse of a matrix. Today, you'll use those elements with the program found here to buld a simple inverse kinematics engine.
  1. Compile and run the code supplied. The program will draw a simple linked structure and a destination for the end effector. The destination can be moved by moving the mouse while holding down the left button. Your task is to make the end effector follow the destination.
  2. Complete the computeJacobian and computePseudoInverse functions to compute the globals J and Jplus. For the simple example given, J is invertible. To test your computations, compute the product of Jplus and J and print the result. Your program should output the 2X2 identity.
  3. The move function takes as input the desired change in position of the end effector and a depth value. For the moment we'll ignore the depth value. The move function calls the routines to compute the Jacobian and its pseudo inverse. Next it should update the angles in the array theta[]. Modify move accordingly then compile and run the program. If you move the mouse slowly, the end effector should follow the destination fairly well.
  4. To make the engine more robust, we'll test for the error in the change of the position and, when necessary, refine our computation.
    1. Compute residual: The residual is the difference in actual change of position relative to desired change; more precisely, it is the sum of the absolute values of the differences in x and y of the actual vs. desired changes in position.
    2. Compare to threshhold: The threshhold, in general, depends on the structure itself. For our example use .05.
    3. Accept & update: If the residual is less than the threshhold, you should make the move and return.
    4. Reject & recompute: If the residual exceeds the threshhold, reject the move and recompute using two steps; i.e. move dP/2 twice, where dP is the change in position. You can compute the changes recursively, incrementing the depth value by 1. If you cannot successively move with a depth of 10, then report that you cannot reach the target and return false!!
    5. Compile and run the program. It should follow the desination fairly well. The destination turns white when the engine has lost track. Can you make any general observations about when the engine loses track of the destination?