%=====================================================================
\section{The TaskMuster Behavior}
%=====================================================================
\label{sec_bhv_tmus}

The {\em TaskMuster} behavior is a behavior for participating in a
decentralized auction among a group of vehicles, to determine which
vehicle is most appropriate to transit to a given muster region. In
this simple behavior the auction bit is solely based on linear
distance to the center of the muster region. Most of the functionality
of this behavior is comprised of the \var{IvPTaskBehavior} superclass.

\vspace{0.1in}
\begin{figure}[H]
  \centering 
  \includegraphics[width=0.5\textwidth]{figures/task_behaviors.png}
  \caption{{\bf Task Behaviors:} A task behavior are behaviors of the helm
    just like any other behavior. They all have the \var{IvPTaskBehavior}
    superclass to support the common components needed to participate
    in inter-vehicle auctions.}
  \label{fig_task_behaviors}
\end{figure}
\vspace{0.1in}

\noindent
The primary function of a task behavior, like the \var{TaskMuster} behavior,
is to participate in an inter-vehicle auction. The high-level view of an auction
is shown in Figure \ref{fig_auction} below.

\vspace{0.1in}
\begin{figure}[H]
  \centering 
  \includegraphics[width=0.75\textwidth]{figures/task_progression.png}
  \caption{{\bf Task Behavior Progression:} A task behavior proceeds
    through the states shown, beginning from initial spawning by the
    task manager, and generation of bids to collaborators. Depending
    on ownship bid compared to collaborators, the task behavior will
    generate further publications, i.e., flags, that will spawn the
    appropriate behavior to perform the task. The primary difference
    between different task behaviors is in the implementation of bid
    generation.}
  \label{fig_task_progression}
\end{figure}
\vspace{0.1in}

%=======================================================================
\subsection{Configuration Parameters}
\label{sec_twpt_params}

Certain configuration parameters available to LegRun behavior are are
unique to the LegRun behavior and others are inherited from the
\var{IvPBehavior} superclass.  Here parameters unique to the LegRun
behavior are presented.

\vspace{0.1in}
\noindent
The set of configuration parameters is long, and split into two
groups.  The first group deals mainly with the shape of the leg,
including position, angle, length and nature of the Williamson
turn. The LegRun behavior maintains an instance of a LegRun C++ class,
and these parameters are essentially passed directly to that class.
The remainder of the configuration parameters relate to the operation
of the behavior. 

\vspace{0.15in}
\begin{listing}{Configuration Parameters for the TaskBehavior Superclass}
\label{lst_bhv_tmus}
\small \renewcommand{\arraystretch}{1.15}
\begin{longtable}{rp{0.76\textwidth}} 

  {\bf Parameter} & {\bf Description} \\  
  
  \bvar{id}: & TBD  \\
  \bvar{src}: & TBD  \\
  \bvar{hash}: & TBD  \\
  \bvar{time}: & TBD  \\
  \bvar{type}: & TBD  \\
  \bvar{exempt}: & TBD \\
  \bvar{max\_bid\_wins}: & If true, then highest bid wins. \\
  \bvar{time\_range}: & TBD  \\
  \bvar{team\_by\_group}: & TBD  \\
  \bvar{bidwonflag}: & Posted when/if the behavior wins its auction. \\
  \bvar{bidlostflag}: & Posted when/if the behavior loses its auction. \\
  \bvar{xbidwonflag}: & TBD \\
  \bvar{xbidlostflag}: & TBD \\
  \bvar{bid\_value\_var}: & TBD \\
  \bvar{task\_state\_var}: & TBD \\

\end{longtable}
\end{listing}
\normalsize

  
\vspace{0.15in}
\begin{listing}{Configuration Parameters for TaskMuster Behavior}
\label{lst_bhv_tmus}
\small \renewcommand{\arraystretch}{1.15}
\begin{longtable}{rp{0.76\textwidth}} 

  {\bf Parameter} & {\bf Description} \\  
  
  \bvar{waypt}: & The x-y location of the waypoint. \\

\end{longtable}
\end{listing}
\normalsize


\vspace{0.15in}
\begin{listing}{Example Configuration Block}
\label{lst_bhv_tmus_ex}

\begin{fileverb}
      name = tuster_
    updates = TASK_MUSTER
 templating = spawn

         type = muster
 max_bid_wins = false

   team_range = 5000

  team_by_group = true

#include plugs.bhv <muster_regions>

  bidwonflag = UP_MUSTER  = muster_region=$[REGION]
  bidwonflag = MUSTER  = true
  bidwonflag = STATION = false
  bidwonflag = RETURN  = false
  bidwonflag = CONVOY  = false

  bidwonflag = LAST_TASK=$[LAST_TASK]
  //  xbidwonflag = MISSION_TASK = type=convoy,id=convoy$[ID+1], \
                    contact=$[OWNSHIP],exempt=$[OWNSHIP]               
  xbidwonflag = MISSION_TASK = type=convoy,id=follow_$[OWNSHIP], \
                contact=$[OWNSHIP],exempt=$[OWNSHIP]
}
\end{fileverb}
\end{listing}

%=====================================================================
\subsection{Publications}


\vspace{0.15in}
\begin{listing}{Configuration Parameters for the LegRun Behavior}
\label{lst_bhv_tmus}
\small
\renewcommand{\arraystretch}{1.15}
\begin{longtable}{rp{0.76\textwidth}} 

  {\bf Variable} & {\bf Description} \\  
  
  \mvar{TM\_ALERT\_REQUEST}: &  \\
  
\end{longtable}
\end{listing}
\normalsize


%=======================================================================
\subsection{Flags and Macros}
\label{sec_twpt_fmac}

The \var{TaskMuster} behavior supports the below set of event flags
in addition to the standard behavior flags, e.g., endflags,
runflags. These are:

\vspace{0.1in}
\begin{packed_itemize}

\item \bvar{bidwonflag}: Posted when/if the behavior wins its auction.
\item \bvar{bidlostflag}: Posted when/if the behavior loses its auction.

\end{packed_itemize}

\vspace{0.1in}
\noindent
The following macros are supported in the \var{TaskMuster}
behavior. These macros will be expanded in any event flag, including
event flags defined for all IvP behaviors as well as event flags
defined only for the \var{TaskMuster} behavior.


\vspace{0.1in}
\begin{packed_itemize}

\item \pvar{\$[PTX]}: The x location of the waypoint.
\item \pvar{\$[PTY]}: The y location of the waypoint.

\end{packed_itemize}







