<<Prev 1 2 3 4 5
Obstacle Avoidance
Notes:
1. Three techniques were discussed with the final technique being the most stable given the
test images we used. Your experience will be different. It is worth testing each technique on your own images
to get a sense of how stable they are and which one will work best for you.
2. Keep in mind when moving the code into a robotic control that the horizontal erode is used as a gauge to the
robot's width. You will have to experiment with your setup to determine which erosion width is best for your
robot.
3. The final variable displayed has the X value of the goal point. That X value should be then used by your
application or within the VBScript module to create a value that will control your servos. It could be as simple
as
x = GetVariable("HIGHEST_MIDDLE_X")
midx = GetVariable("IMAGE_WIDTH") / 2
leftThreshold = midx - 50
rightThreshold = midx + 50
if x <= leftThreshold then
SetVariable "left_motor", 0
SetVariable "right_motor", 255
else
if x >= rightThreshold then
SetVariable "left_motor", 255
SetVariable "right_motor", 0
else
SetVariable "left_motor", 255
SetVariable "right_motor", 255
end if
end if
which will rotate the left and right motors towards the goal or go straight if in the middle. Keep in mind that the above only
creates two variables (left_motor and right_motor) that need to be selected in the appropriate hardware control module.
You will have to adjust the values
for your robot based on what servos, motors, etc. you are using.
Your turn ...
Want to try this yourself? Following is the robofile that should launch RoboRealm with the original image
we used in this tutorial. You can click on each of the steps in the pipeline to review what the processing
looks like up to that point.
Download Edge robofile
Download Blob robofile
Download Floor Finder robofile
The End
That's all folks. We hope you've enjoyed this little adventure into an application of machine vision processing
and have inspired you to download a free trial of our software.
If you have any questions or comments about this tutorial please feel free to
contact us.
Have a nice day!
<<Prev 1 2 3 4 5
|