Obstacle Avoidance

Background

The Obstacle Avoidance system is a system that takes in desired speeds for the right and left drive motors, asn well as distance readings from 5 ultrasonic sensors. Using this data the system allows the desired speeds through to the motor control system only if no obstacles are present. Otherwise, the system determines new desired speeds and directions to avoid any obstacles present.

The Code

The system uses 5 ultrasonic sensors to "see" what is around it and makes decisions based on how close any one of the sensors is to an object. If and object is seen the Groomba will steer around the object, if the object gets too close the Groomba will back up. All of the code to accomplish this is shown below.

DrivingObstacle Code
OAlibrary