<- previous    index    next ->

Lecture 17, Kinematics and timing


Kinematics, how to compute and present movement from one given
position and orientation to another position and orientation.

This lecture covers the graphics display and timing control for
a motion path generated by a control system. 

One example is computing the path for a two drive wheel robot:
Have starting coordinate and direction,
specify ending coordinate and direction, self driving.
(I wrote this code in 2005, may need automated wheel chair?)




The basic control system is given by the code:

/* kine.c  from CH 3 S&N Autonomous Mobile Robots */
/* given starting position, goal is origin, control vector */
/* navigate to goal. From any x0,y0 to x1,y1 OK, just compute dx,dy */

/* chosen control parameters */
static double kr = 3.0, ka = 8.0, kb = -3.0;

  /* compute deltas from control system */
  drho = -kr*rho*cos(alpha);
  dalpha = kr*sin(alpha) - ka*alpha - kb*beta;
  dbeta  = -kr*sin(alpha);
  dtheta = -(dbeta+dalpha);
    
  /* robot has to move distance drho*dt */
  /*       at angle theta+dtheta*dt     */
  dx = dx + drho*dt*cos(theta+dtheta*dt);
  dy = dy + drho*dt*sin(theta+dtheta*dt);
  rho = sqrt(dx*dx+dy*dy);
  theta = theta+dtheta*dt;
  alpha = -(theta - atan2(dy, dx));
  beta  = -(theta + alpha);
  t = t+dt; /* simulation time */



kine.c Simple linear control system




Add the output of individual wheel speeds that could drive the
robots wheels.

kine2.c Displaying individual wheel speeds




Now test from various starting points at various starting angles.

kine3.c Showing 8 starting points to end 0,0




The control system can be made to operate in a three dimensional
scene by adding Z axis convergence.

kine4.c Three dimensional paths

The basic control system can be implemented in any language with
a choice of graphics library for display.

Kine.java


Techniques for developing interactive graphics applications from
some starting code.


robot.c  I considered not much to talk about robot.jpg

It did have mouse control and the "robot" arm did move under user control.
There was a ready made addition available:
 
dynamic.c starting point of robot2.c was hard to read. dynamic.jpg

My approach was to copy dynamic.c to robot2.c and make the following
changes, in order, compiling (fixing) and running (fixing) each change.

I could not see the lower leg from the upper leg, thus I changed the
colors for various body parts. Since this was a 'lighting' scene,
it was a matter of changing the emitted light to white and covering
the various limbs with material of various colors.

Now that I could see the motion better, I wanted to make the robot
bend, not just turn. Yuk! The code used numbers, 1, 2, 3 ... rather
than named numbers for the angles. Thus I went through and changed
all references, menu, angle[?] and a few others to names, #define's.
This really helped me understand the code because I had to look
at every section.

With menu and angles and rotations named, it was easy to add two
menu items, one to increase motion per click, another to decrease
motion per click.

Now it was easy to add bend to the torso because I had seen that
the head could both rotate and bend, just cut-and-paste with some
name changing.

When I lifted both legs, the robot did not lower itself, unreal.
Thus I added keyboard function for 'x', 'X', 'y' and 'Y' so the
robot could be moved.

robot2.c was an interesting exercise for me to develop. robot2.jpg



Now I could add the upper limbs, shoulder hip, to both
rotate up and down and sideways like real limbs. Then add "hands"
with future some kind of grip. Then be able to read and save a
script of a sequence of motions.

robot3.c add hands and ball joint at shoulder. robot3.jpg

A possible future project is to implement a "record" mode where a user
moves the robots limbs to make the robot walk, run, dance, jump etc.
Then a "play" mode where the robot performs the recorded motions.

A typical data structure for each move might have:
sequence number
mode (just move, interpolate, repeat sequence)
delta time for move
x coordinate
y coordinate
z coordinate
number of joints to move
   joint angle
   joint angle
   ...

or an optional repeat sequence
sequence number
delta time for move
mode repeat sequence
from sequence number
to sequence number


If the "record" kept an ASCII text file, the user could edit
the action and potentially have a computer program generate
the motions.

User interface buttons similar to those found on VCR or DVD
recorders would seem appropriate.

The robot could be replaced by a more human figure, an animal
or some pseudo figure like a car, truck or machine that could
do non characteristic actions. e.g. cartoon characters.

So far, a small data file may look like:

robot3.dat

Using Java, Thread.sleep(100); for 100 millisecond delay of Rocket.
Rocket_flight.java

Project testing and demonstrations, if any are ready.

on GL   in /cs437      robot3 robot3.dat

    <- previous    index    next ->

Other links

Many web sites on Java GUI, AWT, Swing, etc.
Many web sites on Python wx, tk, qt, etc.

Go to top