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.
-
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.
-
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.
-
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.
-
To make the engine more robust, we'll test for the error in the change
of the position and, when necessary, refine our computation.
-
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.
-
Compare to threshhold: The threshhold, in general, depends on the structure itself. For our example use .05.
-
Accept & update: If the residual is less than the threshhold, you should make
the move and return.
-
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!!
-
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?