CS184 Lecture 12 summary

Lab notes:

Its easiest to use Javascript to program the lab. In fact even if you want to use Java, you will probably find it quicker to develop via Javascript first.

Some of the machines in 330 Soda have Netscape bugs. If netscape can't load the java samples from class, you can use Explorer. To make sure Explorer finds your java classes, place them in a directory like U:\cs184-xx\myclasses and put this directory in the global classpath variable.

Kinematics

Kinematics is about the mapping between model parameters and the shape/position/orientation of the model:
Forward kinematics is the mapping from parameters to shape.
Inverse kinematics is the mapping from shape to the model parameters.

Example 1

The robot that you built for lab 3 has forward kinematic control of its position. That is, you control the joint angles (the model parameters) using the control panel, and those move the robot.

Example 2

The snake model from lecture 10 has a forward kinematic control of its shape using a single parameter. This parameter is a phase angle that determines where along a sinusoid the body shape starts and ends.

Forward Kinematic maps

To compute a forward kinematic map for a point p on a robot, you build the transform matrices T(q1) ... T(q4) explicitly as functions of q1... q4. The coordinates of a transformed point p is the matrix product T(q1) ... T(q4)p. It is a complicated function of the joints, but for each set of joint angles, there is only one location for the point.

Inverse Kinematics

Inverse kinematics by contrast, usually involves solving non-linear equations. And most of the time, there is more than one solution for the parameters.

Two-link planar mechanism

The two-link planar mechanism is a common subproblem of larger inverse kinematic problems. It is also often used as a "handle" solver for figure animation.

Let (x,y) be the location of the robot tip, and the shoulder be at the origin (0, 0). Let l be the distance to the tip, so that l2 = x2 + y2. Let l1 and l2 be the link lengths, and q1 and q2 be the joint angles. Then by the cosine rule:

l2 =  x2 + y2 =  l12 +  l22 +  2 l1 l2cos q2

and since we know all the lengths, we can solve for q2. Note that for cosine, both the angle and its negative give the same value, so there are two solutions at this step. They correspond to "elbow up" and "elbow down".

To solve for q1, we break that angle into a + b, where

a = atan2(y, x)

sin b /   l2 = - sin q2 / l

there is one solution for q1 for each q2, so there are two solutions overall.

Spherical point to azimuth-elevation

Given a point v on the unit sphere, we can solve for a two-joint robot with concentric axes (also known as azimuth-elevation, or longitude-latitude on the earth).

Let q be the elevation (latitude), and j be the azimuth (longitude). Let X, Y, Z be the coordinate axes. To compute elevation, use

Y.v = v2 = sin q

For azimuth (longitude), use

X.v = v1 = cos j

Z.v = v3 = - sin j

or j = -atan2(v3 ,v1).

There are strictly speaking two solutions for this problem. We didnt restrict the range of q and there are two possible solutions for it. They correspond to "shoulder forward" and "shoulder backward". Try it yourself!