Robot Soccer Player

   Pattern recognition techniques are useful machine vision.   Machine vision is often used mobile robotics, as a technique to aid in navigation.

   As a tutorial in machine vision, I decided that I would build a robot that will push a red playground ball down a hallway, and hopefully into the professor's office.

 The architecture of the robot can be seen in the block diagram below:

The robot base is salvaged from an old radio controlled bulldozer.   It uses two motors, one for each track.   Turning is achieved by running one motor forwards and the other backwards (spin in place) or by running the motors at different speeds (gradual turns).   The motors speed and monitoring is controlled by a custom micro-controller.   Extra ports will have other sensors attached to them, such as impact sensors.

The micro-controller communicates with an IBM Thinkpad running Linux through the serial port.

The camera is a  Connectix black and white Quickcam .   This device plugs into a parallel port and has drivers for Linux.   The host computer can set brightness, contrast and white balance.   Depending on the software package, you can grab images up to 320x240 at six bits per pixel.


While browsing around I came across a package called  ximprov .    This package provides "basic real time image processing with low resolution, e.g. suitable for mobile robots".   A screen shot can be seen here:

This package will take images at a resolution of 160x120 , 4bpp at a moderate frame rate (2-6 frames per second) on my pentium.   The nifty thing about this program is that the initial image appears in the top left window, and then you can apply image processing algorithms to it, watching the results in subsequent windows.

The unfortunate thing is that while the basic operations are there (thresholding, edge detection, etc.) some of the really useful ones from class aren't (fft, Walsh, Hough).    Additionally, while you can filter the images, the program does not have any significant features for extracting the information.   Fortunately, the package comes with source code, and information on how to add your own image processing functions.

So the "backend" interface to the hardware will be a "filter" in the menu that will take the final picture and extract values from it to be sent to the motor controller.


Fortunately the academic buildings that will be the test environment were built with typical 1960's aesthetics.   The floors are basically a white tile that has yellowed to a light gray over the years, with white walls, and wooden doors.   At the base of the walls is a "kick strip" which gives a nice black line marking the edge of the floor.   The door frames are dark brown.   The ambient lighting is fluorescent.   Glare on the floor seems to be minimal when I lay on my tummy and look at the floor (the height of the robot's Quickcam).   If the ball is used it is a dark red.

First attempts at distinguishing a red ball from the background junk in my lab with a black and white camera proved to be challenging.   On a white piece of newsprint there is no problem, but when the there are also black objects, the red and the black look almost the same.   I attempted color filters, and interestingly enough, when a red filter is placed in front of the camera, the ball turns the same color as the white background.   This would be useful, to distinguish the ball from dark objects, but not light objects.   When a blue/green filter is used, the ball turns black, but then it is not possible to distinguish the ball from dark objects.   In my trial findings I could get a portion of the ball from the ximprov filters, but to distinguish the whole object with just 16 gray levels doesn't seem possible using simple techniques.

So, something higher tech is in order.

The main features in the scene will be the black kickstrips that will show up as lines, the ball which will show up as a dark gray object, and the doorways will show up as holes in the kickstrip.

Extracting the kickstrips and the ball seem as though they may be best accommodated with the Hough transform.   If it can fit lines and a circle on top of the kickstrips and ball respectively.   Once we have a circle we have a center.   Once we have the center we know where the ball is in relation to the camera's field of view.   The drive system can then try to center the ball in the robot's field of view.

From the lines we can determine if the robot is centered in the hallway.

From the doorframes we can determine how far down the hall we have gone.

From the doors, we can determine if the door is open and if we should try to go through it.   :)


Click here to see the rest of the story!