Behavior-Based Robotics: 3.1 Approaches To Machine Intelligence
Behavior-Based Robotics: 3.1 Approaches To Machine Intelligence
Behavior-Based Robotics: 3.1 Approaches To Machine Intelligence
Behavior-based robotics
The quest to generate intelligent machines has now (2007) been underway for
about a half century. While much progress has been made during this period
of time, the intelligence of most autonomous robots in use today reaches, at
best, the level of insects, rather than the level of humans. Indeed, during the
last twenty years, many of the efforts in robotics research have been inspired
by rather simple biological organisms, with the aim of understanding and
implementing basic, survival-related behaviors in robots, before proceeding
with more advanced behaviors involving, for example, high-level reasoning.
These efforts have beem made mainly within the paradigm of behavior-based
robotics (BBR), an approach to machine intelligence which differs quite signif-
icantly from traditional artificial intelligence (AI). This chapter begin with a
brief discussion of the differences between BBR and AI. Next, a more detailed
introduction to BBR will be given. Finally, the topic of generating basic robotic
behaviors (by hand) will be considered.
39
40 CHAPTER 3. BEHAVIOR-BASED ROBOTICS
ious kinds, and even elevators, automatic trains, TV sets and other electronic
equipment. However, the intelligence of these machines is very far from the
human–level intelligence originally aimed at by AI.
To put it mildly, the construction of artificial systems with human–level
intelligence turned out to be difficult, for a number of reasons. First, intelli-
gence is hard to define. In a way, intelligence is a concept which is easy to
spot when one sees it (and it is even easier to spot its opposite), but it is still
difficult to produce a clear and unambiguous definition. Second, and perhaps
more important, human–level intelligence is, of course, extremely complex,
and therefore hardly the best starting point. The complex nature of human
brains is difficult both to understand and to implement, and one may say that
the preoccupation with human level intelligence in AI research has probably
been the most important obstacle to progress.
So, is it at all possible to generate intelligent behavior in artificial systems?
It is, but one must take a less narrow view of intelligence, and this is exactly
what is done in BBR, which is the main topic of this course.
Sensors
Sense
Avoid obstacles
Model
Wander Follow wall
Plan
Charge battery
Act
Actuators
Figure 3.1: A comparison of the information flow in classical AI (left panel) and in BBR
(right panel). For BBR, any number of behaviors may be involved, and the figure only shows
an example involving four behaviors.
likely find itself eaten before deciding what to do. Instead, as will be discussed
below, moths use a much simpler procedure.
As is evident from the left panel of Fig. 3.1, classical AI is strongly focused
on high-level reasoning, i.e. an advanced cognitive procedure displayed in
humans and, perhaps, some other mammals. Attempting to emulate such
complex biological systems has proven simply to be too complex as a starting-
point for research in robotics: Classical AI has had great success in many of
the subfields it has spawned (e.g. pattern recognition, path planning etc.), but
has made little progress toward the goal of generating truly intelligent ma-
chines, capable of autonomous operation. For a comprehensive introduction
to classical AI, see e.g. [35].
BBR, illustrated in the right panel of Fig. 3.1 is an alternative to classical
AI, in which intelligent behavior is built in a bottom-up fashion, starting from
simple behaviors, many of which may be running simultaneously in a given
robotic brain, giving suggestions concerning which actions the robot ought to
take.
Returning to the example of the moth, its evasive behavior is very simple
indeed, and is in fact based on only a few neurons and an ingenious position-
ing of the ears on its body. This simple system enables the moth to fly away
from an approaching bat and, if it is unable to shake off the pursuer, start to fly
erratically (and finally dropping toward the ground) to confuse the predator
[8].
robots are generally situated (i.e. operate in the real world), and many be-
haviors in BBR are reactive, i.e. have a direct coupling between sensors and
actuators. However, internal states, which provide the robot with, for exam-
ple, motivation (see Chapter 2) or short-term memory, are of course allowed
and are often very useful, but, to the extent that such states are used, they are
not in the form of abstract world models.
Note that, in BBR, it is often necessary to use simulations before an im-
plementation in an actual robot is attempted. While the use of simulations
represents a step away from the requirement of situatedness, the simulations
used in BBR differ strongly from the construction of abstract world models:
Just like a physical behavior-based robot, a simulated robot in BBR will rely
only on the information it can gather through its simulated sensors, and the
reading of a simulated sensor, in itself, never provides information that the
physical counterpart to the sensor would be unable to provide. However, no
simulation can capture all the facets of reality. Thus, it is important to test, in
real robots, any results obtained through simulations.
In general, the brain of a behavior-based robot is built from a set of ba-
sic behaviors, known as the behavioral repertoire. The construction of such
a brain can be considered a two-stage process: First the individual behaviors
must be defined (or evolved). Next, a system for selecting which behavior(s) to
use in any given situation, must be constructed as well. Clearly, in any robot
intended for complex applications, the behavioral selection system is just as
important as the individual behaviors themselves. For example, returning to
the example of the hospital robot, it is clear that if it starts to run out of power,
it must reprioritize its goals and quickly try to find a power supply, even if, by
doing so, it comes no closer to achieving its task of delivering objects. How-
ever, the topic of behavior selection (also known as behavior coordination or
behavioral organization), will be considered in Chapter 6. In this chapter, the
aim is simply to generate basic behaviors.
First law: A robot may not injure a human being, or, through inaction,
allow a human being to come to harm.
Second law: A robot must obey orders given it by human beings, except
where such orders would conflict with the first law.
Third law: A robot must protect its own existence as long as such protec-
tion does not conflict this the first or second law
SL SR
wlr wrl
ML MR
artificial neural networks, even though other architectures are certainly used
as well. For hand-coded behaviors, i.e. behaviors that are defined completely
by hand, neural networks are rarely used, simply because they are, by virtue
of the distributed nature of their computation, very difficult to generate by
hand. Instead, other architectures are used, and here architectures based on
simple if-then-else rules, combined with Boolean state variables, will be
considered. This architecture is particularly suited for hand-coded behaviors,
and can also be represented in the form of finite state automata. First, how-
ever, behaviors implemented as very simple neural networks will be discussed
briefly.
where wlr and wrl are the (positive) weights connecting the sensors to the mo-
tors. The ability of this robot to pursue a target is of course limited, to put
it mildly, and dependent on the values of the connection weights. If the con-
nection weights are made too large, the robot will tend to spin, whereas if the
weights are too small, it will have difficulties turning.
Still, with the proper choice of connection weights, a simple pursuer can
be made using only two neurons. Strictly speaking, the connections between
the sensors and the actuators are not neurons at all, but input elements, since
they only mediate the signals from the input and thus do not perform any
computation.
In the case just described, the training of the neural network would be very
simple: it would amount to setting the values of only two weights. Normally,
the neural networks used for robot control are much more complex, however,
and are often recurrent. As mentioned above, such networks are very difficult
to generate by hand, and are instead most often used in connection with ar-
tificial evolution, a topic that will be considered in the next chapter. For the
remainder of this chapter, hand-coded behaviors will be considered.
state of the enviroment using its sensors. With the updated sensor readings,
the robot then (2) selects an action, i.e. generates motor signals (one for each
motor), which are then sent to the motors, and (3) the position and velocity
are updated. Finally, (4) the termination criteria (for example, collisions) are
considered.
Note that, for such a simulation to be realistic (i.e. implementable in a real
robot), the time required, in a corresponding real robot, for the execution of
steps (1) - (2) must be shorter than the simulation time step. By default, the Mat-
lab simulator (ARSim) uses an updating frequency of 100 Hz (i.e. a time step
of 0.01 s), which is attainable by the simple (e.g. IR) sensors used here3 . Fur-
thermore, in the simple behaviors considered here, the deliberations in step (2)
usually amount to checking a few if-then-else-clauses, a procedure that a
modern processor completes within a few microseconds. At the end of step (2),
the motor signals can be sent to the motors which, of course, also must be able
to update their output within a time interval no longer than the time step, as
illustrated in Fig. 1.15 in Chapter 1. Cases where a motor with a slower updat-
ing frequency is used can easily be handled, simply by limiting the updating
frequency of the motor signals, regardless of the signals sent to the motor as a
result of the execution of step (2). Finally, an updating frequency of 100 Hz is
not unrealistic for a DC motor. However, also in this case, a state variable can
be introduced, limiting the allowed updating frequency (to a lower value).
The writing of basic behaviors for autonomous robots will be exemplified
in the form of a wandering behavior, which allows a robot to explore its sur-
roundings, provided that no obstacles are present. Other basic behaviors, such
as e.g. obstacle avoidance, wall-following etc. will be considered in the exercises.
Example: wandering
The task of robot navigation, in a general sense, is a very complex one, since it
normally requires that the robot should know its position at all times which, in
turn, requires accurate positioning (or localization), a procedure which will
not be considered in this chapter. However, simpler aspects of the motion
of a robot can be considered without the need to introduce localization. For
example wandering is an important behavior in, for instance, an exploration
robot or a guard robot that is required to cover an area as efficiently as possible.
Below, a few versions of wandering, with varying degrees of complexity, will
be considered.
The simplest form of wandering, following an asymptotically circular path,
can be achieved simply by setting the motor torques of the robot to different,
3
In cases where the simulation time step is shorter than the time required to update sensor
readings, a situation that may occur, for example, if binocular vision is used, a readability state
can be added to the simulated sensors, such that they are updated only with the frequency that
could be realistically achieved in the real robot, see also Chapter 1.
constant values. In the Matlab ARSim robot simulator, for each time step, the
motor signals are generated by the brain of the robot. After being rescaled to
the appropriate voltage range, the motor signals are then sent to the motors.
Next, the motors return the actual torque values, which are used in the inte-
gration of the equations of motion (see the MoveRobot function). The motor
signals are generated in the function BrainStep, which for the simple exam-
ple of a circular path takes the form shown in code listing 3.1.
Code 3.1: The BrainStep function for the first example of wandering.
1 funct i on b = B r a i n S t e p ( robot , time ) ;
2
3 b = robot . Brain ;
4
5 b . LeftMotorSignal = 1 . 0 ;
6 b . RightM otorS igna l = 0 . 5 ;
Note that the variable time is included in the BrainStep function, even
though this particular behavior does not use it. Using default parameter set-
tings, the motion of the robot during the first three seconds is shown in the
left panel of Fig. 3.3. In order to achieve a slightly more complex behavior, the
robot can be made to modify its motor torques with some probability p. In this
case, the average number of time steps between motor torque updates will be
∆N = 1/p. The parameter p can be set in the CreateBrain function which,
for this example, takes the form
Code 3.2: The CreateBrain function for the second example of wandering.
1 funct i on b = C r e a t e B r a i n ;
2
3 s = [0.5 0.5];
4 p = 0.01;
5
6 b = s t r u c t ( ’ LeftMotorSignal ’ , s ( 1 ) , . . .
7 ’ RightM otorS igna l ’ , s ( 2 ) , . . .
8 ’ TurnProbability ’ ,p) ;
Note that the initial values of the motor signals are set in the CreateBrain
function. At this stage, it is important again to note that a simulated robot
may only access information that would be accessible to the corresponding real
robot. In the simple behavior considered here, no sensory input is really needed,
but could nevertheless be used. For example, in a different implementation
of wandering the robot may be required to move a certain distance between
turns. However, even though the used of the simulator has easy access to
the position and direction of the robot at all times, providing this information
directly to the robot is not permissible, since it would not be available to a real
robot. However, if an odometer is added to the simulated robot, it would be
permissible to use its (noisy) readings for measuring distance.
1 5
0.8 4
0.6 3
0.4 2
0.2 1
0 0
−0.2 −1
−0.4 −2
−0.6 −3
−0.8 −4
−1 −5
−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1 −5 −4 −3 −2 −1 0 1 2 3 4 5
Figure 3.3: Motion of simulated robots, using the motor signal settings defined in code
listing 3.1 (left panel) and in code listing 3.3 (right panel). Note the different scales in the two
figures.
Code 3.3: The BrainStep function for the second example of wandering.
1 funct i on b = B r a i n S t e p ( robot , time ) ;
2
3 b = robot . Brain ;
4
5 r = rand ;
6 i f ( r < b . TurnProbability )
7 b . LeftMotorSignal = b . LeftMotorSignal − 0 . 1 + 0 . 2 ∗ rand ;
8 b . RightM otorS igna l = b . RightM otorS igna l − 0 . 1 + 0 . 2 ∗ rand ;
9 end
10
11 i f ( b . LeftMotorSignal > 1 . 0 )
12 b . LeftMotorSignal = 1 . 0 ;
13 e l s e i f ( b . LeftMotorSignal < −1.0)
14 b . LeftMotorSignal = − 1 . 0 ;
15 end
16
0.5
−0.5
−1
−1.5
−2
−2.5
−3
−3.5
−4
−3 −2 −1 0 1 2
Figure 3.4: Motion of a simulated robot, using the motor signal settings defined in code
listing 3.5.
Code 3.4: The CreateBrain function for the third example of wandering.
1 funct i on b = C r e a t e B r a i n ;
2
3 s = [0.5 0.5];
4 turning = f a l s e ;
5 p1 = 0 . 0 1 ;
6 p2 = 0 . 0 3 ;
7
8 b = s t r u c t ( ’ LeftMotorSignal ’ , s ( 1 ) , . . .
9 ’ RightM otorS igna l ’ , s ( 2 ) , . . .
10 ’ Turning ’ , turning , . . .
11 ’ T u r n P r o b a b i l i t y ’ , p1 , . . .
12 ’ S t o p T u r n P r o b a b i l i t y ’ , p2 ) ;
As is evident from the code listing, two additional fields have been included
in the brain. The Turning variable is true if the robot is turning, and false
if it is not. The TurnProbability and StopTurnProbability variables
set the probability of starting or stopping a turn, respectively.
Code 3.5: The BrainStep function for the third example of wandering.
1 funct i on b = B r a i n S t e p ( robot , time ) ;
2
3 b = robot . Brain ;
4
5 i f ( b . Turning )
6 r = rand ;
7 i f ( r < b . StopTurnProbability )
8 b . LeftMotorSignal = 0 . 5 ;
9 b . RightM otorS igna l = 0 . 5 ;
10 b . Turning = f a l s e ;
11 end
12 else
13 r = rand ;
14 i f ( r < b . TurnProbability )
15 s = rand ;
16 if ( s < 0.5)
17 b . LeftMotorSignal = 0 . 5 ;
18 b . RightM otorS igna l = − 0 . 5 ;
19 else
20 b . LeftMotorSignal = −0.5;
21 b . RightM otorS igna l = 0 . 5 ;
22 end
23 b . Turning = t r u e ;
24 end
25 end
In each call to BrainStep, the robot checks whether or not it is currently ex-
ecuting a turn. If it is, it checks whether or not it should stop turning, and
vice versa if it is not turning. The motion of a robot using the random wan-
dering behavior implemented in code listing 3.5 is shown in Fig. 3.4. Note that
a switch between two actions (for example turning or moving forward) alter-
natively could be implemented using leaky integrators, as described in the E.
Coli example in Chapter 2.