Behaviors as Objects in OOP
Although Object-Oriented Programming (OOP) had not become popular duringthe time that the Reactive Paradigm was developed, it is useful to cast
behaviors in OOP terms. Schema theory is well suited for transferring theoretical
concepts to OOP. Furthermore, schema theory will be used as a bridge
between concepts in biological intelligence and robotics, enabling a practical
implementation of reactivity exploiting innate releasingmechanisms and
affordances.
Recall from software engineering that an object consists of data and methods,
also called attributes and operations. As noted in Ch. 3, schemas contain
specific knowledge and local data structures and other schemas. Fig. 5.1
shows how a schema might be defined. Following Arbib, 6 a schema as a
programming object will be a class. The class will have an optional method
called a coordinated control COORDINATED program. The coordinated control program is a
CONTROL PROGRAM function that coordinates any methods or schemas in the derived class.
Three classes are derived fromthe Schema Class: Behavior, Motor Schema,
and Perceptual Schema. Behaviors are composed of at least one Perceptual
Schema and one Motor Schema; these schemas act as the methods for the
Behavior class. A Perceptual Schema has at least one method; that method
PERCEPT takes sensor input and transforms it into a data structure called a percept. A
Motor Schema has at least one method which transforms the percept into a
vector or other form of representing an action. Since schemas are independent,
the Behavior object acts as a place holder or local storage area for the
percept. The Perceptual Schema is linked to the sensor(s), while the Motor
Schema is linked to the robot’s actuators. The sensors and actuators can
be represented by their own software classes if needed; this is useful when
working with software drivers for the hardware.
Using the Unified Modeling Language representation,55 the Schema and
Behavior classes look like Fig. 5.1. The OOP organization allows a behavior
to be composed of multiple perceptual schema and motor schema and even
behaviors. Another way of stating this is that the definition of a behavior is
recursive. Why is it useful to have multiple perceptual schema and motor
schema? In some cases, it might be helpful to have two perceptual schema,
one for say daylight conditions using a TV camera and one for nighttime
using infra-red. Sec. 5.2.2 provides a more detailed example of why multiple
schemas in a behavior can be helpful.
Recall that a primitive behavior PRIMITIVE BEHAVIOR is composed of only one perceptual schema
and one motor schema; there is no need to have any coordinated control
program. Primitive behaviors can be thought of being monolithic, where they
do only one (“mono”) thing. Because they are usually a simple mapping
from stimulus to response, they are often programmed as a single method,
not composed from multiple methods or objects. The concept of Perceptual
and Motor Schema is there, but hidden for the sake of implementation.
Behaviors which are assembled from other behaviors or have multiple
ABSTRACT BEHAVIORS perceptual schema and motor schema will be referred to as abstract behaviors,
because they are farther removed from the sensors and actuators than
a primitive behavior. The use of the term “abstract behavior” should not be
confused with an abstract class in OOP.
No comments:
Post a Comment