Page 96 - Introduction to AI Robotics
P. 96

79
                                      3.3 Coordination and Control of Behaviors
                                      with predator movement) or a group of neurons which do the equivalent of
                                      a computer algorithm.
                                        Another important point about IRMs is that the releaser can be a compound
                  COMPOUND RELEASERS  of releasers. Furthermore, the releaser can be a combination of either external
                                      (from the environment) or internal (motivation). If the releaser in the com-
                                      pound isn’t satisfied, the behavior isn’t triggered. The pseudo-code below
                                      shows a compound releaser.
                                        enum             Releaser={PRESENT, NOT_PRESENT};
                                        Releaser         food;
                                        while (TRUE)
                                        {
                                           food = senseFood();
                                           hungry = checkState();
                                              if (food == PRESENT && hungry==PRESENT)
                                              feed();
                                        }

                                        The next example below shows what happens in a sequence of behaviors,
                                      where the agent eats, then nurses its young, then sleeps, and repeats the
                     IMPLICIT CHAINING  sequence. The behaviors are implicitly chained together by their releasers.
                                      Once the initial releaser is encountered, the first behavior occurs. It executes
                                      for one second (one “movement” interval), then control passes to the next
                                      statement. If the behavior isn’t finished, the releasers remain unchanged and
                                      no other behavior is triggered. The program then loops to the top and the
                                      original behavior executes again. When the original behavior has completed,
                                      the internal state of the animal may have changed or the state of the environ-
                                      ment may have been changed as a result of the action. When the motivation
                                      and environment match the stimulus for the releaser, the second behavior is
                                      triggered, and so on.

                                      enum             Releaser={PRESENT, NOT_PRESENT};
                                      Releaser         food, hungry, nursed;
                                      while (TRUE) {
                                         food = sense();
                                         hungry = checkStateHunger();
                                         child = checkStateChild();
                                         if (hungry==PRESENT)
                                            searchForFood(); //sets food = PRESENT when done
                                         if (hungry==PRESENT && food==PRESENT)
                                            feed(); // sets hungry = NOT_PRESENT when done
   91   92   93   94   95   96   97   98   99   100   101