Robot logic


Started thinking about the logic for the robot. The first one that I used in my prototype from LuckyLarry’s website seems to be too basic, so I did a quick brainstorm and came up with the flowchart above.  The logic adds the complexity of using a range finder sensor on top of the servo. Robot should drive forward, unless it encounters an obstacle closer than 20cm. Then it should stop, look around and determine the next free path it should go. The most challenging bits are the ones that I colored in red: this requires some sort of sensory “knowledge” of the direction of the robot. If I had a spare accelerometer, everything should seem more simple: just get the data from the accelerometer and calculate the direction of the robot when it turns. All I have now is just SRF05 range finder so another thought came to my mind. At the point after robot scans the surrounding area, it should know the distance to the surrounding area with 10 degree resolution. For example:

  1. -90 deg | 70 cm
  2. -80 deg | 60 cm
  3. -70 deg | 50 cm
  4. -60 deg | 50 cm
  5. -50 deg | 40 cm
  6. -40 deg | 40 cm
  7. -30 deg | 30 cm
  8. -20 deg | 20 cm
  9. -10 deg | 20 cm
  10. 0 deg | 20 cm
  11. 10 deg | 20 cm
  12. 20 deg | 20 cm
  13. 30 deg | 20 cm

According to the logic, robot should choose path (1) by turning -90 degrees. Considering that before the turning head is facing 0 degrees, it should continue turning, until it determines that the distance is more than 70cm to the closes object, so the range finder should read all the way from 20cm to 70cm with a threshold of +-5cm.

Huh, seems that hardware setup was the easiest bit. Building smart software to run the robot is a bigger challenge and that’s what makes this project so interesting. :)

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed.

Leave a Reply

Your email address will not be published. Required fields are marked *