|
© T i m B r u t o n 1 9 9 9 |
Running the car *
Compiling and running
car.c *
Makefile *
Open loop versus closed loop control *
Setting up the system *
When the program is running *
Charging the batteries *
It is important to not run the car for more than 3 minutes at a time since the electric motors will excessively heat up, and may require several minutes to cool down.
The car will run for about 15 tests of 1 minute duration, with a minute between runs to allow the motors to cool, before the batteries need recharging. Alternatively the car could be run for around 10 tests of 2 minutes each, with 2 minutes between runs.
The car will drive increasingly slow as the batteries discharge, until the car tends to get stuck, and will not drive at all.
The camera and video transmitter batteries can be run continuously for around 1 hour before recharging is required.
CC = g++
FLAGS = -O -g
OBJS = car.o
BIN = car
# Libraries for link/loader phase.
#LIBS = -L/usr/monash/graphics/lib -limage -lX11 -lm -lvl -lgl
LIBS = -L. -limage -lX11 -lm -lvl -lgl
# Flags for link/loader phase.
LDFLAGS = $(FLAGS)
# Flags for compile phase (used automatically when $(OBJS) are created).
#CFLAGS = $(FLAGS) -I/usr/monash/graphics/include
CFLAGS = $(FLAGS) -I.
$(BIN): $(OBJS)
$(CC) -o $(BIN) $(LDFLAGS) $(OBJS) $(LIBS)
clean:
rm -f core *.o $(BIN)
This makefile makes the binary
"car" from "car.c",
"image.h" and
"libimage.a".
Currently the Makefile expects image.h
and libimage.a to reside in the same
directory as car.c.
To compile these files from their usual directory paths
the Makefile would need to include the following changes:
LIBS = -L/usr/monash/graphics/lib -limage -lX11 -lm -lvl -lgl
#LIBS = -L. -limage -lX11 -lm -lvl -lgl
CFLAGS = $(FLAGS) -I/usr/monash/graphics/include
#CFLAGS = $(FLAGS) -I.
The program is run by entering:
car n m, where n=1 for video output to
the screen, n=0 for no output. m=1 is for closed loop control (with
feedback), and m=0 is for open loop control (without feedback).
Open loop versus closed loop control
Closed loop operation tends to increase the gain of the low level controller used, which results in larger moves and higher car speeds. If navigation is unsuccessful then use the slower open loop control mode.
Plug the antenna into the VCR which is tuned to UHF channel 30. An RCA lead should go from the composite video out of the VCR to the video in on the VINO video card at the back of the Indy. The antenna should be placed away from electrical equipment and in a high position preferably with an unobstructed line of view between itself and the car. The camera and video transmitter are turned on by the on/off switch on the battery pack underneath the platform at the rear of the car, a small LED should light up on the side of the transmitter. NOTE: if a picture cannot be obtained when the system is set up correctly then the transmitter/camera batteries are almost flat (even though the LED will be lit up!). The serial interface should be plugged into serial port 1 of the Indy and to the car's hand held transmission unit. Make sure a 9V battery is in the hand held unit, so that the LED on the serial interface is lit up.
The following menu pops up:
Hit F3 to view pixel values
Hit F4 for processing time information
Hit F5 for camera position change
Hit F6 for 24 position steering
Hit F7 for 200 position steering
Hit F8 for 200 position steering multithreaded execution
Hit F9 for 200 position careful execution
Hit F10 to quit
Hit F2 to see if the Indy is getting a clear picture from the camera. If there is no picture on the Indy when the system is set up correctly, but the LED on the side of the video transmitter on the car is lit up, then the transmitter/camera batteries are almost flat and require charging.
F1 - Calibration - Note, when the program is first run it is a good idea to hit F2 before calibration is attempted, so that the video library can set up the internal video data paths correctly. If this is not done then the calibration routine may fail when attempting to analyse a video frame from a video stream which may not exist yet. Since the track lines will be at different angles to the car and will appear distorted at the edges of the wide angle camera lens, the lines will be different widths at different times. F1 will calibrate the system and set the width variance of the track lines, and the minimum contrast difference between the track lines and surrounding carpet. By using this calibration function the car may drive under different lighting and track conditions, and allow the use of a different camera lens. Calibration expects two lines (3-10cm wide) spaced about 25cm apart with the car is sitting on in the middle of the track. If the calibration fails then make sure there are no objects near the track roughly 40cm in front of the car, and retry the calibration.
F2 - Tele-operation mode - This just writes video frames to the screen from the camera and reports the frame rate.
F3 - Pixel view mode - The RGB values for the pixel under the top left corner of the small purple square on the screen are displayed.
F1-F4 moves this square around the video picture and pressing F5 will update the local minimum and maximum RGB values found so far. F6 will then colour all pixels in this range purple.
F7 will clear the local min/max pixels values and resume as normal.
F4 - Processing time information -
This function will print the processing times
for different modules in recognising the track. The total time and frame rate
are also printed.
F5 - Camera position change - This function will grab a
frame and wait until the camera is moved and
F11 is pressed, where a second
frame is grabbed. A small string of pixels from the middle of the first
frame's search window is matched to the minimum mean squared error of the
same sized string of pixels any where in the second frame's search window.
The x,y shift is then printed on the screen, and should reflect the camera
movement. The search window is roughly 1/3 from the top of the screen and
appears as a grey scale band. The length of the string of pixels to match on
is found in the text file car.data
(in the same directory as car.c) where the
program will look for it.
F6 - 24 position steering - The track left to right
is broken up into 24 discrete areas where different control signals are sent
to the hand set, depending on where the car is in relation to the track. The
car should now drive.
To cancel driving press ESC and possibly hold it down
for at lest the time it takes for one frame to occur (about 0.5 sec). The
main menu should appear after some statistics have been collected. The file
terr.data
contains an error plot of error versus frame number, which may be
plotted in Matlab by running the terr.m
script accompanying these files.
F7 - 200 position steering - This is similar to above except the track is broken up into 200 discrete areas, with 200 discrete commands sent to the car. This smoother control is by far superior.
F8 - 200 position steering multithreaded execution - This is similar to above except the frame rate is higher due to multiple processes running. This method suffers from reduced accuracy in measuring control times, and may result in "TIME DELAY ERRORS" where the desired control time and actual measured time vary by more that 30%, and a stop command is immediately sent to the car at that frame. The car will drive faster, but be less accurate because of this reduced measurement accuracy.
F9 - 200 position careful synchronisation - Similar to F7, but the frame rate is slightly higher due to a careful synchronisation of driving the car and acquiring the frames. The car will drive slightly better than in F7, but not as fast as in F8.
F10 - Exit - quit the program.
The car battery will require around 150 minutes to recharge fully using the charger supplied. The camera/transmitter will take 30 minutes to charge using the power supply delivering 1.5 amps (about 20V) to the 750mAH batteries. This is achieved by pulling apart the in-line connectors from the battery packs (under the platform of the camera/transmitter) to the black box (voltage regulator) situated on the top of transmitter. The red and black wires from the battery packs are then connected to the power supply via the long blue lead and the short lead (to provide the correct male/female connector spades). Red to red and black to black colouring applies, and during recharging the battery pack must be switched to on. The battery packs are charged when the delivered amperage falls to a small value, say 200mA.
project home page
School of Computer Science and Software Engineering,
Monash University, Australia 3168.