4.2. Obstacle avoidance with sensors

When do we need obstacle avoidance?

Obstacle avoidance is useful when something won’t let the robot to follow the line. Using sensors, the robot is able to detect if it has something in front.

A simple example where using avoiding obstacles is mandatory is that of a robot which cleans a room. It should be able to avoid chair legs, table legs, objects laid on the floor, people, etc. A robot that needs to clean the room would be useless if it bumped into something and got stuck there.

Using a perception-action cycle, the robot will analyze the environment and execute commands according to the sensor readings.

E.g.:

  • Has the sensor detected an obstacle ( perception )
    • YES - alter the route by going around the object (action)
    • NO - keep moving forward (action)

Legend:

  1. Objects are red
  2. The robot is green

Analog vs Digital

For obstacle avoidance the robot can use analog sensors, digital sensors or both.

Analog sensors are used when we want to know the distance between the robot and the obstacle. In our case, if we use the Analog Sharp 10-80 cm sensor, the robot will be able to detect an object placed between 10 and 80 cm.

Digital sensors are used when we only want to know if an object is placed in front of the robot. In our case, if we use the Digital Sharp 2-10 cm sensor, the robot will be able to detect objects placed between 2 and 10 cm.

Digital sensors have the advantage that their signal can be processed much easier than the signal coming from the analog sensor.

We will use for object avoidance a digital sensor.

Simple algorithm

A simple algorithm used for object avoidance is described below in pseudocode:

If(object is detected){
  stop moving forward;
  turn right (90 degrees);
  move forward X centimeters;
  turn left (90 degrees);
  move forward Y centimeters;
  turn left (90 degrees);
  move forward X centimeters;
  turn right 90 degrees;
}
roboticsisfun/chapter4/ch4_2_obstacle_avoidance.txt · Last modified: 2012/11/25 06:28 by liviu.radoi