<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[onecolumn,letterpaper,11pt]{article}

%===================================================================
% Include common packages, environments, counters etc
\input{common_latex/common_latex_packages}
\input{common_latex/common_latex_lab_format}
\input{common_latex/common_latex_definitions}
%===================================================================
\setcounter{tocdepth}{2}
%===================================================================

\begin{document}
\wikidoc{file=Lab.ClassRescue5}
\wikidoc{auth=mikerb@mit.edu}
\helplevelsubsec

%===================================================================
% Build the Cover Page in an environment style easy for wiki parsing
\begin{labcover}
\labtitle{Lab 17 - Autonomous Rescue Challenge - Part 5}
\vspace{0.1in}
\labtitle{Final Lab and  In-Water Competition}
\vspace{0.1in}
\labcourse{2.680 Unmanned Marine Vehicle Autonomy, Sensing and Communications}
\vspace{0.1in}
\labpng{0.75}{figures/lab_17_cover.png}
\vspace{0.1in}
\labdate{May 1st 2025}
\vspace{0.1in}
\labauth{Michael Benjamin, mikerb@mit.edu}
\labauth{Department of Mechanical Engineering}
\labauth{MIT, Cambridge MA 02139}
\vspace{0.12in}
\labtoc{footnotesize}
\labtocdepth{2}
\end{labcover}

%====================================================================
% Add a blank page so first body page is on the right when doubleside
%\blankpage
%====================================================================
\newpage \section{Overview and Objectives}

In the final part of the Autonomous Rescue lab, the competition, each
team is expanded to two vehicles, to include a collaborative robot, a
{\em scout} vehicle. As in the previous lab stages, a set of swimmers
and their locations will be communicated to both robot teams. In this
new stage, a set of additional, {\em unregistered}, swimmers will also
exist at unknown locations. These unregistered swimmers can be
located, {\em scouted}, by a {\em scout robot} teammate. When a
swimmer has been scouted, the scout robot will message its rescue
robot teammate with the swimmer ID and location. The idea is conveyed
in Figure \ref{fig_scout_robot_role}:

\vspace{0.1in}
\begin{figure}[H]
  \centering 
  \includegraphics[width=0.95\textwidth]{figures/scout_robot_role.png}
  \caption{{\bf The Scout Robot}: (left) The scout robot discovers a 
    previously not known (unregistered) swimmer, and conveys its location
    to its rescue vehicle teammate. (right) The rescue vehicle adjusts its
    path to include the newly known swimmer, while the scout robot continues
    to search for other unregistered swimmers.}
  \label{fig_scout_robot_role}
\end{figure}
\vspace{0.1in}

\noindent
Your goal is to build a new Helm behavior for your scout vehicle. A
baseline behavior will be provided for you. This behavior will simply
drive to random locations in the playing region, randomly picking a
new point after reaching the previous point. Sometimes it will get
lucky and stumble upon an unregistered swimmer. As with the greedy
tour policy for your \app{pGenRescue} app, the baseline behavior
provides a legitimate capability out of the box, but is pretty
inefficient and easily improved.

\vspace{0.1in}
\noindent
A summary of topics:

\begin{labinfo}
\begin{packed_itemize}[2]
\item Development of a new Helm behavior for autonomous scouting 
\item Inter-vehicle messaging for autonomous scouting and rescue
\item Demonstration of student-provided path planning module, \app{pGenRescue},
  in an adversarial situation.
\item In-water demonstration of 2 on 2 robot autonomous scout and rescue.
\end{packed_itemize}
\end{labinfo}


%===================================================================
\section{Preliminaries}
%===================================================================
\input{common_rescue/doc_conventions}
\input{common_rescue/update_code}
\input{common_rescue/pav_coords}
\input{common_rescue/shell_path}
\input{common_rescue/bhv_path}

%======================================================================
%\newpage
\section{Four Mission Variations - For Simulation or In-Water}
%======================================================================

There are four distinct mission variations, the first two of which you
have seen already. We will move our attention to the 3rd and 4th variations
in this lab, but the initial two simpler variations are still very useful
for testing sub-components.

\begin{packed_itemize}
\item {\bf Rescue:} One vehicle is launched, and will simply rescue
  all swimmers, unimpeded. Section \ref{sec_mvariation_r}.
\item {\bf Rescue-Rescue:} Two vehicles are launched, and will attempt
  rescue all swimmers, first-come-first-rescue. Section
  \ref{sec_mvariation_rr}.
\item {\bf Rescue-Scout:} A single two-vehicle team comprised of a
  rescue vehicle and a scout vehicle. The rescue vehicle will proceed
  to visit and rescue all known swimmers, unimpeded. Any swimmers
  discovered by the scout vehicle will be conveyed to the rescue
  vehicle and the rescue vehicle will visit these newly discovered
  swimmers as well. Section \ref{sec_mvariation_rs}.
\item {\bf Rescue-Scout-Rescue-Scout (RS2):} Same as Rescue-Scout except two
  teams are fielded and swimmers are awarded
  first-come-first-serve. Section \ref{sec_mvariation_rsrs}.
\end{packed_itemize}

\vspace{0.1in}
\noindent
Each of these mission variations is described next, along with
instructions for launching them within the baseline mission.  We will
continue to use the baseline mission from the previous lab, located in
\var{moos-ivp-2680/missions} called \var{rescue\_baseline}. This
mission folder is updated as part of the \var{moos-ivp-2680} tree.


%======================================================================
\newpage
\subsection{The Rescue Mission Variation}
\label{sec_mvariation_r}

The {\em rescue} mission variation is probably the first mission you
ran from the earlier parts of this lab sequence. It is still supported
in the baseline mission with the \var{--rescue} or \var{-r}
command-line argument:

\vspace{0.1in}
\begin{consoleverb}
$ ./launch.sh --rescue --swim_file=mit_02.txt  10     (time warp 10)
\end{consoleverb}
\vspace{0.1in}

\noindent
It should look something like the below video:

\vspace{0.1in}
\begin{figure}[H]
  \centering 
  \includegraphics[width=0.94\textwidth]{figures/swimmer_02.png}
  \caption{The swimmer locations shown are from swimmer file
    \var{mit\_02.txt}.  The vehicle proceeds to each point, in a
    greedy path tour, and then returns home.}
  \label{fig_swimmer_02}
\gif{figures/swimmer_02.gif}
\end{figure}
\vspace{0.1in}

\noindent
This mission variation is useful when fine-tuning your path planning
algorithm (improvements over greedy-path) in your \app{pGenRescue}
app.

%======================================================================
\newpage
\subsection{The Rescue-Rescue Mission Variation}
\label{sec_mvariation_rr}

The {\em rescue-rescue} mission variation is also from previous labs, comprised
of a single rescue vehicle competing against another single rescue vehicle.

\vspace{0.1in}
\begin{consoleverb}
$ ./launch.sh --rescue-rescue --swim_file=mit_02.txt 10     (time warp 10)
  or equivalently
$ ./launch.sh --rr -2 10   
\end{consoleverb}
\vspace{0.1in}

\noindent
It should look something like the below video:

\vspace{0.1in}
\begin{figure}[H]
  \centering 
  \includegraphics[width=0.94\textwidth]{figures/rescue_rescue.png}
  \caption{Two vehicles are given the same set of swimmers and
    locations. They each depart at the same time, each using a greedy
    path to traverse the set of swimmer locations and tally
    rescues. This mission was run at 10x realtime.}
  \label{fig_vimeo_lab_15_pair_01}
  \gif{figures/rescue_rescue.gif}
\end{figure}
\vspace{0.1in}

\noindent
This mission variation is useful when fine-tuning the elements of your
path planning algorithm that consider adversarial intent, in your
\app{pGenRescue} app.


%======================================================================
\newpage
\subsection{The Rescue-Scout Mission Variation}
\label{sec_mvariation_rs}

The {\em rescue-scout} mission variation is new in this lab. It is
comprised of a single rescue vehicle, and a single scout vehicle. The
rescue vehicle performs as before, receiving a set of swimmer
locations and IDs at the outset, and proceeding to visit and rescue
each of them. In this mission variation, a number of {\em
  unregistered} swimmers is also randomly generated. The existence of
the unregistered swimmers is not conveyed to any vehicle at the
outset. A second {\em scout} vehicle is deployed, with the sole
capability of detecting unregistered swimmers and sharing this
information with it's rescue vehicle teammate. This mission variation
is launched with the \var{--rs} flag. 


\vspace{0.1in}
\begin{consoleverb}
$ ./launch.sh --rs --swim_file=mit_04.txt 10         (time warp 10)
\end{consoleverb}
\vspace{0.1in}

\noindent
It should look something like the below video:

\vspace{0.1in}
\begin{figure}[H]
  \centering 
  \includegraphics[width=0.94\textwidth]{figures/rescue_scout_04.png}
  \caption{The Rescue-Scout baseline mission is comprised of a single
    rescue vehicle, and a single scout vehicle. There is no
    competitor. The rescue vehicle rescues vehicles one by one,
    turning the marker from green to yellow. The scout vehicle wanders
    the region and reports the locations of previously unknown
    swimmers. This mission was run at 10x real-time.}
  \label{fig_rescue_scout_04}
  \gif{figures/rescue_scout_04.gif}
\end{figure}
\vspace{0.1in}

\noindent
This mission variation is useful when fine-tuning the coordination of
your rescue vehicle (\app{pGenRescue} app), and your scout vehicle
 (\var{BHV\_Scout} behavior).

\vspace{0.1in}
\noindent
{\bf Note:} To run randomly generated missions with the same number of
swimmers, number of un-registered swimmers and operating area, you can
run:

\vspace{0.1in}
\begin{consoleverb}
$ ./launch.sh --rs --swimmers=11 --unreg=15 --pav90 10    (time warp 10)
\end{consoleverb}
\vspace{0.1in}

\noindent
This will generate and load \var{mit\_rand.txt}.


%----------------------------------------------------------------------
\subsubsection*{What Does the Scout Vehicle Know?}

The {\em scout} vehicle has the following information at its disposal:

\begin{packed_itemize}
\item The location of the playing field, i.e., region of possible swimmer
  locations. 
\item The location of its teammate and all other vehicles
\item The location and IDs of all registered swimmers, i.e., the swimmers
  known to all at the outset.
\end{packed_itemize}

\vspace{0.1in}
\noindent
The {\em scout} vehicle does NOT have the following information:

\begin{packed_itemize}
\item The results of other scout vehicles
\item The current planned path of its partner rescue vehicle, although
  this could be arranged by modifying your \app{pGenRescue} app to
  share if you think it would be useful.
\end{packed_itemize}

\vspace{0.1in}
\noindent
{\bf Note:} The rescue vehicle, if it happens to stumble upon an
unregistered swimmer, previously unknown to the rescue vehicle, this
swimmer will also be rescued. (Hint: so there is no reason for the
scout vehicle to go where the rescue vehicle is already going.)


%======================================================================
\newpage
\subsection{The Rescue-Scout-Rescue-Scout (RS2) Mission Variation}
\label{sec_mvariation_rsrs}

The {\em rescue-scout-rescue-scout}, a.k.a. the {\em RS2} mission
variation is also new in this lab. It is comprised of four vehicles,
two teams of two vehicles each. Each team is comprised of a single
rescue vehicle, and a single scout vehicle. Each rescue vehicle
performs as before, receiving a set of swimmer locations and IDs at
the outset, and proceeding to visit and rescue each of them. In this
mission variation, a number of {\em unregistered} swimmers is also
randomly generated. The existence of the unregistered swimmers is not
conveyed to any vehicle at the outset. On each team, a second {\em
  scout} vehicle is deployed, with the sole capability of detecting
unregistered swimmers and sharing this information with it's rescue
vehicle teammate. This mission variation is launched with the
\var{--rs2} flag. 

\vspace{0.1in}
\begin{consoleverb}
$ ./launch.sh --rs2 --swim_file=mit_04.txt 10   (time warp 10)
\end{consoleverb}
\vspace{0.1in}

\noindent
It should look something like the below video:

\vspace{0.1in}
\begin{figure}[H]
  \centering 
  \includegraphics[width=0.94\textwidth]{figures/rs2_04.png}
  \caption{The Rescue-Scout-Rescue-Scout (RS) baseline mission is
    comprised of two teams competing for swimmers. Each team consists
    of a single rescue vehicle and a single scout vehicle. The scout
    vehicle searches for swimmers unknown, informing its rescue
    teammate when it finds a new swimmer.  The rescue vehicle rescues
    vehicles one by one, turning the marker from green to yellow. The
    scout vehicle wanders the region and reports the locations of
    previously unknown swimmers. This mission was run at 10x realtime.}
  \label{fig_rs2_04}
  \gif{figures/rs2_04.gif}
\end{figure}

\noindent
This mission variation is useful when preparing for the final in-water
competition, since this is pretty close to the real deal.


%======================================================================
\section{Launching the Mission for In-Water Experiments}
%======================================================================

There are a couple changes for launching robots on the water, discussed
in this section:

\begin{packed_itemize}
\item On the shoreside, not much is changed other than remembering to
  use the larger operation area.
\item On the vehicle, the launch script needs to be told (a) the role
  of the vehicle (rescue or scout). If it is a scout vehicle, the name
  of the teammate must be specified on the command line. 
\end{packed_itemize}

\vspace{0.1in}
\noindent
This is discussed further below.

%======================================================================
\subsection{Launching the Shoreside Mission In the Field}
\label{sec_launch_shore}

The shoreside mission is launched as before in previous labs, and will very
likely be launched by a TA. The TA will have the following trees on their
laptop:

\begin{packed_itemize}
\item \var{moos-ivp}: General shoreside autonomy apps.
\item \var{moos-ivp-2680}: To run the \app{uFldRescueMgr} app. This tree
  also contains the \var{recue\_baseline} mission.
\end{packed_itemize}

\vspace{0.1in}
\noindent
A typical launch:

\vspace{0.1in}
\begin{consoleverb}
  $ cd moos-ivp-2680/missions/rescue_baseline
  $ ./launch_shoreside.sh --swim_file=mit_04.txt
\end{consoleverb}
\vspace{0.1in}

%======================================================================
\subsection{Launching the Vehicle Mission In the Field}
\label{sec_launch_vehicle}

The vehicle mission is launched as before, logged onto your PABLO on
your robot. A couple additions are needed when launching the scout
vehicle. The scout vehicle needs to be declared as a scout, and it
needs to declare its teammate. As before, you will need to know (a)
the name of your robot, and (b) the IP address of the shoreside computer.

\vspace{0.1in}
\noindent
{\bf Launching the Rescue Vehicle:}

\vspace{0.1in}
\begin{consoleverb}
PABLO  $ cd moos-ivp-2680/missions/rescue_baseline
PABLO  $ ./launch_vehicle.sh --shore=192.168.1.224 (Or different IP/robot)
\end{consoleverb}
\vspace{0.1in}

\vspace{0.1in}
\noindent
{\bf Launching the Scout Vehicle:}

\vspace{0.1in}
\begin{consoleverb}
PABLO  $ cd moos-ivp-2680/missions/rescue_baseline
PABLO  $ ./launch_vehicle.sh --shore=192.168.1.224 --vrole=scout --tmate=ben
\end{consoleverb}
\vspace{0.1in}

\vspace{0.1in}
\noindent
The launch script will disallow the launch of a scout vehicle unless the teammate
is specified as above.

%======================================================================
\subsection{Criteria for Winning and Actions Upon Winning}

In the head-to-head versions of this lab, where two teams are fielded,
there are distinct criteria for winning. This is monitored by
\app{uFldRescueMgr}. There are three {\em events} monitored by the
rescue manager:

\begin{packed_itemize}
\item Lead change: Any time the leader has changed, coinciding with the posting
  of \mvar{UFRM\_LEADER}. 
\item Winner declared: This event happens {\em once}, when the first
  vehicle satisfies the win criteria. This coincides with the posting
  of \mvar{UFRM\_WINNER}.
\item Final rescue: The final swimmer has been rescued. Un-scouted
  un-registered swimmers do not count. This coincides with the posting of
  \mvar{UFRM\_FINISHED}.
\end{packed_itemize}

\vspace{0.1in}
\noindent
Once the {\em finished} state is set to true, and the {\em winner} state
has been set to a particular rescue vehicle, these states cannot change,
even if a scout vehicle later discovers previously unknown swimmers. 


%----------------------------------------------------------------------
\subsubsection{Criteria for Winning in the Rescue-Rescue Mission}

In the Rescue-Rescue mission variation described in Section
\ref{sec_mvariation_rr}, there are no scout vehicles. The only
swimmers to be rescued are all registered and known to both rescue
vehicles at the outset.  In this case the winner can be determined
before all swimmers are rescued, as soon as a majority of swimmers
have been rescued by one rescue vehicle. The competition however may
still continue until {\em finished} when all swimmers have been
rescued.

\vspace{0.1in}
\noindent
Why continue playing after a winner has been established? In some test
cases, or batch of automated tests, we may only care about the percentage
of wins for a particular configured vehicle. In other cases we may be
interested not only in the win, but the final score. By default, the
competition in a Rescue-Rescue mission variation will continue until
finished. If the \app{uFldRescueMgr} app is instead configured with
\pvar{finish\_upon\_win=true}, then the competition will finish as
soon as a winner has been identifed. 

%----------------------------------------------------------------------
\subsubsection{Criteria for Winning in the RS2 Mission}

In the RS2 mission, a winner cannot be declared until all known
swimmers have been rescued, i.e., the {\em finished} state has been
irrevocably entered. Note that the set of known swimmers are the
registered swimmers known at the outset, and the unregistered swimmers
scouted at some point by one of the scout vehicles. The {\em finished}
state, where all known swimmers have been rescued, may be entered even
if there are unregistered and unrescued swimmers that have not been
discovered (scouted) by one of the scout vehicles.

%----------------------------------------------------------------------
\subsubsection{Tie-breaker Algorithm}

It is possible that, when the competition has entered the {\em finished}
state, two teams may have the same amount of rescued swimmers. In this
case the tie is broken by examining the time at which each team rescued
its most recent swimmer. The team that rescued its most recent swimmer
first is declared the winner.

%======================================================================
\input{common_rescue/return_points}



%======================================================================
\section{Assignments}

%======================================================================
\subsection{Assignment 1 (self check off) - Run the Scout Simulations}

To get started, the first thing we will do is to run the two new
simulation variations.  First a single rescue vehicle and scout, and
then the four-vehicle variation. You need to have updated your
\var{moos-ivp-2680} tree, rebuilt, and augmented your
\var{IVP\_BEHAVIOR\_DIRS} path as described in Section
\ref{sec_bhv_dir}.

\vspace{0.1in}
\noindent
Running the Rescue-Scout mission variation was discussed in Section
\ref{sec_mvariation_rs}, and should look like the video in Figure
\ref{fig_rescue_scout_04}. It can be launched with:

\vspace{0.1in}
\begin{consoleverb}
$ ./launch.sh -rs --swim_file=mit_04.txt 10   (time warp 10)
\end{consoleverb}
\vspace{0.1in}

\vspace{0.1in}
\noindent
Running the RS2 mission variation was discussed in Section
\ref{sec_mvariation_rsrs}, and should look like the video in Figure
\ref{fig_rs2_04}. It can be launched with:

\vspace{0.1in}
\begin{consoleverb}
$ ./launch.sh -rs2 --swim_file=mit_04.txt 10   (time warp 10)
\end{consoleverb}
\vspace{0.1in}

\vspace{0.1in}
\noindent
Experiment with these missions to get a feel for how they work. Take notice
especially of the scout vehicle behavior.

%======================================================================
\subsection{Assignment 2 (check off) - Create Your Own Scout Behavior}

Once you have confirmed that you can run the scout missions from
Assignment 1 on your laptop, using the \var{BHV\_Scout} behavior, make
a copy of this behavior into your \var{moos-ivp-extend} tree:

\vspace{0.1in}
\begin{consoleverb}
  $ cd moos-ivp-extend/src
  $ cp -rp ~/moos-ivp-2680/src/lib_bhv_scout ./
\end{consoleverb}
\vspace{0.1in}

\vspace{0.1in}
\noindent
Then edit your \var{moos-ivp-extend/src/CMakeLists.txt} file to build your
behavior, adding the line:

\vspace{0.1in}
\begin{fileverb}
ADD_SUBDIRECTORY(lib_bhv_scout)
\end{fileverb}
\vspace{0.1in}

\vspace{0.1in}
\noindent
At this point, you have TWO scout behaviors. You will need to disable
the first one, the one we provided in \var{moos-ivp-2680}. To do this
comment out the appropriate line in your \var{.bashrc} file:

\vspace{0.1in}
\begin{fileverb}
#IVP_BEHAVIOR_DIRS+=:~/moos-ivp-2680/lib       (comment this out)
IVP_BEHAVIOR_DIRS+=:~/moos-ivp-extend/lib     (keep this one now)
\end{fileverb}

\noindent
For good measure, you should also remove the library from the \var{moos-ivp-2680}
folder:

\vspace{0.1in}
\begin{consoleverb}
  $ cd ~/moos-ivp-2680/lib
  $ rm libBHV_Scout.dylib
\end{consoleverb}

\vspace{0.1in}
\noindent
Then confirm that you can still run the scout simulation missions from
Assignment 1. You are now free to edit/improve this scout behavior for
later missions. Further updates/suggestions for improvements will be
posted during the week.


%======================================================================
\subsection{Assignment 3 (check off) - Run the Rescue-Scout Mission on the Robots}

Your first in-water test should be with you and your lab partner
running two vehicles. One rescue vehicle and one scout vehicle. You
should use a TA for running the shoreside, but in a pinch, one of you
can act as the shoreside for this assignment. The instructions for
launching the shoreside in the field are described in Section
\ref{sec_launch_shore} and Section \ref{sec_launch_vehicle}.

\vspace{0.1in}
\noindent
In this assignment, you should be running your version of the Scout
behavior on your scout robot. It does not matter whether or if you
have made any improvements to the algorithm of this behavior over the
baseline version. The important thing is that your (version of) the
behavior is in place and running.

\vspace{0.1in}
\noindent
You should continue to use the small (default) operation area for this
exercise.

%======================================================================
\subsection{Assignment 4 (check off) - Run the RS2 Mission on the Robots}

This is your final step of 2.680!

\vspace{0.1in}
\noindent
You and your lab partner will need to find a team to compete with. And
a TA {\em must} be acting as the shoreside for this assignment.

\vspace{0.1in}
\noindent
The instructions for launching the robot in the field are described in
and Section \ref{sec_launch_vehicle}.

\vspace{0.1in}
\noindent
In this assignment, you should be running your version of the Scout
behavior on your scout robot, with any improvements you may have made
to gain efficiencies in its scouting algorithm.

\vspace{0.1in}
\noindent
Good luck! Glory to the victors!



%=======================================================================
\section{Instructions for Handing In Assignments}
%=======================================================================

%=======================================================================
\subsection{Requested File Structure}
\label{sec_hand_in}

The assignment for this lab is to (a) demonstrate a working mission
on the Heron in a two-vehicle competition. (b) save your alog files.

\vspace{0.1in}
\begin{consoleverb}
  moos-ivp-extend/
     src/
        pGenRescue
        lib_bhv_scout
     missions/
        may0423/
          (your alog files)
\end{consoleverb}
\vspace{0.1in}


%=======================================================================
\subsection{Due Date}

This lab should be completed by the end of day Tuesday, May 13th,
2025, the last day of class.

\end{document}

</pre></body></html>