On this page you can find some tools for Lego Mindstorms
which are part of my Master Thesis. Their purpose is
to make Mindstorms robots play soccer, but they can also be helpful in completely
To uncompress the files in the download section, you can (for example) use
The source code for the soccer robots
contains, among others, the following functions:
Driving along a wall (
followBorderLeft() in "kicker.h").
The robot moves quite fluently and quickly (of course dependent on the
construction). To use this function, you need a bumper with touch
sensors at the left and the right (see also my
The programming language used is NQC.
Recognition of different lightness shades, e.g. black - gray - white
adjustShades() in "kicker.h"). The special thing about this is
that the recognized shades don't depend on the absolute light sensor values.
Instead, the algorithm simply starts with the number of different shades that
should be recognized and learns the appropriate absolute
lightness values on its own. When overall lighting changes
(e.g. when turning on a lamp),
the recognition routine also adjusts itself automatically.
The Vision Command software is able to detect different colors,
but it fails to recognize small colored objects within large areas of the camera picture.
To improve recognition in this case, I wrote a
filter driver that can find and enlarge
small objects before the camera image reaches the Vision Command software. The
source code is also available.
Note: The first version available here contained a bug regarding the tolerance setting.
This is fixed in the current version.
Installing the filter is simple: First copy the file "camfilt.sys" into the folder
"C:\Windows\System32\Drivers" (or similar, depending on your windows installation).
"camtool.exe" can reside in an arbitrary folder. Then, to start using the filter, call
camtool -install 1
and restart Windows. To switch off the filter, call
camtool -install 0
(also requires a Windows restart). Please note that you may only be able do
delete the file "camfilt.sys" after switching off the filter.
The filter can be configured at runtime. The parameters are explained in detail in my
Master Thesis, so here's just an example how to
detect a red object and enlarge it for Vision Command:
camtool -color 0x00FFFF -tolerance 0x204080 -radius 8 -weight 9 -replacement 0xFF0000
You can test the filter settings by calling "
camtool -showFireflies 1".
This way, the filter shows the pixels the color of which it has recognized (see
picture in the middle above). Calling "
camtool -showFireflies 0" restores
the default enlargement mode. The current filter settings can be displayed using
camtool" (without parameters).
The filter has been tested under Windows 98, but using ME shouldn't make a difference.
According to Microsoft's documentation, Windows 2000 should be working too (though I
rather doubt that).
Vision Command (VC) can only talk to one RCX brick at a time. If there are several bricks
within the range of the IR tower, VC stops the current program and shows an error message.
The reason is that confirmation messages from the robots interfere with each other and
arrive garbled at the IR tower. However, it would often be useful to broadcast to
several robots at once, e.g. to send the position of the ball in a soccer game.
This problem can be solved with a new
"VPBrick.dll" that fools
Vision Command into thinking that sending messages is always successful. This way,
the VC program is not interrupted when several robots (or none at all) are within
range of the IR tower.
To install the "broadcast patch", you have to rename the file "VPBrick.dll" in the
Vision Command folder to "VPBrick_orig.dll". It has to be exactly this name, since the
new version needs the original to function and looks for it under this name! Afterwards,
you can copy the downloaded "VPBrick.dll" into the Vision Command folder.
Attention: DO NOT overwrite the original DLL, or you'll have to reinstall
the Vision Command software!
Please condsider that Vision Command wants to download a small RCX program to slot 5
of the robot
when you start a VC program. If none or more than one robot is in range at that time,
this fails (even with the new "VPBrick.dll"). For this reason, you must adhere to
the following sequence when using the broadcast feature:
- First, switch on a single RCX brick.
- Wait until Vision Command has finished transferring its program to the RCX.
If you DON'T want to use VC as a smart sensor (as described on
Michael Gasperi's Vision Command Homepage), you have to start
the VC program multiple times with a single robot switched on each time. This way,
all RCX bricks receive their program, one after another. This is necessary since simultaneous
download of the program to several bricks doesn't work (even with the new "VPBrick.dll").
After every robot has received the program, you can continue as described above and let
Vision Command control all of them at once.
- Now switch on the rest of the robots and run the desired RCX program.
Last update: 10/24/2001