CMUnited99 (code for on-line/off-line coach)
Patrick Riley <pfr+@cs.cmu.edu>
Computer Science Department
Carnegie Mellon University
Copyright (C) 1999 Patrick Riley

CMUnited-99 was created by Peter Stone, Patrick Riley, and Manuela Veloso

You may copy and distribute this program freely as long as you retain
this notice.  If you make any changes or have any comments we would
appreciate a message.
**********************************************************************************

(see README for an overview of the system)



**********************************************************************************
CONTENTS
**********************************************************************************
*Program Options
*The Set Play Coach
*How To Add Your Stuff


**********************************************************************************
PROGRAM OPTIONS
**********************************************************************************

All of the provided training modules have some specific options, which
are not documented here. There options are the ones which affect all
of the training modules. The trainer also recognizes all of the
options that the server takes.  All options can be given on the
command line as "-<option> <val>" or in an option file (with "-file
<optfile>") as "<option>: <val>".

cycles_to_store (integer): as discussed in shared/README, the memory
                           model can store information about several
                           past cycles. This specifies how many cycles
                           to store total. Generally you should store
                           at least 2 (the current cycle and the last
                           cycle).

alarm_interval (integer) 
max_cycles_since_io (integer): These options affect how the trainer
                               identifies when the server is dead. The
                               trainer has a constant alarm signal
                               running (whose interval is determined
                               by alarm_interval), and if enough
                               alarms come between ios from the server
                               so that max_cycles_since_io cycles must
                               have occurred (as judged from the
                               simulation_step parameter).

save_log (on/off): If this is on, then every message that the trainer
                   sends and every message it receives is stored in
                   the file "save.log"

team_name (string): when connecting as on online coach, you have to
                    specify the team to connect to.
  
coach_setplays (on/off): determines whether or not to send the messages
                         that coach set plays (provided as an example
                         of on-line coach use)

analyze_log (on/off): if 'on' then reads data from the log file
                      <log_fn>, otherwise, connects to the server as
                      an online coach

log_fn (string): if analyze_log is on, specifies the log file from
                 which to read


**********************************************************************************
THE SET PLAY COACH
**********************************************************************************

"Set plays" refer to stopped ball situations (like throw ins and free
kick) in which the players can arrange themselves in more or less
predefined position and execute a pre-compiled plan. However, since
the agents' visual perceptions are noisy, they used to have to negotiate
about which kind of set play to actually execute and who would fill
each role. 

The on-line coach (as used in CMUnited'99) simply says the "correct"
ball position for the set play whenever relevant, so that the agents
do not have to negotiate about that, making set play set up faster.

This is provided simply as an example of how the on-line coach may be used.

**********************************************************************************
HOW TO ADD YOUR STUFF
**********************************************************************************

You'll probably want to add a class to the memory hierarchy. The
current hierarchy is

Memory - SetplayInfo - PositionInfo - OptionInfo 
  
You could add your module above PositionInfo as follows. In the .h,
make sure that you #include "MemPosition.h". Then declare your class
as
class FooInfo : public PositionInfo

Then, in Memory.C, add a call to your Initialize method (if needed).

Of course, don't forget to add the .o to the Makefile.

Next, you want your stuff to be called. In client.C, there are several
comments like
/* INSERT CODE HERE! */
and a description of what function calls to add. There are three spots
to add calls: one for processing logfiles, one for processing visual
info in on-line coach mode, and one for processing auditory info in
on-line coach mode. Note that at these points the information has
already been parsed and included in the Mem structure (Exception:
currently auditory information is dropped completely, but it would be
fairly easy to put a record of it into the Memory structure).




