The Braitenberg vehicle 2a and 2b, , that was implemented as LEGO vehicles in
Lesson 6, only one
behavior can be seen by an outside observer: drive towards light or drive
away from light.
In this lesson we will use the behavior control paradigm,  and , to
implement several observable behaviors
on a single NXT that controls a LEGO vehicle with an ultrasonic sensor, a light sensor
and two touch sensors (click on the image to see details):
The base vehicle fron Lesson 6 has been augmented with a bumber,
an ultrasonic sensor and a light sensor mounted as shown in the fotobased building instructions
for a base car with extensions.
The classes for this Lesson can be downloaded as Programs.zip.
LEGO vehicle that exhibits a single behavior
Chapter 9 in  presents how to implement the behavior control paradigm. Each behavior
is a simple mapping from sensors to actuators as described for the single avoid behavior
shown in Figure 9.3 of .
The program AvoidFigure9_3.java
implements the avoid behavior with a single ultrasonic sensor. Download the program and
observe the car. Describe how the car behaves. Change the program so that the car drives backward
a little when all the tree distances, leftDistance, frontDistance, and
rightDistance are less than stopThreshold, and
then the car should spin around on the spot 180 degrees.
Behaviors as concurrent threads
In section 9.5 it is shown how to implement the behavior control network of Figure 9.9, 
by means of processes in the language IC (Interactive C):
The program RobotFigure9_9.java
implements the Avoid, Follow and Cruise behaviors
and the arbitration mechanism suggested on page 306 in . Download the program and
observe the car. Describe how the car behaves. Try to describe the conditions that trigger the different
If you look into the
program RobotFigure9_9.java you will see that there are three objects:
Avoid avoid = new Avoid(car);
Follow follow = new Follow(car);
Cruise cruise = new Cruise(car);
Each of these objects are threads that are created and started by the main
program and thereafter they run concurrently with the main thread.
Each of these threads represent a single behavior: cruise makes
the car drive forward, follow uses the single light sensor to follow bright light in the environment
and avoid uses the single ultrasonic sensor to avoid objects in front of the car.
Look into the three classes and try to identify how the triggering conditions
are implemented in each of the classes and how the actions for each behavior is implemented.
Try to watch the car with only the cruise thread active and then with only the
cruise and the follow threads active to observe the behaviors more clearly.
Add an Escape behavior
In the Figure 9.9 the top priority behavior is Escape. An implementation of Escape in IC
is given on page 305 of . Implement the Escape behavior in the RobotFigure9_9.java program.
Add a third motor to turn the light sensor
In the fotobased building instructions
for a base car with extensions it is shown how a horizontal motor can be added
to the base vehicle
Mount the light sensor so it can be turned by this horizontal motor. Use this mechanism to re-implement the Follow
behavior so instead of turning the car to get readings to the left and right, the horizontal motor is used.
The classes SharedCar and Arbiter
Describe how the classes SharedCar and Arbiter implements the arbitration suggested on page 306 in .
Compare this with the arbiter of Fred Martin, [4, page 214-218].
Braitenberg, V. 1984. Vehicles, Experiments in Synthetic Psychology
London, Cambridge: The MIT Press.
Jones, Flynn, and Seiger,
"Mobile Robots, Inspiration to Implementation", Second Edition, 1999.
Rodney Brooks, A robust layered control system for a mobile
robot, IEEE Journal of Robotics and Automation, RA-2(1):14-23,
1986, also MIT AI Memo 864, September 1985.
Fred G. Martin,
Robotic Explorations: A Hands-on Introduction to Engineering,
Prentice Hall, 2001.
Last update: 20-1-17