profmason.com

January 22, 2009

Color Tracking Spykee

Filed under: Daily — profmason @ 7:28 pm

I finally got the Spykee all put together tonight and working on the network.  I think it is easier to run it in AD HOC mode, then to poke holes in the firewall for it.

Here is a brief summary of what to do to get it working with ROBOREALM:

1.  Turn on your Spykee robot.  Wait for it to make 2 beeps.  This means that it has connected in Ad Hoc mode.  If it makes three beeps then it has connected to your router. If that happens do the following:

1.  Download the erector software:
http://www.spykeeworld.com/spykee/US/index.html
2. Follow the instructions in the manual on pages  14 and 15 to set your robot to boot in Ad Hoc mode.
3. Reboot the robot and wait for the two beeps.

2. Click on your wireless settings and select the Spykee robot.  It should show as an Adhoc device.  Connect to this device.  It will take about 20-30 seconds.
3. Open up roborealm.
4.  Under controls select Robots -> Spykee.
5.  The default address for the Spykee in roborealm is 172.17.6.1  If you haven’t changed your administrative password, you can just log right in.
6. If this fails, your robot may have used a different port.  Try the following, close roborealm, open the Erector software, log in to the robot, and click on the settings button (looks like a gear).  Click on the picture of a robot and note the IP address that the robot is using.
7.  Close the Erector software and reopen roborealm.  Use the new address.

Once it is working with Roborealm, you can try the example software that is included with the module.  Unfortunately this doesn’t work well, since the frame rate of the camera is low (at least in my case) relative to the speed of the robot.

Here is a video of the robot navigating between two pins.

As I have time, I will include a step by step tutorial.

Here is what is going on under the hood.

  1. Let’s start with the original image:  Note that my floor has a fair bit of texture in it.  I have covered the persian rugs up, since they are a nightmare for computer vision!  The object is clearly visibile in the image.
  2. Now I will apply a max RGB Channelfilter.  This will take each pixel and replace it with the strongest RGB value channel component.  This will give me good color segmentation and the module is not very CPU intensive. (Unlike the flood fill)  Here are the results of the max RGB filter.
  3. Now the pin is extremely distinct from the background. I will now apply a color filter to remove all the pixels that don’t have an RBG value of 255,0,0.  I am using the RGB filter choosing red.  This is again a fast filter. I could be more efficient since I know that my red channel is 255,0,0 but at this point I am not CPU imited.  Below are the results of the RGB filter:
  4. Now we have seperated the pin out from the background nicely.  We still need to clean it up, so I will now do some particle analysis. A particle is a group of connect image pixels. A pixel is connected to a neighboring pixel when both pixels have the same intensity (within some error)  First thresholding is done on the entire image and then treating the image as a matrix, you identify contiguous non zero values.  In this case I will use the blob filter and and set it to just identify the object in the image that has the largest area. (number of pixels.   Here is the result.
  5. Now we will calculate the center of gravity of the image.   This will give us a set of coordinates for the image relative to the center of the image.
  6. Finally we can tell the robot how it needs to move using a bit of VBScript.  We want to center the desired object in the image and when it is sufficiently centered, move the robot toward it.
  7. Here is the file erector_spykee_example2.robo.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress