Screenshots     Download     Documentation     Tutorials     Partners     Resources     Contact     Forum     Search  

 
<<Prev 1 2 3 4 5 6 7 8 9 10 Next>>

Ball Picker Pipeline

The vision processing pipeline also has some basic logic in it to switch from looking for blue blobs to red blobs. The conditional in the pipeline uses the same state variable that is specified in the VBScript program. You can also see the ordering of the modules which is important since all the processing modules need to run before the VBScript module in order to provide the most current numbers. The Lego NXT control module needs to be after the VBScript program since the VBScript program is where the LEFT_MOTOR and RIGHT_MOTOR values are set. Note that the # comments are not displayed in RoboRealm.
# blur the image so we get better color detection
Mean filter 7
# detect blue blobs if we're looking for the blue ball
if state < 3 then
--RGBFilter Blue
  # reduce image flickering esp in darker shadows
--Flicker 3, 50%
  # filter the current blobs to yield the most ball like
--Blob Filter
end if
# check if we should be detecting the red cone
if state >= 3 then
--RGBFilter Red
  # and filter on something large
--Blob Filter
end if
# analyze the resulting single blob for location and size
Center of Gravity
# use the blob statistics to set motor variables
VBScript Program
# communicate those motor values to the NXT
Lego_NXT

Note that you can change the filters to detect other colored objects or insert new modules to detect other aspects of objects.

Now lets see it in action!

<<Prev 1 2 3 4 5 6 7 8 9 10 Next>>

© 2008 RoboRealm. All Rights Reserved. | Contact | Glossary | Privacy | Disclaimer | Link to Us | Resources | Site Map