Welcome      Zaurus      Projects      Papers      Contact   

  CyTV - Network streaming for elgato EyeTV  

  OpenGL Grabber (Ogre)  

  Lego Mindstorms  

  Virtual Solar System  



  Overview    NQC code    Camera filter    Broadcast for VC    Download    Links   

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 different projects.

To uncompress the files in the download section, you can (for example) use WinZip.

Soccer robots

  Overview    NQC code    Camera filter    Broadcast for VC    Download    Links   

The source code for the soccer robots contains, among others, the following functions:

  • Driving along a wall (followBorderRight() and 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 Master Thesis).
  • 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 programming language used is NQC.

  Overview    NQC code    Camera filter    Broadcast for VC    Download    Links   

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.

Original image Recognized pixels Enlarged ball
Original image Recognized pixels Enlarged ball

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).

  Overview    NQC code    Camera filter    Broadcast for VC    Download    Links   

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.
  • Now switch on the rest of the robots and run the desired RCX program.
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.

  Overview    NQC code    Camera filter    Broadcast for VC    Download    Links   

NQC source code for soccer robots (10 KB)kicker.tgz
Camera filter for Vision Command (V0.2, 10/22/2001, 23 KB)camfilter.tgz
Soruce code of the camera filter (V0.2, 10/22/2001, 23 KB)camfilter_src.tgz
"VPBrick.dll" for Vision Command (see above) (24 KB)VPBrick.dll
Source code for "VPBrick.dll" (13 KB)VPBrick_src.tgz

  Overview    NQC code    Camera filter    Broadcast for VC    Download    Links   

Lego Mindstorms Homepagehttp://mindstorms.lego.com/
Lego Vision Command Homepagehttp://mindstorms.lego.com/products/vc/index.asp
NQC Homepagehttp://www.enteract.com/~dbaum/nqc/
Michael Gasperi's Vision Command Homepagehttp://www.plazaearth.com/usr/gasperi/viscommand.htm

Last update: 10/24/2001