Home Page Image

MIT Press
659 pp., 290 illus.
September 2008

ISBN-10: 0-262-06271-2
ISBN-13: 978-0-262-06271-8 


Exercises: Behavior-based Robotics


  • Lecture "Behavior-based Robotics" (see this brief summary on the subsumption architecture, if needed)
  • C-programming


The goal of this laboratory is to better understand the subsumption architecture (see this brief summary, if needed) by implementing a behaviour-based controller for a simulated industrial application, which would consist in transporting goods throughout a warehouse. This autonomous carrier must be able to follow some kind of track (e.g. a painted line on the ground), avoid obstacles found on its way and find its track again after disruption.

To do so, we will implement this controller in a simplified scenario, on a small research robot: the e-puck. The "track" is embodied by a black line and the robot is equipped with color sensors oriented toward the ground. The objects to avoid are, e.g., cubic elements or simple paper cylinders. The robot is positioned on the line before the run. The robot must be able to follow the black line. Whenever an obstacle blocks its way, it must leave the line and follow the obstacle until it reaches the line on the other side. At this point, it must be able to recover its initial behavior by following the line towards the goal.

Here is a clip demonstrating this behaviour:

Provided are some (partially) preprogrammed behavioral modules, which can be used as is or modified (see the comments in the code for details):
  • LFM - Line Following Module
  • OAM - Obstacle Avoidance Module
  • LLM - Line Leaving Module
  • OFM - Obstacle Following Module
  • LEM - Line Entering Module

One possible arrangement of those modules into layers (without the links) is given in this document.

Your job consists of organizing these behavioral modules into a subsumption architecture (see Figure 1) by programming the links among them. Of course, you can implement your own modules, if you find the provided one not suitable.

Figure 1 - An example of a behavior-based architecture for a robot controller (Brooks 1987)

The following mechanisms (see Figure 2) can be used within your subsumption-like controller:

  • Inhibition: used to prevent a signal being transmitted along a behavioral module's wire from reaching the actuators.
  • Suppression: prevents the current signal from being transmitted and replaces that signal with the suppressing message.
  • Sum: the transmitted signal is the sum of all incoming signals (note that this node is not present in the original scheme proposed by Brooks, but is likely to give rise to interesting competitions between two or more modules).
  • Reset: is applied directly to a module and forces it to recover a predefined initial state.

Figure 2 - Augmented finite state machine & behavioral module

Software & programming environment

As testing environment, we will first use the robot simulator Webots™ from Cyberbotics. If a good overall behavior is obtained in simulation then the behavior-based (BB) controller can be adapted and tested on a real e-puck robot. The required software are (1) Webots, and (2) a C compiler.

Webots can be downloaded here.

To launch Webots and prepare it for your application, follow these steps:

  • Download and unzip this file. Make sure to keep the directory structure.
  • Launch Webots by going into the file you just downloaded

webots worlds and clicking on e-puck_line.wbt.

  • First stop the simulation by clicking on the "play-stop" button.
  • Go into the preferences (menu Edit -> preferences...) and enter the following values:
    • Startup mode = Stop,
    • in the Rendering tab, activate the Display sensor rays option.

Note: do not change the name of the e-puck_line folder or of the file itself. Indeed, it is recommended to make backup copies of the e-puck_line.c controller by copying and renaming it in the same directory.

Finally, in order to learn how to interact with the simulator (change view, zoom in and out, etc.), have a quick look at the section 2.3 of the User Guide (reachable via the Help menu in Webots or by pressing F4).

The e-puck robot

In addition to the standard base and its 8 infrared proximity sensors (numbered from 0 to 7 starting from the front-right), it is equipped with three gray-level sensors (numbered from 0 to 2, starting from the left) oriented toward the ground.

The simulated robot is a quite accurate copy of the real one. The sensor ranges as well as the motor commands are approximately respected. White noise is added at different level to improve the "simulated reality".

A special library (embodied by a popup window entitled "e-puck"), is provided with Webots that allows for switching between simulation and reality (an e-puck robot must be connected on a Bluetooth virtual serial port). The same "e-puck" window displays the sensor and motor values in simulation as well as in reality.

Coding the behavior-based controller

First you should have a close look at the provided code (webots/controllers/e-puck_line/e-puck_line.c) and try to understand how it works and how the behavioral modules are implemented. Then, before trying to make the connections between the modules, take a piece of paper or print this sheet and prepare an outline of your architecture (see Figure 1 & 2 above).

Each of the links between the modules must be a clearly named variable. For sake of simplicity, we suggest to use global variables for this purpose.


created by claudio mattiussi, 2008