15-883 Computational Models of Neural Systems
CMAC2 Project
Distributed: April 18, 2005. Due back: April 27, 2005.
Introduction
In this project you will implement CMAC (Cerebellar Model Articulation
Controller) learning (see section 4.2 of the syllabus) to solve the
inverse kinematics problem for a simplified arm with two degrees of
freedom. The graphics and most other low-level details have been
already taken care of; your job will be to focus on the details of
CMAC learning and retrieval.
The shoulder joint and the elbow joint of this arm are each limited to
180 degrees of travel. As a result, the arm has a teardrop-shaped
"workspace" of points it can reach. The forward kinematics problem is
to calculate the position of the end of the arm (the "hand") given the
shoulder and elbow joint angles. This is a straightforward bit of
math, solved by the arm_position
function. The inverse
kinematics problem is harder: given a point we want the arm to reach,
what joint angles should be used to accomplish that?
To solve this problem, you will train a CMAC on random pairs of joint
angles (theta1,theta2) and the associated point (x,y) that the arm
reaches. After training, the CMAC should be able to estimate the
joint angles need to reach any target (x,y) in the workspace. We are
actually constructing two CMACs: one to estimate theta1, and another
to estimate theta2.
- Download the code from the matlab/cmac2 directory, or grab the zip file . This code runs,
but the train function is incomplete; you will have to fill in the
missing details.
- Run the
initialize
function to set up the required
data structures and initialize the display. You will see the arm drawn
as a blue line (upper arm) and a green line (forearm).
- Click in the figure window. A red asterisk will appear to mark
the location (x,y) of the mouse click. Surrounding it will be a set
of black squares. These are the bins the CMAC is using to encode the
value associated with (x,y). By clicking repeatedly in the window,
you will note that nearby points have overlapping sets of bins; that's
how the CMAC is able to approximate a function from sparse data. The
1000 bins are generated randomly; the cordinates of their centers are
stored in the variable
bin_centers
.
- Type
train
to train the CMAC. The algorithm will run through
5000 points, initially doing nothing (you will have to fill in the
details), and then displaying all the training data.
- Fill in the missing bits of the
train
function.
Note that there is a learning rate eta
set up for you in
initialize
, and the set of bins to be used for storing
each data point is set up for you in the variable b
.
This should be used to index the variables named
theta1_memory
and theta2_memory
. If your
learning algorithm is correct, the error plot in figure 2 should show
a rapid decline, and clicking inside the workspace in Figure 1 should
bring the arm close to the target location.
- Look at the
clickhandler
function for a hint on how
to use the bins.
What to Hand In (Hardcopy Only, Please)
- The source listing of your modified
train
function.
- A plot of the training error.
- Answers to the following questions:
- What happens when you click far outside the workspace? Why do
you get this result?
- What happens when you click outside but close to the workspace? Why
do you get this result?
- After training, what fraction of the bins have nonzero values?
Last modified: Mon Apr 18 05:49:52 EDT 2005