Page 174 - Introduction to AI Robotics
P. 174

5.2 Behaviors as Objects in OOP
                                                     Schema                           Behavior        157
                                              coordinated control program       coordinated control program

                                                                               *        *         *
                                        Perceptual   Motor      Behavior  Perceptual  Motor      Behavior
                                          Schema     Schema                Schema     Schema
                                                      a.                               b.
                                                    Figure 5.1  Classes: a.) schema and b.) behavior.




                                5.2   Behaviors as Objects in OOP

                                      Although Object-Oriented Programming (OOP) had not become popular dur-
                                      ing the time that the Reactive Paradigm was developed, it is useful to cast
                                      behaviors in OOP terms. Schema theory is well suited for transferring theo-
                                      retical concepts to OOP. Furthermore, schema theory will be used as a bridge
                                      between concepts in biological intelligence and robotics, enabling a practi-
                                      cal implementation of reactivity exploiting innate releasing mechanisms and
                                      affordances.
                                        Recall from software engineering that an object consists of data and meth-
                                      ods, also called attributes and operations. As noted in Ch. 3, schemas con-
                                      tain specific knowledge and local data structures and other schemas. Fig. 5.1
                                                                                           6
                                      shows how a schema might be defined. Following Arbib, aschema as a
                                      programming object will be a class. The class will have an optional method
                        COORDINATED   called a coordinated control program. The coordinated control program is a
                    CONTROL PROGRAM   function that coordinates any methods or schemas in the derived class.
                                        Three classes are derived from the 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 indepen-
                                      dent, 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 Mo-
                                      tor 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.
   169   170   171   172   173   174   175   176   177   178   179