Make Your Own Patterns in Vision Command:
The are only 20 patterns supplied with Vision Command (VC) and many applications can't be implemented with any of them. For example, I wanted to make a player piano with VC. None of the existing patterns has the right geometry and all of them have regions that are too large. Here is how you can make your own patterns for VC. Many thanks to Rainer Balzerowski who did the pioneering work in this area.
Let's take apart a pattern to figure out how to make our own. Pattern 6 is a good one since it uses 8 regions. Here is what it looks like in VC.
You find all the files for pattern 6 at the end of this long directory path:
C:\Program Files\LEGO MINDSTORMS\Vision Command\data\hdData\VCSData\Regions\06
There are 19 files in this directory. Each one serves a special purpose:
1. XX.bmp is the actual pattern. It uses color to define the different regions. Here is what pattern 6's XX.bmp file looks like:
2. The .rle files contain the region visual targets that are superimposed on the image while you are programming. For example 00.rle looks like:
3. The files numbered 1 to 8 are used to indicate that a region is active. The appropriate region is totally filled in. For example 01.rle looks like:
4. There is a little icon just above the program stack in VC that shows which region is being edited. These icons are stored as 00.bmp through 08.bmp, with 00.bmp for the autopilot. Here is the 01.bmp file and the way it looks in the VC program:
That is all you need to know about the files to make your own pattern. It is a little tedious, but I made my first one in about 2 hours.
1. VC will pickup a new pattern as long as you put it into a folder with the next available pattern number. The first new pattern will be 21. In the folder with the existing patterns C:\Program Files\LEGO MINDSTORMS\Vision Command\data\hdData\VCSData\Regions\ you need to create new folder named 21.
2. Make a copy of all of pattern 6's files (or any pattern that is close to the one you want to make) and put them into the new folder. Make sure you have real copies of the files, not just shortcuts.
3. Now edit the XX.bmp, 0X.rle, and 0X.bmp files using Microsoft Paint. You need to use the little eyedropper tool to pickup the correct colors for each of the regions in the XX.bmp and the grey for the target patterns and .rle files. The regions in the 0X.rle and XX.bmp regions must end up in exactly the same place for this to work. Paint displays the cursor location in pixels at the bottom of the screen. Use it to make sure you have everything in the right place. The 0X.bmp files don't need to be pretty. I just draw a number in them to go with the region number and the letters AP for the 00.bmp file.
There you have it! A method for making your own patterns in VC.
Oh yea, about that player piano project. Here is a screen shot of my new pattern and a little of the VC program. As the light dots roll down in front of the camera, they pass by the small slit shaped regions triggering the playing of a 1/4 note. Region 1 plays middle C, 2 is D, 3 is E, etc.
Here is a photograph of the current prototype:
Here is a .zip with the files for the VC pattern it uses:vcpattern.zip
Here is an example Color Sensor pattern. It has all eight regions packed into a small box in the center of the image. The photo on the right is an enlargement of the corner of the pattern. I haven't been able to reliably sense 8 different colors with VC, but it works well with 4. Here is a .zip of the Color Sensor pattern files:colorpat.zip.
Here is the little Color Sorting Robot I built using the color sensor pattern:
Click Here to Return to the Vision Command Page