=Paper= {{Paper |id=None |storemode=property |title= Robotic Dancing: Exploring Agents that use a Stratified Perceive-Decide-Act Cycle of Interaction |pdfUrl=https://ceur-ws.org/Vol-710/paper30.pdf |volume=Vol-710 |dblpUrl=https://dblp.org/rec/conf/maics/BenzeS11 }} == Robotic Dancing: Exploring Agents that use a Stratified Perceive-Decide-Act Cycle of Interaction== https://ceur-ws.org/Vol-710/paper30.pdf
      Robotic Dancing: Exploring Agents that use a Stratified Perceive-
                      Decide-Act Cycle of Interaction
                                                James Benze and Jennifer Seitzer
                                                  Department of Computer Science
                                            University of Dayton, Dayton, OH 45469-2160
                                             benzejaa@gmail.com, seitzer@udayton.edu




                          Abstract                                  agent. Additionally, we identify the “Follow” agent as the
  An autonomous agent is any intelligent entity that engages        agent which gets its percepts from the Lead, and executes
  in a perceive-decide-act cycle of interaction with its            its actions in response to the Lead’s actions.
  environment. In this paper we present a formalism using a         This kind of percept chain is applicable in many human
  stratified percept chain that renders an augmented                interaction situations. For example, these percept chains
  interactive cycle. In particular, we identify two kinds of
                                                                    are found in many kinds of partner dancing (Jitterbug,
  agents: a “lead” agent, who gains the percepts directly
  from the environment, and a “follow” agent, who gains its         Lindy Hop, Waltz, Tango, etc.), however any chain-of-
  percepts from the lead agent (as well as the environment).        command domain houses many problems and applications
  In this work, the lead agent procures percepts from the           that could benefit from the work and insights gleaned from
  environment, makes decisions based on this input, and             studying percept chains. Standard organizational structure
  passes these new orders in the form of secondary percepts         houses tiers of commands that are relayed down to lower
  onto the “follow”.                                                members of the organization.             For example, the
  We exemplify this formalism in the application area of            Commander in Chief is the head of the American Armed
  robotic dancing using models programmed in Alice, a               Forces. Any decisions made by him must be passed down
  programming IDE/language that facilitates the creation and        through the organization until it reaches the battlezone.
  visualization of autonomous agents.                               Being able to simulate this effect would lead to more
                                                                    effective military simulations.
                                                                       Obviously, when chaining stratified percepts together,
                      Introduction                                  one must be careful to keep the lines of communication
Autonomous agents achieve a level of intelligence by                clear. For example, consider the “Telephone game” played
participating in a continual feedback loop to and from the          by children. One child at the head of a line of children
environment. At the onset of the cycle, a percept is sent to        whispers something in the ear of the next child. This child
the agent from the environment; the agent then internally           tries to whisper the same message to the next person, and
makes a decision as to the action to perform next in the            so on until the entire line of children has been exhausted.
environment, and then lastly, the agent performs the                Finally the last child announces the message aloud. This
action. In this work, I have expanded this cycle of                 game becomes fun since rarely is message pronounced
interaction by involving two agent types: a “lead” who              clearly between all children, and the message received by
gets the percept directly from the environment, and a               the last child is usually not even similar to original. In
“follow” who gets its percept from the lead. This                   order to circumvent this problem, this project does not deal
stratification of percept sources is new and affords many           with a chain of intelligence agents, simply looking at the
interesting challenges in multi-agent intelligent systems.          relationship between one “lead” and one “follow.”
Stratified Percepts
   In this paper we are defining “stratified percepts” to be a
chain of percepts originating from the environment that are
interpreted by an intelligent agent, and then received by
another intelligent agent. We label the standard agent type
receiving its percept from the environment as the “Lead”
Cycle of Interaction                                            Alice
                                                                Alice was developed at Carnegie Mellon University in
                                                                order to provide an easy environment to teach beginner
                                                                computer science topics to introductory computer science
                                                                students. However, Alice also contains an integrated
                                                                graphics environment, allowing the easy placement of
                                                                lighting, human models, etc with minimal effort from the
                                                                developer. It was this factor that was crucial in our choice
                                                                of Alice as the development environment.
                                                                   One of the most challenging aspects in using Alice,
                                                                however, is its lack of synchronization objects. Although
                                                                Alice allows for many threads to run simultaneously (Alice
                                                                is based on Java), it provides no method of protecting
                                                                shared data. Because of this, creative ways had to be
                                                                employed to circumvent race conditions.


                                                                East Coast Swing
                                                                East Coast Swing was chosen as our application area for
                                                                several reasons: (1) the moves are relatively easy to
                                                                model, (2) it is typically an introductory dance, and (3) the
                                                                authors are both dancers and know East Coast Swing.
                                                                   In the swing dances, such as East Coast Swing, one
                                                                dancer is called the “Lead” (typically a male) and one
                                                                dancer is called the “Follow” (typically a female). The
                                                                Lead prepares the dance moves, and executes them at the
                                                                given time. He should also make it obvious to the follow
                                                                what he is doing. The Follow does her best to interpret the
       Figure 1: Single Agent vs. Multiple Agents               information given to her by the Lead (this information is
                                                                also called a “lead”). This dance is therefore an excellent
The actions of an intelligent agent are traditionally defined   representative of a stratified percept chain, since it
by a “Perceive-Decide-Act” cycle, as described above.           inherently requires a lead and a follow.
When multiple agents are to be chained together, the cycles
of one agent depends on the other, as demonstrated in
Figure 1.                                                                   System Design of DANCER
                                                                In the Alice architecture, everything is contained within a
      Implementation of System DANCER                           global class called “World”. The World, in this project,
We exemplify this formalism in the application area of          acts as the environment, and provides the original source
robotic dancing using models programmed in Alice, a             for the percepts.
programming IDE/language that is geared towards an                 Contained inside the world are the two intelligence
instructional computer programming and also facilitates         agents, once again designated the Lead and the Follow.
the creation and visualization of autonomous agents. Two        Each of these two classes are created with the Alice he/she
models of humans in Alice represent the Lead and the            builder, and is constructed of many smaller classes, each
Follow. The two models are then made to dance in the            representing a body part (forearm, neck, etc). This allows
style of East Coast Swing. The Lead interprets the “beat”       for the animation of individual body parts, so that the
given by the environment, and chooses dance moves to            follow and lead are each able to move in a dancing fashion.
portray, and tries to demonstrate them to the Follow               The Directional Light and the Bedroom classes are
through body movement. The Follow then takes this body          relatively unimportant. The directional light exists to give
movement and interprets it so that she can do the correct       a visual indication to the user of the beat created by the
move.                                                           world. The Bedroom is pure decoration, and was added so
                                                                that the Lead and the Follow would be on a wooden floor
(dancing is not often done on grass or sand, the two default    was used instead. This can serve the same purpose as a
ground textures for Alice worlds).                              musical beat, since a musical beat is just a repeated
  Finally, there are many “dummy objects” used in the           auditory impulse. A repeated visual impulse creates the
system. These are invisible placemarkers that contain only      same effect but through a difference sense. Since one
a location and orientation (yaw, pitch, roll). These are        sense is as good as any other for this project, a flashing
used as markers for the Lead and the Follow, and provide        light was deemed to be an acceptable substitute.
points of reference for their movement.




Figure 2: Classes in the East Coast Swing Enviornment



       The East Coast Swing Environment                                       Figure 3: System Algorithm

The Lexicon of Moves
In order to execute dance moves, both the lead and the          Lead
follow agent had to be programmed with a vocabulary of          The Lead agent has two primary responsibilities: to
movements that could be performed. Both the lead and the        interpret and act upon the information from the
follow agents were programmed with the ability to perform       environment, and to provide a clear percept to the Follow
the following dance moves:                                      dictating her actions.
         East Coast Basic                                          Clear interpretation of the beat of the music can be
         Inside Turn                                            challenging for many humans. In our system, the Lead
         Outside Turn                                           uses Alice’s internal timing function to record the time of
         Tuck Turn                                              each beat. By viewing the difference between each time,
         Repeaters (a variation on a tuck turn)                 the Lead can accurately predict when the next beat would
   By programming these moves into the library each agent       occur. This is essential in determining the speed in which
would be able to visually demonstrate its decision based on     to dance.
the percepts it received.                                          One problem was occurred due to the lack of
                                                                synchronization ability in Alice. Due to other system
                                                                processes running on the processor, there exists a
   The System Algorithm and Environment                         discrepancy between the pulses of light and the time that
                                                                they are recorded by the Lead agent. However, when no
  The purpose of the environment in this project is to          other projects were actively running on the system, the
provide the music for the lead to interpret. However, one       extra time variation was only about 0.06 to 0.09 seconds.
of the limitations of Alice is a limited ability to interpret   By subtracting 0.1 seconds from each recorded beat, and
music in the project. Although an audio file could be           by keeping the number of processes low, the recorded beat
played in the Alice environment, there was no way for any       by the lead is at or slightly below the beat provided.
object to intelligently interact with it.                          It was determined that having a recorded beat less than
  As such, a substitute for the music had to be found.          the provided beat was preferable than having the recorded
Instead of playing music in the background, a flashing light    beat to be greater than the provided beat. When the
recorded beat is less, the lead can simply pause, and wait
for the action to “catch up”, whereas if the lead was too
slow, he would simply be slower and slower until he has
fallen noticeably behind.
   To determine the specific move that the lead executes,
the lead simply uses Alice’s random number generator, and
randomly chooses a move. It then passes on this percept to
the Follow.




                                                                           Figure 5: DANCER during a turn

                                                                Lead-Environment Lag
                                                                As mentioned before, a lack of priority functions in Alice
                                                                causes the timer function not be entirely accurate. As such,
                                                                the timer between the lead and the environment had to be
                                                                adjusted with a 0.1 second reduction in time to account for
                                                                this. In addition, causing the processor to work a large
                                                                number of tasks will cause this timer to displace even
         Figure 4: DANCER preparing a turn                      more. As such, the program should only be run in parallel
                                                                with as few other programs as possible. No lag exists
Follow                                                          between the Lead and the Follow, since no system clock is
The follow program receives its variables through a             used, only a function call.
function call. There are four different variables that are
passed to the function as forms of “leads”: The lead from       Multiple Threads Between Lead-Follow
the left hand, the lead from the right hand, the beat of the    Originally, the plan was to have the Lead and the Follow
music, and the distance between the two agents. The first       run in separate threads, and for the Lead to send some sort
two inputs should be obvious. These are the physical            of signal containing the leads to the Follow in order to start
connect between the head and the follow. With is left and       her motion.      However, the lack of synchronization
his right hand, he provides motions to direct the follow.       elements available in Alice made this unfortunately
The beat parameter is slightly more subtle, but in leading,     impossible.     There was too much lag between the
the Lead pulses slightly, and in this way can transfer his      interactions between the two agents, which caused either
knowledge of the beat to the Follow.                            too great of a delay in the Follow’s actions. As such, a
  The distance parameter represents the translational           simple function call was used to pass percepts between the
velocity that the lead transfers to the follow. Doing certain   two agents.
moves the lead doesn’t just cause the follow to spin, but
causes her to translate as well. The distance parameter
represents this type of lead.
  The follow uses a nested if statement to determine
further course of action. She also takes her current
momentum into account while determining further courses
of action. The momentum is a variable set from previous
moves.




                                                                   Figure 6: DANCER during the East Coast Basic
          Conclusions and Future Work                                                 Summary
An example of an interaction between two hierarchical           Although this project accurately can portray a stratified
agents was successfully modeled between the Lead and the     percept chain, further testing and modeling is required
Follow. However, many of the challenges have inspired us     should be performed in order to more accurately and
to probe further in future work as we describe here.         effectively model this style of relationship between
                                                             intelligent agents. The temporal aspect of decision making
Clearer Communication between Agents                         is much more important in hierarchical agent relationships,
Currently, all percepts are passed directly and digitally    and methods of communication must remain remarkably
between the Lead and the Follow, guaranteeing clear and      clear in order for lower agents on the hierarchy to remain
precise communication. However, in real world scenarios,     effective. Experimenting with ways to recover from these
the communication between agents may become unclear.         kinds of errors will vastly improve the robustness of
An example of this is perfectly clear in the Telephone       hierarchical agents and will allow us to more accurately
game mentioned earlier. The specifics of a whispered         understand this style of interaction.
message will become garbled over time, since one is
difficult to hear.                                                                   References
   Because of this potential problem methods should be
implemented so that the Follow will approximate the          Alice.org, Available:   http://alice.org [Accessed:   March 22,
closest action based on the decisions given. The other       2010].
agents should be able to gracefully recover from a
mistaken decision.                                           Alice—Project Kenai, Available: http://kenai.com/projects/alice
                                                             [Accessed: March 22, 2010].
Recovery After a Delayed Response
One of the problems experienced in programming this          W. Dann, S. Cooper and R. Pausch, Learning to Program with
project was that the Follow would sometimes have             Alice, Upper Saddle River, New Jersey: Pearson Education, Inc.
drastically delayed responses from the Lead. This could      2006.
cause a desynchronization between the two Agents.
Methods should be employed so that the Lead agent could      LEGO.com          MINDSTORMS:            Home,         Available:
gracefully recover from this separation.                     http://mindstorms.lego.com/en-us/Default.aspx         [Accessed:
                                                             March 22, 2010].
Multiple Inputs
In this situation, each agent has a clear superior: The
Lead’s actions are governed by the environment and the
Follow’s action are governed by the Lead. However, in
many situations, the Agents must receive input from
multiple sources. For example, what if the Follow was
able to receive input from the environment as well as the
Lead? This input could be constructive (the Follow using
the input musical beat in addition to the beat received by
the lead to more accurately dance), or destructive (A fire
alarm sounds, and the Lead ignores it. Does the follow
obey input from the Lead and dance, or from the
Environment, and leave the room. Both types of input will
have to be considered.

Whisper-Down-the-Lane Agents
Here, an agent relationship was successfully demonstrated
between a single Lead agent and a single Follow agent.
This interaction could be expanded to chain of lead-follow
Agents. Care would have to be taken to further reduce the
risk of the other problems listed here.