<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}

%===================================================================
\input{common_latex/common_latex_packages}
\input{common_latex/common_latex_definitions}
\input{common_latex/common_latex_help_format}
%===================================================================

\begin{document}

\begin{labcover}
\labtitle{Help Topic: Running and Debugging Missions}
\vspace{0.1in}
\labdate{Spring 2020}
\vspace{0.1in}
\labauth{Michael ``Misha'' Novitzky, novitzky@mit.edu}
\labauth{Department of Mechanical Engineering}
\labauth{MIT, Cambridge MA 02139}
\labline
\end{labcover}

\wikidoc{file=Help.RunAndDebugMissions}
\wikidoc{auth=novitzky@mit.edu}

%====================================================================
\section*{Launching Individual MOOS-IvP Applications} 
%====================================================================

This is just a refresher on launching MOOS-IvP applications. We will just assume
I am testing out my \app{pAwesome} MOOS-IvP application.

Reminder, each MOOS-IvP application will have an associated ProcessConfig block
in a .moos file with at minimum the default configuration parameters of \var{AppTick}
and \var{CommsTick}.  Your application can have more parameters as is needed.

An example ProcessConfig block:

\begin{fileverb}
ProcessConfig = pAwesome                                      
{                                                               
  AppTick   = 4                                                 
  CommsTick = 4                                                                                           
}
\end{fileverb}

Let's assume this ProcessConfig block is kept in the pAwesome.moos file.
To individually run my application, at the command line I enter:

\begin{consoleverb}
$ pAwesome pAwesome.moos
\end{consoleverb}

Launching in this way means I have only started the \app{pAwesome} MOOS-IvP
application.  Typically, it will require me to manually launch the \app{MOOSDB} and
any other required applications.

%====================================================================
\section*{Launching A Community of MOOS-IvP Applications} 
%====================================================================
 You may have already
seen the documentation for pAntler, but let's go over some basics.

pAntler is just another MOOS-IvP application with its own ProcessConfig block.  What makes it super useful is
that within the pAntler ProcessConfig block is a list of other MOOS-IvP applications
that should be launched all at one time.

An example pAntler ProcessConfig block:

\begin{fileverb}
ProcessConfig = Antler
{
  Run = MOOSDB  @NewConsole = true
  Run = pAwesome @NewConsole = true
}
\end{fileverb}

If we just run pAntler with the example ProcessConfig block above, it will be
missing some useful and key information.

At the top of the mission file we will typically have the parameters ServerHost,
ServerPort, and Community.  These parameters will become very important when we
start running multiple MOOS-IvP communities on the same system.

An example top to our mission .moos file, test\_awesome.moos

\begin{fileverb}
ServerHost = localhost
ServerPort = 9000
Community = Awesomeness
\end{fileverb}

So if we append our example pAntler ProcessConfig block to our test\_awesome.moos
file it will look like the following:

\begin{fileverb}
ServerHost = localhost
ServerPort = 9000
Community = Awesomeness

ProcessConfig = Antler
{
  Run = MOOSDB  @NewConsole = true
  Run = pAwesome @NewConsole = true
}
\end{fileverb}

In this case, at the command line I will launch my mission with:

\begin{consoleverb}
$ pAntler test_awesome.moos
\end{consoleverb}

If we run the current version of our test\_awesome.moos, pAntler will launch both
the MOOS-IvP applications \app{MOOSDB} and \app{pAwesome} with the ServerHost set to
localhost, ServerPort set to 9000, and the Community Name as Awesomeness.

What we are missing, though, is the ProcessConfig block for the application
\app{pAwesome}.  Let's append our example \app{pAwesome} ProcessConfig block from above to
our test\_awesome.moos mission file.

\begin{fileverb}
ServerHost = localhost
ServerPort = 9000
Community = Awesomeness

ProcessConfig = Antler
{
  Run = MOOSDB  @NewConsole = true
  Run = pAwesome @NewConsole = true
}

ProcessConfig = pAwesome                                      
{                                                               
  AppTick   = 4                                                 
  CommsTick = 4                                                                                           
}
\end{fileverb}

Now our mission is complete.  pAntler will launch the MOOS-IvP applications
\app{MOOSDB} and \app{pAwesome} with all of the useful MOOS community information and
parameters for \app{pAwesome}.

This system extends to many MOOS-IvP applications being run at one time. A corresponding ProcessConfig should go along with each MOOS-IvP application.

NOTE: \app{MOOSDB} does not need a ProcessConfig block.

\begin{fileverb}
ServerHost = localhost
ServerPort = 9000
Community = Awesomeness

ProcessConfig = Antler
{
  Run = MOOSDB  @NewConsole = true
  Run = pAwesome @NewConsole = true
  Run = pApplication1 @NewConsole = false
  .
  .
  .
  Run = pApplicationN @NewConsole = false
}

ProcessConfig = pAwesome                                      
{                                                               
  AppTick   = 4                                                 
  CommsTick = 4                                                                                           
}

ProcessConfig = pApplication1                                      
{                                                               
  AppTick   = 4                                                 
  CommsTick = 4                                                                                           
}
.
.
.
ProcessConfig = pApplicationN                                      
{                                                               
  AppTick   = 4                                                 
  CommsTick = 4                                                                                           
}
\end{fileverb}

%====================================================================
\section*{Debugging MOOS-IvP Applications and Missions}
%====================================================================

When first writing and debugging your MOOS-IvP applications, it may make sense
to launch each application in their own terminal window with their own .moos
file.

However, we have seen that it can start to become a tedious exercise to launch
several MOOS-IvP applications over and over again.

Hence, we suggest launching your missions with pAntler and a mission .moos file
(as described above).

What can happen, however, is that the new application you are writing is not
showing up (possibly because it is exiting prematurely). The way one can go
about debugging such a situation is as follows.  Let's say that our \app{pAwesome}
MOOS-IvP application does not seem to be producing any output and I can not see
it publishing anything to uXMS.

In order to isolate \app{pAwesome}, we comment it out from being run in the
test\_awesome.moos file so that it does not get launched by pAntler, but that we
can launch it manually so we can see the console output before it prematurely
exits.

For simplicity of illustration, I have reverted the test\_awesome.moos file to
only launching \app{MOOSDB} and \app{pAwesome}, however, you can imagine this mission file
running ten MOOS-IvP applications at one time.

\begin{fileverb}
ServerHost = localhost
ServerPort = 9000
Community = Awesomeness

ProcessConfig = Antler
{
  Run = MOOSDB  @NewConsole = true
//Run = pAwesome @NewConsole = true
}

ProcessConfig = pAwesome                                      
{                                                               
  AppTick   = 4                                                 
  CommsTick = 4                                                                                           
}
\end{fileverb}

Notice that I have commented out the \app{pAwesome} run command in pAntler's
ProcessConfig block.  The means that when I run this test\_awesome.moos mission
file, that \app{pAwesome} will not be launched by pAntler.

\begin{consoleverb}
$ pAntler test_awesome.moos
\end{consoleverb}

Now, if all went well, all of the MOOS-IvP applications should be running as per
intended except for our misbehaving application \app{pAwesome}.

To see why \app{pAwesome} may be prematurely exiting, we just launch it by itself in
it's own terminal window. NOTE: DO NOT USE @NewConsole = true within the pAntler
ProcessConfig block when trying to debug!  A prematurely exiting application will simply create a new
terminal with X11 and then promptly exit which also closes the X11 window
terminal meaning you loose all the output that would be helpful for debugging.
Instead, make sure to launch the offending application within a terminal window
you have opened up yourself manually.

\begin{consoleverb}
$ pAwesome test_awesome.moos
\end{consoleverb}

This will allow us to see what messages we get, is it having segmentation
faults? Note: I can use the whole test\_awesome.moos mission file because
\app{pAwesome} will only search for it's own ProcessConfig block named \app{pAwesome} within
the passed .moos file.

\end{document}

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