<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%=====================================================================
\section{The Trail Behavior}
%=====================================================================
\wikisec{grp=bhvmulti}
\wikisec{file=BehaviorTrail, short=Trail Behavior}
\label{bhv_trail}
\index{IvP Behaviors Implemented!\var{BHV\_Trail}}

This behavior will drive the vehicle to trail or follow another
specified vehicle at a given relative position. A tool for "formation
flying". The following parameters are defined for this behavior:

\begin{figure}[H]
  \centering 
  \includegraphics[width=0.85\textwidth]{figs_bhvs/bhv_trail.png}
  \caption{Interpolation of vehicle speed inside the radius set by
    \bvar{nm\_radius} relative to the extrapolated trail position. }
  \label{fig_bhv_trail}.
\end{figure}

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

\input{includes/bhv_all_properties}

\input{includes/bhv_contact_properties}

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

  {\bf Parameter} &amp; {\bf Description} \\  
  
  \bvar{nm\_radius}: &amp; If in this range to contact and ahead of it,
  slow down. The default is 20 meters. \\

  \bvar{no\_alert\_request}: &amp; If true, no request will be made to
  the contact manager for contact alerts. The default is true. \\

  \bvar{post\_trail\_dist\_on\_idle}: &amp; If true, post
  \mvar{TRAIL\_DISTANCE} even during the idle state. The default is
  true. \\
    
  \bvar{pwt\_outer\_dist}: &amp; Range to contact outside which the
  behavior has zero priority. \\
    
  \bvar{radius}: &amp; If outside this radius to the contact, head to
  \bvar{nm\_radius} ahead of trail point. The default is 5 meters. \\
    
  \bvar{trail\_angle}: &amp; Relative angle to the contact to set the
  trail-point. The default is 180. \\
    
  \bvar{trail\_angle\_type}: &amp; Either "relative" or "absolute"
  bearing/angle to the contact. The default is relative. \\

  \bvar{trail\_range}: &amp; Relative distance to the contact to set the
  trail-point. The default is 50 meters. \\
    
\end{longtable}
\end{listing}
\normalsize


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

\begin{fileverb}
Behavior = BHV_Trail
{
  // General Behavior Parameters
  // ---------------------------
  name         = trail_                // example
  pwt          = 100                   // default
  condition    = TRAIL_ALLOWED = true  // example
  updates      = TRAIL_INFO            // example
  templating   = spawn                 // example


  // General Contact Behavior Parameters
  // -----------------------------------
            contact = to-be-set        // example
              decay = 15,30            // default (seconds)
        extrapolate = true             // default
   on_no_contact_ok = true             // default
        time_on_leg = 60               // default (seconds)


  // Parameters specific to this behavior
  // ------------------------------------
                nm_radius = 20         // default (meters)
         no_alert_request = false      // default
  post_trail_dist_on_idle = true       // default
           pwt_outer_dist = 0          // default (meters)        
                   radius = 5          // default (meters) 
              trail_angle = 180        // default (degrees)
         trail_angle_type = relative   // default (or absolute)             
              trail_range = 50         // default (meters)
}
\end{fileverb}
\end{listing}



%=======================================================================
\subsection{Variables Published}

The below MOOS variables will be published by the behavior during
normal operation, in addition to any configured flags. A variable
published by any behavior may be supressed or changed to a different
variable name using the \bvar{post\_mapping} configuration parameter
described in Section \ref{sec_bhv_post_mapping}.

\vspace{0.15in}
\begin{listing}{Variables Published by the Trail Behavior}
\label{lst_bhv_trail_pubs}
\small
\renewcommand{\arraystretch}{1.15}
\begin{longtable}{rp{0.76\textwidth}} 

  {\bf Variable} &amp; {\bf Description} \\  

  \mvar{PURSUIT}: &amp; 1 if in behavior is active and producing an objective
  function, 0 otherwise. \\

  \mvar{REGION}: &amp; \\

  \mvar{TRAIL\_HEADING}: &amp; \\

  \mvar{TRAIL\_SPEED}: &amp; \\

  \mvar{TRAIL\_RANGE}: &amp; \\

  \mvar{MAX\_RANGE}: &amp; \\

  \mvar{VIEW\_POINT}: &amp; \\

  \mvar{TRAIL\_DISTANCE}: &amp; \\

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

%=======================================================================
\subsection{Parameters}

\vspace{0.15in}
\begin{itemize}

\item \bvar{trail\_range}: The range component of the relative
  position to the contact to trail.

\item \bvar{trail\_angle}: The relative angle of the relative position
  to the contact to trail. (180 is directly behind, 90 is a parallel
  track to the contacts starboard side, -90 is on the port side of the
  contact.)

\item \bvar{trail\_angle\_type}: The trail angle may be set to either
  \var{relative} (the default), or \var{absolute}.

\item \bvar{radius}: The distance (in meters) from the trail position
  that will result in the behavior ``cutting range'' to the trail
  position, and inside of which will result in the behavior
  ``shadowing'' the contact. The default is 5 meters.

\item \bvar{nm\_radius}: The distance in meters from the trail point
  within which the speed will be gradually change from the outer chase
  speed (max speed) and the speed of the contact, as illustrated in
  Figure \ref{fig_bhv_trail}. This parameter should typically be set
  to several times the value of \bvar{radius} to achieve smooth
  formation flying. Default is 20 meters.

\item \bvar{max\_range}: The distance (in meters) that the contact
  must be within for the behavior to be active and produce an
  objective function.  The default is \bvar{max\_range} value is zero
  meaning it will be active regardless of the distance to the contact.

\end{itemize}
</pre></body></html>