Page 177 - Introduction to AI Robotics
P. 177
160
5 Designing a Reactive Implementation
The behavior is the “glue” between the perceptual and motor schemas.
The schemas don’t communicate in the sense that both are independent
entities; the perceptual schema doesn’t know that the motor schema ex-
ists. Instead, the behavior puts the percept created by the perceptual schema in a
local place where the motor schema can get it.
Behaviors can (and should) use libraries of schemas. The pfields suffix on
the pfields.attraction() meant that attraction was a method within
another object identified as pfields. The five primitive potential fields
could be encapsulated into one class called PFields, which any motor
schema could use. PFields would serve as a library. Once the potential
fields in PFields were written and debugged, the designer doesn’t ever
have to code them again.
Behaviors can be reused if written properly. In this example, the move to
goal behavior was written to accept a structure (or object) defining a color
and then moving to a region of that color. This means the behavior can be
used with both red Coke cans and blue trash cans.
5.2.2 Example: An abstract follow-corridor behavior
The move to goal example used a single motor schema with a single percep-
tual schema. This example shows how a potential fields methodology can
be implemented using schemas. In the corridor following example in Ch. 4,
the follow_corridor potential field consisted of two primitive fields: two
instances of perpendicular to the walls and one uniform parallel to the
walls. The follow_corridor field could be implemented in schemas in
at least two different ways as shown in Fig. 5.2. In one way, each of the
primitive fields would be a separate motor schema. The follow corridor mo-
tor schema would consist of the three primitives and the coordinated con-
trol program. The coordinated control program would be the function that
knows that one field is perpendicular from the left wall going towards the
center of the corridor, which way is forward, etc. They were summed to-
gether by the coordinated control program in the behavioral schema to pro-
duce a single output vector. The perceptual schema for the follow corridor
would examine the sonar polar plot and extract the relative location of the
corridor walls. The perceptual schema would return the distance to the left
wall and the right wall.
Another way to have achieved the same overall behavior is to have fol-
low_wall composed of two instances of a follow wall behavior: follow_-