CS157 Computer Animation
Inverse Kinematics Lab 1
This is the first of two labs on inverse kinematics. By the end of these labs you'll build a simple inverse
kinematics engine. You should work in pairs to complete these labs.
-
Consider the simple two-link structure shown below.

-
Annotate the figure above using DH notation using variable names for
link lengths (li) and angle (θi). Clearly identify
how these lengths and angles are measured in the figure. (All joints rotate about <0,0,1>.)
-
Assume the end effector is at the right end of the second link. Write the Jacobian for the position of the end effector. Annotate the figure with
any additional variables you
use in the Jacobian and with the global reference frame.
-
Repeat the previous exercise for the three-link structure shown below.
-
Write a little program that computes the Jacobian (position only) based on
global variables int n, double l[n], and double theta[n] that specify a link structure. You may find the Tuple class located
here
to be helpful.
Try the program for n=2, l[0]=1, l[1]=1, theta[0]=0, theta[1]=π/4. Write the Jacobian below.
-
In general we want to solve dE=J(θ)dθ given the change in the end effector dE and the Jacobian. If
the Jacobian is square and has full rank we can simply invert it. But that is usually not the case. Rather we
need to compute the pseudo inverse, which is denoted J+.
Create a new directory and download the files here. Compile, link, and run the program.
This program reads input matrices from "matrx3.dat" and computes their Singular Value Decomposition. The SVD of
an mXn matrix M consists of matrices U, W, and V where
-
M=UWVt (the t superscript denotes transpose)
-
U is mXn
-
V is nXn
-
W is an nXn diagonal matrix; i.e. all off-diagonal elements are 0. (The demo program only writes the
diagonal elements for W: w00, ... , wn-1,n-1.)
If W is invertible then the pseudo-inverse of M=UWVt is M+=VW-1Ut. Suppose W is 2x2 with diagonal elements
a and b. Write W-1 below.
When is W not invertible?
In general M+=VW'Ut, where W' is the nXn diagonal matrix with w'kk=1/wkk
provided wkk ≠ 0 and otherwise w'kk=0.
Augment the SVD demo program to compute and print M+.
Write the pseudo inverse of each of the sample input matrices below.