more, there are some books to
check out in the sidebar. Okay, I’ve
introduced you to new terms and
concepts perhaps. Now, you need
to know how to design and
implement them, so read on.
Designing a
Subsumption
Architecture
Figure 1
implementing behaviors in your
robots. (This way, the next time you
hear someone say “Braitenberg Type
2” robot, you’ll know exactly what
they are talking about!)
This is going to be a very simple
introduction to behavioral
programming, involving only a few
behaviors. The beauty of the
system, however, is that you can
layer on more behaviors as you get
them to work without modifying
existing ones. This means that your
behaviors are modular and can be
modified without worrying about
other behaviors that are currently
working fine. Your emergent
behaviors might change, however ...
Our new Roomba code will have
three defined behaviors to start with:
I am going to discuss basic
subsumption architecture in this
article. There are variants on this
theme. A behavioral module may have
inputs that are suppressed and
replaced with other inputs. Or, it may
have outputs which can be inhibited
to allow outputs from other modules
to be used. We will keep this
discussion focused on suppressors and
timers.
1. Wander
2. Escape
3. “I see a wall”
Listing 1: DoWanders behavior code.
void DoWander(void)
// Define a wander algorithm, or just go straight.
{
if (priority < wander)
{
Serial.println("Wander");
priority = wander;
GoForward();
}
}
Listing 2: RoombaBehave1 main Arduino loop.
/*
* The nice thing about state machines is that they allow your
* main loop to be really simple.
*/
void loop(void)
{
UpdateSensors();
DoWall();
DoWander();
DoAvoid();
DoEscape();
DoPanic();
}
The first two behaviors control
the drive motors that move the
Roomba around. The third one just
lights up LEDs and turns on the
sweeper motor to tell us that it saw a
wall with the wall sensor.
Figure 1 shows what the
subsumption network looks like using
these three behaviors.
In Figure 1, each of the square
boxes are behaviors. The Do Wall
behavior stands by itself and has a
sensor input and output actuators
that are LEDs and the sweeper brush.
That behavior isn’t all that interesting,
but this is how it is represented.
The next two behaviors have
subsumption characteristics. The
Do Wander behavior has no sensor
input, but it does run the motors. As
you can see in Listing 1, Do Wander
just makes the robot go forward —
not interesting, but it does something.
The DoEscape behavior has a
higher priority than Do Wander, and
12 SERVO 04.2013