YellowBot Source Code
I have not put togethger documentation for my Bots code. The code is evolving too quickly for detailed up front documentation. I would like tos tate that a primary goal of doing this Bot was to help me learn Object Oreinted Programming, as well as get me used to programming again. it's been 20 years since I've written something more than a simple shell. python or Perl script.
Thus I will warn you this code is chocked full of redundancies and inefficiencies. Bear with me, an old dog is learning new tricks, it's just taking time :)
Version 1 was based on the simple object avoidance approach: Go until an object is detected. When detected stop, look left, look right. determine best direction to go. Turn in that direction and wander on. The only real downfall to this architecture is that the Bot can get hung up on things that are just off to the side of the sensor. You have to sweep the sensor back and forth, across the width of the bBt, to insure that the whole path is clear.
That's where V2 of my code comes in. I figured out how to test the path while sweeping the sensor side to side. When an obstacle is detected the Bot determines if it's to the left or right and turns the other way. This code is still crude. futurer improvements include seeing if an obstacle can be avoided with out stopping along with proportional turning radius. Plus making improvements on functions and classes as I learn.
My code is pretty well commented, so I will let it speak for itself. I