Page 179 - Introduction to AI Robotics
P. 179

162
                                                                          5 Designing a Reactive Implementation
                                     wall (left) and follow_wall(right). Each instance of follow wall
                                     would receive the sonar polar plot and extract the relevant wall. The associ-
                                     ated class diagram is shown on the right in Fig. 5.2.
                                       In both implementations, the motor schema schemas ran continuously and
                                     the vectors were summed internally in order to produce a single output
                                     vector. Since there were multiple motor schemas, the coordinated control
                                     program for follow-corridor is not null as it was for move-to-goal. The vec-
                                     tor summation and the concurrency form the conceptual coordinated control
                                     program in this case.


                              5.2.3  Where do releasers go in OOP?
                                     The previous examples showed how behaviors can be implemented using
                                     OOP constructs, such as classes. Another important part of a behavior is how
                     TWO PURPOSES OF  it is activated. As was discussed in Ch. 3, perception serves two purposes:
                         PERCEPTION  to release a behavior and to guide it. Perceptual schemas are clearly used for
                                     guiding the behavior, either moving toward a distinctively colored goal or
                                     following a wall. But what object or construct contains the releaser and how
                                     is it “attached” to the behavior?
                                       The answer to the first part of the question is that the releaser is itself a per-
                                     ceptual schema. It can execute independently of whatever else is happening
                                     with the robot; it is a perceptual schema not bound to a motor schema. For
                                     example, the robot is looking for red Coke cans with the extract_color
                                     perceptual schema. One way to implement this is when the schema sees
                                     red, it can signal the main program that there is red. The main program can
                                     determine that that is the releaser for the move to goal behavior has been
                                     satisfied, and instantiate move_to_goal with goal=red. move_to_goal
                                     can instantiate a new instance of extract_color or the main program
                                     can pass a pointer to the currently active extract_color. Regardless,
                                     move_to_goal has to instantiate pfield.attraction, since the attrac-
                                     tion motor schema wouldn’t be running. In this approach, the main program
                                     is responsible for calling the right objects at the right time; the releaser is at-
                                     tached to the behavior by the designer with little formal mechanisms to make
                                     sure it is correct. This is awkward to program.
                                       Another, more common programming approach is to have the releaser be
                                     part of the behavior: the single perceptual schema does double duty. This
                                     programming style requires a coordinated control program. The behavior
                                     is always active, but if the releaser isn’t satisfied, the coordinated control
                                     program short-circuits processing. The behavior returns an identity function,
   174   175   176   177   178   179   180   181   182   183   184