<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%=================================================================
\section{The alogmhash Tool}
%================================================================
\label{sec_alogmhash}
%\index{alogmhash!Overview}

The \app{alogmhash} command-line tool will examine a given single alog
file and discern key pieces of information related to the mission
hash. It's primary intended use is to be invoked within a script as
step in the automated archiving of log files. But it can also be run
on the command line to provide some useful information about the
mission hash of an alog file:

\vspace{0.1in}
\noindent
\begin{consoleverb}
$ alogmhash LOG_ABE_26_6_2023_____22_00_52.alog
Analyzing odometry in file : LOG_ABE_26_6_2023_____22_00_52.alog

6,697 total alog file lines.
-------------------------------------
MHash:     230626-2200N-MALT-PAIR
Odometry:  0
Duration:  73.2
Node Name: abe
UTC:       1687831252.73
Full List of MHashes noted: 
 [230626-2200N-MALT-PAIR]: 0.00 secs
\end{consoleverb}

\vspace{0.1in}
\noindent
The condensed output version of this tool is the primary use case. It will produce a
slingle line of ouput that will be saved in an \var{.mhash} file. This information
is critical to the archiving pipeline

\begin{consoleverb}
$ alogmhash --all LOG_ABE_26_6_2023_____22_00_52.alog
mhash=230626-2200N-MALT-PAIR,odo=0.0,duration=73.2,name=abe,utc=1687831252,xhash=ABE-073S-000M
\end{consoleverb}

%================================================================
\subsection{Output Components}

The \app{mhash} utility will scour the log file for the following pieces of information. 

\begin{packed_itemize}
\item The mission hash (mhash)
\item The UTC start time of the mission
\item The odometry, e.g., distance travelled
\item The duration of the log file
\item The node name
\end{packed_itemize}

\vspace{0.1in}
\noindent
The mission hash is obtained by examining the alog file for entries to the variable
\mvar{MISSION\_HASH}. An example is:

\vspace{0.1in}
\noindent
\mvar{mhash=230626-2200N-MALT-PAIR,utc=1687831252.73}

\vspace{0.1in}
\noindent
If there is only one value for this variable in the alog file, then
identifying the mission hash and the UTC start time is pretty
easy. However, if the alog file is from a vehicle, it's possible that
the shoreside mission may have been restarted one or more times in the
duration of the vehicle log file. This would result in the vehicle log
file having multiple values for the \mvar{MISSION\_HASH}.  For this
reason \app{alogmhash} tallies the odometry distance accumulated while
each distinct \mvar{MISSION\_HASH} is the prevailing value. In the
end, the one with the longest odometry distance is the one chosen. The
assumption is that, when or if a shoreside mission is re-started, it
is usually while the vehicle is sitting in a pre-launch mode, in which
case the mission hash values from earlier starts should be disregarded.

\vspace{0.1in}
\noindent
The odometry distance calculated by \app{alogmhash} is derived simply
from the logged \mvar{NAV\_X} and \mvar{NAV\_Y} values.

\vspace{0.1in}
\noindent
The duration value calculated by \app{alogmhash} is derived simply
from timestamp of the last logged entry in the alog file against the
UTC start time recorded at the top of the alog file.

\vspace{0.1in}
\noindent
The node name is either the vehicle name or \var{"shoreside"}. It is
derived by examining a publication to the MOOS variable \mvar{DB\_UPTIME}
and noting the source (MOOS App) name that published it, which is always
the \app{MOOSDB} with the format \var{MOOSDB\_node}. The component to
the right of the underscore is regarded as the node name. The node name
of \var{"shoreside"} is always shortened to \var{"shore"}

%================================================================
\subsection{Command Line Usage for the alogmhash Tool}
%\index{alogmhash!Command Line Usage}
%\index{Command Line Usage!alogmhash}

\begin{consoleverb}
 $ alogmhash --help or -h
\end{consoleverb}

\vspace{0.1in}
\begin{listing}{Command line usage for the \app{alogmhash} tool}
\label{alogiter_usage}
\scriptsize
\begin{verbatim}
Usage: 
  alogmhash file.alog [OPTIONS]                    
                                                   
Synopsis:                                          
  alogmhash will read the one given alog file and  
  parse for key values used in a .mhash cache file.
  Value Examples:                                  
    MHASH:    230513-1453B-ICED-OWEN               
    ODO:      423.2                                
    DURATION: 874.3                                
    NAME:     abe                                  
    UTC:      33678848885.977                      
  If multiple MISSION_HASH values are present in   
  the given log file, the posting value with the   
  highest odemetry distance is the one chosen. This
  guards against the situation where a shoreside   
  re-starts after the logging has started and thus 
  generates a new mission hash. Rule of thumb is to
  regard the MISSION_HASH that prevailed for the   
  highest odometry as the one true MISSION_HASH.   
                                                   
Options:                                           
  -h,--help       Displays this help message       
  -v,--version    Display current release version  
  -t,--terse      terse output (No newline/CRLF)   
                                                   
  -m,--mhash      Report MHASH w/ longest odometry 
  -o,--odo        Report total odometry            
  -d,--duration   Report total duration            
  -n,--name       Report node/vehicle name         
  -u,--utc        Report UTC start time            
  -a,--all        Report mhash,odo,dur,name        
                                                   
  --web,-w                                         
    Open browser to:                               
    https://oceanai.mit.edu/ivpman/apps/alogmhash  
                                                   
Returns:                                           
  0 if alog file ok.                               
  1 if alog file not ok, unable to open.           
                                                   
Further Notes:                                     
  (1) The order of arguments is irrelevent.        
  (2) Only last given .alog file is reported on.   
  (3) Intended to be used in mhash_tag.sh script.  
                                                   
(1) Example:                                       
  $ alogmhash *.alog --all                         
    mhash=230512-2147I-ICED-OWEN,odo=1507.5,     \
    duration=451.3,name=alpha,utc=33678848885.977  
(2) Example:                                       
  $ alogmhash *.alog --mhash                       
    mhash=230512-2147I-ICED-OWEN   
\end{verbatim}
\end{listing}
\normalsize

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