Preamble

Control of starbugs is not especially user-friendly at the moment. This is due to the lack of time I've had - so advance apologies for any frustration this causes.

Start Up

Login: ss
Password: $password

Open a shell

Press Ctrl-Alt-x.

Note: Every time a shell is created the $e/starbugs/.zshrc file is sourced. This ensures the DT3155 device driver is loaded, & sets a number of default parameter values. (eg. bright-pixel threshold value for centroiding, bug driving frequencies, etc.) If you want to set parameter values to a default value that will be applicable to all shells, you can edit this file.

Acquire an image from the framegrabber

Simply run the command frame. This will create an image file: ./frame.pgm.

Note: any existing ./frame.pgm file will be overwritten.

View an image

eg. xv ./frame.pgm

Useful to combine with frame & other commands.
eg. frame && xv ./frame.pgm

Centroiding

Running the centroid command will acquire a new image from the framegrabber device & try to centroid it.

You can centroid an existing image by using the -f argument.
eg. centroid -f ./image.pgm

There are many other options to the centroid command. Running centroid -h will list them:

usage: centroid [options]
-a         annotate image. (draw bbox & centroid) [false]
-b <n>     maximum level of background noise. [150]
-d <x>,<y> dead pixel coordinates.
-e <n>     estimated background noise. [0]
-f <img>   PGM image to centroid. [default: grab frame]
-F <n.m>   threshold factor for false-positive detection. [1.05]
-h         usage information.
-r <n>     radius of bounding box to centroid (in pixels). [4]
-s <n>     minimum separation b/w fibres. [6]
-t         Time centroiding operation. [false]
-v         verbose output.

The default values for each argument are determined by environment variables (set in $e/starbugs/.zshrc):

-b    $MIN_BRIGHT
-e    $BG_NOISE
-r    $BBOX_RADIUS
-s    $MIN_FIBRE_SEPARATION

Note that any argument specified to centroid overrides the default value set in the corresponding environment variable.
ie. centroid -b 200 ignores the value of $MIN_BRIGHT.

The -a argument is often useful as it draws bounding boxes & centroids on a copy of the image & saves it as /tmp/a.pgm.
centroid -a -f /tmp/fail.pgm && xv /tmp/a.pgm

Bug Position & Rotation

The bp command does a centroid of an image & then some further calculations to determine the position of a bug (in pixel coords) & its orientation.

bp uses the environment variables specified in the aforementioned centroiding section.

By default bp will acquire a new image from the framegrabber, but you can tell it to use a saved image with:
bp -f /tmp/fail.pgm

Note that if the centroiding does not find exactly 3 centroids, the bp command will fail. If it fails, it will dump a copy of the image in /tmp/fail.pgm.

It is often useful to run this command:
bp || { centroid -f /tmp/fail.pgm -a && xv /tmp/a.pgm }

Output waveforms

Run the awg command to invoke a GUI application to control both the arbitrary function generators. Control should be intuitive.

Sometimes the older AWG gets in a knot & awg reports "Error: Connection to AWGs lost". In this instance, powercycle the AWG & restart awg.

Parallel Port Switching

Jurek's bug is connected to a switch. The switch has 3 ON settings & an OFF setting:

pp -d 3 Switch #1.
pp -d 5 Switch #2.
pp -d 6 Switch #3.
pp -d 7 Turn all switches off.

Positioning a bug

Run the drive command:
ie. drive -b jurek1

Use the -p argument to control the destination pixel:
ie. drive -b jurek1 -p 200,300

Use the -n argument to limit the number of cycles through the closed-loop program. Specifying zero loops is often useful to see the results of the bug calibration.
ie. drive -b stan1 -n 0

Many bug parameters (drive frequencies, etc.) are listed in $e/starbugs/.zshrc.

Note: There is a GUI frontend to drive (called driveGUI) but it's a bit slow (closed-loop speed drops from ~11hz to < 5hz) so I don't recommend using it.

Graphing bug positioning results

Run the command graph.

Anytime drive is run, it will plot positioning results as it's running. When graph detects a new drive command it will save the plotted graph to /tmp/bugPerf.ps. You can also force graph to save the plot by Ctrl-cing it. (Then restarting it, if desired.)

Miscellaneous

Jurek's bug should be connected to the LAN AWG device.

Stan's bug should be connected to the RS232 AWG device.

Example sequence

drive -b jurek1 reports:

Found 9 centroids
...
Saved: /tmp/fail.pgm
Failed to determine position of bug "Jurek1Bug"

Run centroid -a -f /tmp/fail.pgm && xv /tmp/a.pgm to discover what false-positives are being detected. This may indicate reflections off the wires, or other bright objects. Rectify by removing source of bright spot (ie. blacken wires) or altering the $MIN_BRIGHT threshold.

centroid -a -f /tmp/fail.pgm -b 200 && xv /tmp/a.pgm shows 4 centroids. Repeating with -b 210 shows 3 centroids - perfect. Set the associated environment variable (export MIN_BRIGHT=210) so bp will work. Run bp -f /tmp/fail.pgm to confirm everything is ok now.

Even when bp succeeds, it's useful to visually check what centroid is doing to ensure bounding boxes are large enough etc. They might not be, in which case experiment with centroid -a -r 8 & do export BBOX_RADIUS=8 when the correct bounding box size is determined.

drive -b jurek1 should work ok now.

Bug performance results/data

A number of graphs & data files have been collected here. (Only *.plot files contain actual data values.)

Roger has a CD containing video footage of different bugs moving.

-------

Valid HTML 4.01!