Roamerbot

I've been working on a Robot for a while and it's finally in a state that I can call working. Roamerbot seemed like a good name for it since it roams my house trying not to run into things. A previous post covers the parts used, if I find a good tool I'll try to create a nice schematic. Until then the setup is as following: 4 dc motors connected to the motor shield, 1 server connected to servo 1 on the shield and a Ping))) sensor connected to pin 2. To power the bot I use 2 sources, a 9v battery to power the Arduino board and Ping sensor and 5x1.5 AAA batteries to power the motors and servo. To hold everything in place i decided to use zip ties, not the most aesthetic solution but it works. The sketch used to run the bot is hosted on github. Most parts are quite simple, the only hack I had to add was that each time I measure range I do it 3 times and return the average. The reason for this is that in some cases (once every 20 or so times) I got a reading that was of, usually way to low, which caused the bot to start to get surrounding readings and then turn. Left to solve is to handle when the Bot runs into items that sits below the sensor so that they're not detected and the wheels just spins, might be a slightly harder problem to solve. Other fun things to add would be some kind of mapping to make it possible to build a 2d mapping of the room the bot is in. Roamerbot in action, had to chase it since it was running way for me.