<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.ClassPabloIntro}
\wikidoc{auth=mikerb@mit.edu}
\helplevelsubsec

%===================================================================
% Build the Cover Page in an environment style easy for wiki parsing
\begin{labcover}
\labtitle{Lab 11 - The PABLO Payload Autonomy Computer}
\vspace{0.08in}
\labcourse{2.680 Unmanned Marine Vehicle Autonomy, Sensing and Communications}
\vspace{0.1in}
\labpng{0.35}{figures/pablo_gen3.png}
\vspace{0.08in}
\labdate{April 3rd, 2025}
\vspace{0.1in}
\labauth{Michael Benjamin, mikerb@mit.edu}
\labauth{Department of Mechanical Engineering}
\labauth{MIT, Cambridge MA 02139}
\vspace{0.1in}
\labtoc{small}
\labtocdepth{3}
\end{labcover}


%===================================================================
% Add a blank page so first body page is on the right when double-side
\blankpage


%===================================================================
\section{Overview and Objectives}
%===================================================================

\noindent
This lab has the following objectives:

\begin{labinfo}	
\begin{packed_itemize}
\item Introduce the Payload Autonomy Paradigm.
\item Introduce the PABLO as a hardware platform for payload autonomy.
\item Access the PABLO from your laptop.
\item Access the PABLO from your laptop using SSH keys.
\item Download your course code (moos-ivp-extend) tree onto your PABLO.
\item Identify your lab partner for upcoming in-water labs
\item Coordinate shared access to you course code on the the PABLO. 
\end{packed_itemize}
\end{labinfo}

\noindent
By the end of this lab, you will be able to power up a PABLO computer,
connected to a course laptop, log in, download and compile your
course codebase. In the next lab, you will use your PABLO to run a simple
mission with the Heron on the Charles River.

\vspace{0.1in}
\noindent
Terms used throughout:

\begin{packed_itemize}
\item {\bf "MacOS", "OSX", "Mac OS X"}: all refer to the Apple
  operating system and generally Apple computers. 
\item {\bf DHCP}: or Dynamic Host Configuration Protocol is a network
  management protocol used for automatically assigning IP addresses to
  devices connected to the network using a clientâ€“server architecture
  (Wikipedia).
\end{packed_itemize}




%=====================================================================	
\subsection{Overview of Payload Autonomy}

Consider how a robotic vessel like the Heron M300 works. Translation
and rotation are effected via differential electric thrusters, which
are actuated by motor controllers. Pose (e.g., heading) and position
(e.g., lat/lon or x, y) are discovered by a GPS and digital
compass. An on-board computer reads the sensors and commands the
motors.


\vspace{0.1in}
\noindent
The sense-plan-act loop of a robot autonomy system, {\em could} be
completed entirely within the main (front seat) computer that ships
with the Heron. This arrangement, however has drawbacks. Preparing an
autonomy mission with 3rd party software, like MOOS-IvP, requires
access to the vehicle to load software and files, install
dependencies, and build the 3rd party applications and behaviors. This
effort is then duplicated on each Heron main vehicle computer. What if
your dependencies are incompatible with packages installed by others?
Even worse, what if the 3rd party software install breaks other aspects
of the main vehicle computer environment?

\vspace{0.1in}
\noindent
Many commercially-available robotic vehicles, the M300 included,
support a "front-seat, back-seat" paradigm. The front seat handles the
sense and act portion of the loop, with a connected computer handling
the planning and decision-making. On the Herons the only "sensing"
involves the determination of vehicle position, i.e., the navigation
solution. A {\em wire protocol} defines how the front seat and
back-seat computers communicate to send sensor data from the front and
to push thrust commands from the back-seat.

\vspace{0.2in}
\begin{figure}[H]
  \centering 
  \includegraphics[width=0.65\textwidth]{figures/payload.png}
  \caption{{\bf The Payload Autonomy Concept.}}
  \label{fig_payload}
\end{figure}
\vspace{0.1in}

\noindent
The \app{iM300} application in the \var{moos-ivp-heron} repository
handles communicating between your mission and the M300's front
seat. \mvar{DESIRED\_THRUST} and \mvar{DESIRED\_RUDDER} output from
\app{pMarinePID} are converted into percent thrust to the left and
right motors and sent to the front seat via the wire protocol. Pose
and position messages from the front are parsed and published as the
\mvar{NAV\_*} variables. The vehicle plus the \app{iM300} app, are in
effect a one-for-one replacement for \app{uSimMarine}.

\vspace{0.1in}
\noindent
Figure \ref{fig_backseat_flow} offers a more detailed look of the
payload/front-seat flow of information and the role if the \app{iM300}
application.

\vspace{0.1in}
\begin{figure}[H]
  \centering 
  \includegraphics[width=0.85\textwidth]{figures/backseat_flow.png}
  \caption{{\bf The flow of information}: starting with output from the
      Helm, to the front-seat computer through the \app{iM300}
      application.  The NMEA interface is over an Ethernet cable. This
      cable is a special Ethernet cable with wet-connectors on each end when
      used on the Herons.}
  \label{fig_backseat_flow}
\end{figure}
\vspace{0.1in}



%==================================================================
\subsection{PABLO Hardware Overview}
%==================================================================

The goal in this section is connect to the PABLO from your laptop. You will
run an Ethernet cable from your laptop to the PABLO. And you will power
the PABLO with a USB power cord. A few pieces of additional equipment
are provided by the staff:

\begin{packed_itemize}
\item Ethernet cable
\item Ethernet to USB adaptor  (USB-A and USB-C adaptors available)
\item USB A to B power cable
\item 5V power supply via adaptor or power strip or USB hub
\end{packed_itemize}

\vspace{0.1in}
\noindent
There are three modes of connecting:

\begin{packed_itemize}
\item Laptop connected to the PABLO with PABLO connected to the
  external Internet, via Internet sharing enabled on your laptop.
\item Laptop connected to the PABLO with no external Internet
  connection on the PABLO.
\item Directly connected to the PABLO a keyboard and monitor.
\end{packed_itemize}

\vspace{0.1in}
\noindent
Our goal is the first method. The others are temporary fall-backs. You
will need to have your PABLO connected to the external Internet to
pull down your \var{moos-ivp-extend} code.

\vspace{0.1in}
\noindent
Connection steps are provided below. With MacOS there is probably less
variation in the setup steps between OS versions and laptop versions.
If you are working with Linux, the setup steps may have more
variation.  We provide the setup steps for Ubuntu 20.04, which is
based on Debian.  Our hope is that this matches most people, and for
those using some other Linux distro, these setup steps will be
similar.

%=====================================================================	
\subsection{PABLO Software Overview}

On your PABLO computer, the Heron payload computer, there will be five
software trees:

\begin{packed_enumerate}
\item \var{moos-ivp}
\item \var{moos-ivp-extend}  (student tree)
\item \var{moos-ivp-2680}
\item \var{moos-ivp-heron}
\item \var{pablo-common}
\end{packed_enumerate}

\vspace{0.1in}
\noindent
The first two trees should be familiar as you have had them already on
your laptop all semester. When you receive your PABLO, it will not
have the \var{moos-ivp-extend} tree since it is different for every
person.  A goal of this lab is to log onto your PABLO through your
laptop with Internet sharing, so you can pull your
\var{moos-ivp-extend} tree from \var{git}.

\vspace{0.1in}
\noindent
The \var{moos-ivp-heron} tree comes with your PABLO, compiled, and
\var{moos-ivp-heron/bin} is already in the shell path of the PABLO
user (\var{student2680}). The critical app in our case is \app{iM300},
which implements the payload interface to the Clearpath front-seat
computer. This app is discussed further in the next lab, but it
essentially ingests the vehicle navigation solution and hardware
status from the front-seat and publishes it in the PABLO MOOS
community.  And it ingests the \mvar{THRUST\_LEFT} and
\mvar{THRUST\_RIGHT} from the back-seat PABLO computer.

\vspace{0.2in}
\begin{figure}[H]
  \centering 
  \includegraphics[width=0.75\textwidth]{figures/payload_interface.png}
  \caption{{\bf The Heron Payload Autonomy Interface}: The PABLO
    computer box is connected by an Ethernet cable to the Heron main
    computer. The MOOS community running on the PABLO includes the
    iM300 MOOS app. This app opens a socket over the Ethernet
    connection to the Heron computer. It publishes the level of
    left/right thrust to be applied by the actuator software running
    on the main computer. It consumes navigation and robot status
    information from the Heron and publishes this information locally
    in the MOOSDB on the PABLO, for consumption by the helm and other
    apps.}
  \label{fig_payload_interface}
\end{figure}
\vspace{0.1in}

\vspace{0.1in}
\noindent
The fourth tree on your PABLO, \var{pablo-common}, is designed to
contain as much as the PABLO and \var{student2680} configuration
content as possible. For example, imagine creating the
\var{student2680} user account, with a nice \var{.bashrc} file, and
then replicating the SD card to 50 PABLOs, all boxed up and delivered
to users. Then imagine that something was wrong or missing in the
\var{.bashrc} file. At this point our options would be to either (a)
log into all 50 boxes and edit the file, or (b) fix it on one box and
clone 50 new SD cards and swap out all cards. Neither option is sane.

\vspace{0.1in}
\noindent
Instead, we put the bulk of the \var{.bashrc} file in another file in
\var{pablo-common}. The {\em actual} \var{.bashrc} file on the PABLO
is quite thin and simply reads further \var{bash} configuration
content from another file in \var{pablo-common}. In this way, a change
to the \var{bash} environment for all PABLOs can be made in the
\var{pablo-common} tree, and pushed into version control. The PABLO
user can simply pull the change. In our case, the PABLO is configured
to automatically pull \var{pablo-common} changes when it boots and
finds the Internet.

%==================================================================
\subsection{Working with the PABLOS and the Heron Robots}

When we begin working with the Heron robots on the water, your PABLO
will be running the vehicle. The Ethernet is connected between the
PABLO and the Heron front-seat computer. And the PABLO is powered
through the USB port from a small battery in a similarly water-tight
box, as shown on the right in Figure \ref{fig_pablo_heron}. The gap
between the PABLO and the Heron is open to the elements and that's
why all the connectors on the PABLO are Bulgin IP67 rated water-tight
connectors. 

\vspace{0.2in}
\begin{figure}[H]
  \centering 
  \includegraphics[width=0.85\textwidth]{figures/pablo_heron.png}
  \caption{{\bf The PABLO with the Heron USV}: (left) In 2015, an
    earlier version of the PABLO was used in the Heron. (right) The
    current version of the PABLO has a slightly different connector
    layout and the payload compartment is structured to fit the PABLO
    box in a pre-defined location. The PABLO battery is also now in
    its own battery box with wet connectors.}
  \label{fig_pablo_heron}
\end{figure}
\vspace{0.1in}

\vspace{0.1in}
\noindent
The two USB A ports on the PABLO will need to be capped when you work
with the vehicle on the water.

\vspace{0.1in}
\noindent
With the PABLO, the idea is that you (a) prepare your code in simulation
on your laptop, and push it to version control, (b) connect your PABLO
to the laptop and pull your code onto the PABLO and compile. And finally,
when you're ready to test on the water, (c) find a Heron, connect your
PABLO and launch your mission. So far we have been solely working in mode
(a), in simulation on your laptop. Connecting your PABLO and pulling and
preparing your code is a key step, and is the focus of today's lab.

\vspace{0.1in}
\noindent
When you do eventually connect your PABLO to the Heron, it will still
be possible to log onto your PABLO and pull code updates and
re-compile. However, robot time is a precious commodity, especially
dock-side on a day when testing is supported by colleagues.  You will
want to have as much prepared on your PABLO as possible before you
arrive at the dock.

%==================================================================
\newpage
\section{Connecting to the PABLO through a Mac Computer}
\label{sec_mac}
%==================================================================

For the below instructions, things are slightly different in terms of
the layout in \var{System Settings} menus between MacOS Sonoma or
MacOS Sequioa (newest) releases. Where possible we try to show both
views, but they really are pretty similar enough that you should be
able to find your way around, or with TA help. You can always find out
which release you have by selecting the Apple pull-down menu that
persists in the upper left-hand corner of your window, and select
\var{About This Mac}.

\vspace{0.1in}
\noindent
For MacOS users, your Mac will effectively act as a router, providing
the PABLO with an IP address, connectivity to the computer, and a
route to reach the Internet. MacOS has a feature called {\em Internet
  Sharing}. This option allows the Mac to get a connection to the
Internet on one interface (e.g., wireless) then allow another device
to connect to the Mac over a different interface (e.g.,
Ethernet). Effectively, the PABLO will have access to the Internet and
to the Mac by plugging into the Mac's Ethernet port.

\vspace{0.1in}
\noindent
When Internet Sharing is turned on, the Mac creates a new subnet and
by default assigns itself the shared connection the IP address
\var{192.168.2.1}. The connected PABLO device will be assigned
\var{192.168.2.2}. However, like any router you are not always
guaranteed to receive the \var{.2} suffix on the IP address. We
describe below how to detect the IP address that was actually assigned
to your PABLO.

%==================================================================
\subsection{Enabling Internet Sharing on the Mac}
\label{sec_mac_share}

Below are the steps for enabling Internet Sharing on a Mac:

%------------------------------------------
\paragraph{Step 1: Open Systems Settings:} Click the apple menu (top-left of
  the menu bar), and select {\em System Settings}.

%------------------------------------------
\paragraph{Step 2: Open the {\em Sharing} sub-page:} 
Click on \var{System Settings} then \var{General}, then
\var{Sharing}. It should like Figure \ref{fig_osx_sequoia_sharing}
below.

\begin{figure}[H]
  \centering
  \includegraphics[width=0.9\textwidth]{figures/osx_sequoia_sharing.png}
  \caption{On MacOS Sequoia release, System Settings will look like this.}
  \label{fig_osx_sequoia_sharing}
\end{figure}

%------------------------------------------
\paragraph{Step 3: Configure {\em Sharing}:}
Disable Internet Sharing if it is currently enabled. See the toggle
button at the end of the arrow in Figure
\ref{fig_osx_sequoia_sharing}. When it is disabled, you can make
selections on its configuration by clicking on the (i) button next to
the toggle button as shown in the same figure. For the {\em Share your
  connection from:} option, select {\em Wi-Fi}. For the {\em To
  computers using:} option, check the box or boxes related to
Ethernet. These may have names like \var{USB10/100/1000LAN} as shown
in Figure \ref{fig_sharing_options2}.

\vspace{0.1in}
\begin{figure}[H]
  \centering
  \includegraphics[width=0.45\textwidth]{figures/sharing_options2.png}
  \caption{The settings for Internet Sharing may be selected as shown
    on the right. The Mac will connect to the Internet through Wi-Fi,
    and share with computers connected to one of the Ethernet
    connector options.}
  \label{fig_sharing_options2}
\end{figure}

%------------------------------------------
\paragraph{Step 4: Enable {\em Sharing}:}
Once you have the settings the way you like, go ahead and check the
box next to Internet Sharing, as shown at the end of the arrows in
Figure \ref{fig_osx_sequoia_sharing}. 

\vspace{0.1in}
\noindent
You are now ready to connect your PABLO. (1) Connect the Ethernet cable between
the PABLO and your Mac. (2) Then power on the PABLO by plugging the USB cable into
a power source and then into your PABLO. 

\vspace{0.1in}

%------------------------------------------
\paragraph{Step 5: Disable {\em Sharing}:} When you're done working
with the PABLO, de-select the {\em Internet Sharing} option.




%===================================================================
\subsection{Detecting the PABLO IP Address in MacOS}
\label{sec_mac_detect_ip}

With Internet Sharing on the Mac turned on, when you connect the PABLO
to the MAC it will be assigned an IP address. The assigned IP addresses
are stored in a system file. To determine which IP address was assigned
to your PABLO, you can just display the contents using the \cmd{more}, or
\cmd{cat} command:

\vspace{0.1in}
\begin{consoleverb}
$ cat /var/db/dhcpd_leases
{
    name=PABLO
    ip_address=192.168.2.2              &lt;- This is your PABLO's IP address
    hw_address=1,dc:a6:32:4b:88:c0
    identifier=1,dc:a6:32:4b:88:c0
    lease=0x62535727
}
\end{consoleverb}
\vspace{0.1in}

\noindent
A couple things to note about this file. 

\begin{packed_itemize}
\item It persists even after you disconnect your PABLO. If you
  reconnect the same PABLO, or power off/on the PABLO while retaining
  the Ethernet connections, your Mac can tell it's the same PABLO
  since it also detects the unique hardware address in the
  \var{hw\_address} field above.

\item If you connect a new PABLO, your Mac will assign the next
  available IP address, likely \var{192.168.2.3} in this case. This
  file will now contain two blocks like the example above. The newest
  block is usually at the top.

\item You can safely remove this file at any time.

\vspace{0.1in}
\begin{consoleverb}
  $ cd /var/db
  $ sudo rm dhcpd_leases
\end{consoleverb}

\vspace{0.1in}

  The next time you re-connect a PABLO to your Mac, the file will be
  written to again with the latest assigned DHCP lease, starting again
  with \var{192.168.2.2}

\end{packed_itemize}

\vspace{0.1in}
\noindent
You are now ready to proceed to Section \ref{sec_verify}. 


%========================================================================
\newpage
\section{Connecting to the PABLO through a Linux Computer}
%========================================================================
These instructions are from the perspective of Ubuntu 20.04. The steps may
vary for other Linux distros. 

%==================================================================
\subsection{Enabling Internet Sharing in Ubuntu 20.04}
\label{sec_ushare}

Below are the steps for enabling Internet Sharing in Ubuntu 20.04. 

%------------------------------------------
\paragraph{Step 1: Open System Settings Main Menu:}
Select the menu item on the left labeled \var{Network} as shown in
Figure \ref{fig_settings_menu} below. NOTE: On some computers, if the
Ethernet cable is not yet physically connected, the \var{Wired}
section may simply just not shown.

\vspace{0.1in}
\noindent
After you connect your Ethernet cable from your Linux machine to the
powered-on PABLO, the {\em Wired} menu will be enabled and will look
similar to Figure \ref{fig_settings_menu} on the right.

\begin{figure}[H]
  \centering
  \includegraphics[width=0.85\textwidth]{figures/settings_menu.png}
  \caption{{\bf The Ubuntu Settings Network Menu Option}: The Wired
    option in the Network menu will indicate an unplugged cable
    (left). Note: The Wired section may also be just not shown on
    newer versions of Ubuntu. Either way, plug in the cable. When the
    Ethernet cable is inserted and connected to another device, the
    Wired menu item changes automatically to be enabled (right).}
  \label{fig_settings_menu}
\end{figure}
\noindent

%------------------------------------------
\paragraph{Step 2: Click on the Gear Icon in the Wired Menu Item:}
By clicking on the gear icon, shown on the left in Figure
\ref{fig_linux_wired_details}, the dialog window for configuring the
    {\em Wired} connection will open, shown on the right in Figure
    \ref{fig_linux_wired_details}.

\begin{figure}[H]
  \centering
  \includegraphics[width=0.85\textwidth]{figures/linux_wired_details.png}
  \caption{{\bf Editing the Settings for the Wired Connection}: Click on the
    gear icon in the Wired Menu item (left). A dialog window will open to
    configure the Wired parameters (right).}
  \label{fig_linux_wired_details}
\end{figure}

%------------------------------------------
\paragraph{Step 3: Choose IPv4 Settings:}
Select the IPv4 tab and use the settings {\em Shared to other
  computers}

\begin{figure}[H]
  \centering
  \includegraphics[width=0.85\textwidth]{figures/linux_wired_ipv4.png}
  \caption{{\bf IpV4 Settings}: Initially the Sharing option is disabled (left).
  After selecting it and hitting the Apply button, it will be enabled.}
  \label{fig_linux_wired_ipv4}
\end{figure}

%------------------------------------------
\paragraph{Step 4: Connect the Ethernet Cable:}
If you haven't done so already, connect the PABLO and laptop together
over Ethernet, and power on the PABLO. When they are not connected
the {\em Wired} dialog box, with the {\em Details} tab, looks like the
left in Figure \ref{fig_linux_wired_addr}. When it {\em is} connected,
it should look like the right in Figure \ref{fig_linux_wired_addr}.
Notice on the right, the Ethernet IP address of the Linux machine is
shown. In this case \var{10.42.0.1}. 

\begin{figure}[H]
  \centering
  \includegraphics[width=0.8\textwidth]{figures/linux_wired_addr.png}
  \caption{{\bf IPv4 Address}: When the Ethernet is not connected, the
    {\em Details} dialog box looks like the left. Once the Ethernet is
    connected to a powered-on PABLO, it looks like that shown on the right,
    displaying the Ethernet IP address.}
  \label{fig_linux_wired_addr}
\end{figure}

\vspace{0.1in}
\noindent
The next step, discussed next, is to determine the IP address of the PABLO,
so we can connect to it and log in.

%===================================================================
\subsection{Detecting the PABLO IP Address in Linux}
\label{sec_pablo_ip}

There are a couple options (and probably more that I'm not aware of), for determining
the IP address that was assigned to the PABLO. We describe both. The first is
perhaps a bit simpler but may not work on systems other than the Ubuntu 20.04 that
I have tested on. But it's so simple, so why not.

\vspace{0.1in}

%------------------------------------------
\paragraph{Method 1: Determine the PABLO IP:}
On the command line, try the below:

\vspace{0.1in}
\begin{consoleverb}
$ cat /var/log/syslog | grep DHCPACK
Apr 11 16:28:40 pa dnsmasq-dhcp[16042]: DHCPACK(en..db) 10.42.0.236 dc:a6:32:4b:88:00 PABLO
Apr 11 16:58:45 pa dnsmasq-dhcp[16042]: DHCPACK(en..db) 10.42.0.236 dc:a6:32:4b:88:00 PABLO
Apr 11 17:05:35 pa dnsmasq-dhcp[16332]: DHCPACK(en..db) 10.42.0.236 dc:a6:32:4b:88:00 PABLO
\end{consoleverb}
\vspace{0.1in}

\vspace{0.1in}
\noindent
You should be able to pick out the IP address \var{10.42.0.236} from the above, or you
can use more command line magic:

\vspace{0.1in}
\begin{consoleverb}
$ cat /var/log/syslog | grep DHCPACK | tail -1 | cut -d ' ' -f7
10.42.0.236
\end{consoleverb}
\vspace{0.1in}

\vspace{0.1in}
\noindent
Hint: If the above step works for you, consider adding an alias in your
\var{.bashrc} to make it easy in the future. 

\vspace{0.1in}
\noindent
As mentioned, the above may or may not work on your Linux distro. With
Ubuntu 20.04, it does seem that new DCHP leases are logged in the
system file \var{/var/log/syslog} in this manner. If this doesn't
work, try the next method below.


\vspace{0.1in}
%------------------------------------------
\paragraph{Method 2: Determine the PABLO IP:}
In this method, we use the \cmd{nmap} utility. If this is not
installed on your Linux machine, install it now:

\vspace{0.1in}
\begin{consoleverb}
$ sudo apt install nmap
\end{consoleverb}
\vspace{0.1in}

\noindent
On the command line run \cmd{nmap} as follows:

\vspace{0.1in}
\begin{consoleverb}
$ nmap -sP 10.42.0.1/24
Starting Nmap 7.80 ( https://nmap.org ) at 2024-04-03 21:50 EDT
Nmap scan report for rehoboth (10.42.0.1)     &lt;--- YOUR Linux Machine
Host is up (0.00020s latency). 
Nmap scan report for 10.42.0.236              &lt;--- The PABLO
Host is up (0.00061s latency).     
Nmap done: 256 IP addresses (2 hosts up) scanned in 3.03 seconds
\end{consoleverb}

\vspace{0.1in}
\noindent
The \cmd{nmap} command will respond with a list of hosts that are up.
One will be the laptop you are using while the other should be the
PABLO's IP. {\em In the following instructions do not use 10.42.0.236
  for the PABLO's IP but the one that \cmd{nmap} just found!}



%==================================================================
\section{Verifying PABLO Connection and Login}
\label{sec_verify}
%==================================================================

Now that your PABLO is connected to your laptop, the next step is to
verify that you can log in. You should at this point be armed with
your PABLO's IP address, e.g., something like \var{192.168.2.2} on the
the Mac, or something like \var{10.42.0.236} on Linux.

%==================================================================
\subsection{Using ping Command Line Utility}

The \cmd{ping} command is a command-line (OS X and GNU/Linux) tool for
testing whether another computer can be reached across an IP
network. After connecting the PABLO, it is useful to use \cmd{ping} to
verify that PABLO can be reached from your laptop. In a terminal
window on your laptop:

\vspace{0.1in}
\begin{consoleverb}
 $ ping 192.168.2.2
 PING 192.168.1.2 (192.168.1.2): 56 data bytes
 64 bytes from 192.168.1.2: icmp_seq=0 ttl=64 time=9.203 ms
 64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=12.605 ms
 64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=7.238 ms
 ^C
 --- 192.168.1.2 ping statistics ---
 3 packets transmitted, 3 packets received, 0.0% packet loss
 round-trip min/avg/max/stddev = 7.238/9.682/12.605/2.715 ms
\end{consoleverb}
\vspace{0.1in}

\noindent
The \cmd{ping} command can be stopped by pressing \var{control-C}.
In the example above, \cmd{ping} reached the PABLO and reported the
round-trip communications time. When the connection fails, output
similar to the following is displayed:

\vspace{0.1in}
\begin{consoleverb}
 $ ping 192.168.2.2
 PING 192.168.2.2 (192.168.2.2): 56 data bytes
 Request timeout for icmp_seq 0
 Request timeout for icmp_seq 1
 Request timeout for icmp_seq 2
 ^C
 --- 192.168.2.2 ping statistics ---
4 packets transmitted, 0 packets received, 100.0% packet loss
\end{consoleverb}
\vspace{0.1in}



%==================================================================
\subsection{Assignment 1 (Self Check off) SSH onto the PABLO}

The \cmd{ssh} tool is a command-line (OS X and GNU/Linux) tool for
opening up a terminal on a remote device using a secure shell
connection. In other words, \cmd{ssh} connects the keyboard and
terminal window directly to another computer that is reachable across
the network (i.e, \cmd{ping} displays an affirmative response). Inputs
to \cmd{ssh} include the IP address of the remote system and the user
name. In a terminal window on your laptop, enter the following to
connect via \cmd{ssh}:

\vspace{0.1in}
\begin{consoleverb}
 $ ssh -l student2680 192.168.2.2
\end{consoleverb}
\vspace{0.1in}

\noindent
The username is \var{student2680} and the password will be provided by
the lab instructor. Once connected, the terminal will behave as if the
keyboard and screen (at least the terminal window on the screen) were
connected directly to the remote system.

\vspace{0.1in}
\noindent
Final part of this step: Once you are logged into the PABLO, verify
that you have a connection to the external Internet through your
laptop. We can do this by pinging the course server

\vspace{0.1in}
\begin{consoleverb}
PABLO $ ping oceanai.mit.edu
PING marine-robotics.mit.edu (18.18.38.22): 56 data bytes
64 bytes from 18.18.38.22: icmp_seq=0 ttl=55 time=18.218 ms
64 bytes from 18.18.38.22: icmp_seq=1 ttl=55 time=21.325 ms
64 bytes from 18.18.38.22: icmp_seq=2 ttl=55 time=21.999 ms
\end{consoleverb}
\vspace{0.1in}

\noindent
If you do not see a successful ping as above, double-check that you
have Wi-Fi enabled on your (laptop) machine.  If you do see a
successful ping as above, you are ready for the next step.

\vspace{0.1in}
\noindent
Note: Hereafter we use the following shell prompt to indicate you are
working on your laptop:

\vspace{0.1in}
\begin{consoleverb}
 $ 
\end{consoleverb}
\vspace{0.1in}

\noindent
And the following shell prompt to indicate you are working on your PABLO:

\vspace{0.1in}
\begin{consoleverb}
PABLO $
\end{consoleverb}
\vspace{0.1in}



%==================================================================
\newpage
\section{Accessing your Course Code on the PABLO}
%==================================================================

In this section the goal is to get your \var{moos-ivp-extend} code
onto the PABLO. The \cmd{git} command should be installed on your
PABLO.  If for some reason it is not, let us know. It can installed on
your PABLO with:

\vspace{0.1in}
\begin{consoleverb}
PABLO $ sudo apt-get install git
\end{consoleverb}
\vspace{0.1in}


%==================================================================
\subsection{Assignment 2 (Check off) Loading, Building Your Tree on the PABLO}

In this step the goal is to (a) load your personal repository onto
PABLO unit, (b) build the tree, (c) add your \var{bin/} directory to
the shell path, (d) update your \var{IVP\_BEHAVIOR\_DIRS} environment
variable, and finally (f) demonstrate that your binaries are runnable
from the command line.

\vspace{0.1in}
\paragraph{Step 1: Log back on to the PABLO} If you're not still logged
in, log back in:
	
\vspace{0.1in}
\begin{consoleverb}
 $ ssh -l student2680 192.168.2.2
 student2680@192.168.2.2's password: 
 Last login: Sat Mar 23 17:47:24 2023 from 192.168.2.1
 PABLO $
\end{consoleverb}
\vspace{0.1in}
	
\paragraph{Step 2: Check out your tree:}
By default, logging into the PABLO puts you in the \var{student2680}
home directory. Check out your git repository into that home
directory.

\vspace{0.1in}
\begin{consoleverb}
 PABLO $ git clone git@gitlab.com:janesmith/moos-ivp-janesmith.git
\end{consoleverb}
\vspace{0.1in}

\noindent
Don't forget that on the PABLO you are the user \var{student2680}. On
your laptops you may have the same user name as your git account, and
you may need to keep this in mind when pulling down your code. You may
need to add the user \var{student2680} to your version control access
list.

\paragraph{Step 3: Build your tree:} The \var{moos-ivp} and other trees
  should already be loaded on the machine. To build your tree:
  
\vspace{0.1in}
\begin{consoleverb}
 PABLO $ cd moos-ivp-janesmith
 PABLO $ ./build.sh
\end{consoleverb}
\vspace{0.1in}
	  
\paragraph{Step 4: Augment your Shell Path} Configure the system
  path to know where your MOOS applications are located. Using the
  editor of your choice, on the PABLO unit edit the file
  \var{/home/student2680/.bashrc}. At the end of the file, add:
	
\vspace{0.1in}
\begin{consoleverb}
 export PATH=$PATH:/home/student2680/moos-ivp-janesmith/bin
\end{consoleverb}
\vspace{0.1in}
	
\noindent
Source the \var{.bashrc} file (or log out and back in) to apply
changes to the \var{PATH}.


%==================================================================
\subsection{Assignment 3 (Check off) Decide on a Lab Partner}

For the remainder of the labs, you will be working with a lab partner. Decide
who this is, and let the TAs know. 

%==================================================================
\subsection{Assignment 4 (Self Check off) Access your Lab Partner's Code}

As you prepare for the in-water labs, you will want to test in simulation.
You will need to work collaboratively on a shared set of code. Work out
with your lab partner how you want to do this. It's OK to just share one
person's code base. Even better if you each have access to each other's codebase
and you have both codebase on each of your PABLOs.

\subsection{How to Best Shut Down the Pablo Box}
When you are done, or anytime you need to shut down the Pablo Box, 
run the following command before disconnecting power:

\begin{consoleverb}
PABLO $ sudo halt
\end{consoleverb}

\noindent
This ensures the computer will nicely shut down before power is 
removed. 

%==================================================================
\subsection{Assignment 5 (Bonus to Yourself) Streamline Your Workflow}

Normally when you log onto a PABLO installed on a Heron robot, it is
a two step process:

\vspace{0.1in}
\begin{consoleverb}
  $ ssh -l student2680 192.168.14.100    (For vehicle abe)
\end{consoleverb}
\vspace{0.1in}

\vspace{0.1in}
\noindent
You have to (a) remember the IP address for vehicle abe, and (b) enter
the password for the user \var{student2680}. That's a lot of
typing. It can be done, but it can be simplified to:

\vspace{0.1in}
\begin{consoleverb}
$ ssha 
\end{consoleverb}
\vspace{0.1in}

\noindent
With the steps below, you can just type these four characters, with no
need to enter a password. Nothing to remember, except \var{ssha} is for
\var{"abe"} and \var{sshb} is for \var{"ben"} and so on.


%------------------------------------------------------------------
\subsubsection{Install SSH Keys}

When labs move to the water, you will want to \cmd{ssh} onto your
PABLO many times. Typing in the password will be a nuisance. Create an
ssh key pair and install the public half in the \var{~/.ssh/}
directory on your PABLO.

\vspace{0.1in}
\noindent
\urlx{https://oceanai.mit.edu/ivpman/help/sshkeys}

%------------------------------------------------------------------
\subsubsection{Add Heron Aliases to your Laptop Bash Environment}

\vspace{0.1in}
\noindent
When operating on at the Pavilion, with your PABLO installed into one
of the Herons, the PABLO will be on the local WiFi network with an IP
address determined by which Heron it is on. The names of the MIT Herons
are:

\begin{packed_itemize}
\item abe
\item ben
\item cal
\item deb
\item eve
\item fin
\item max
\item ned
\item oak
\end{packed_itemize}

\vspace{0.1in}
\noindent
If you add the following aliases {\em on your local laptop}, it will
be much easier to log into your PABLO. Typing \var{ssha} for example
takes you right to the PABLO on the vehicle \var{abe}. AND, if you
have your ssh keys installed, then logging in to your PABLO is only 4
key-strokes away! It may seem minor, but when operating robots in the
field, experienced users take every opportunity to simplify routine
steps.

\vspace{0.1in}
\begin{fileverb}
alias  ssha='ssh -l student2680 192.168.14.100'
alias  sshb='ssh -l student2680 192.168.15.100'
alias  sshc='ssh -l student2680 192.168.16.100'
alias  sshd='ssh -l student2680 192.168.17.100'
alias  sshe='ssh -l student2680 192.168.18.100'
alias  sshf='ssh -l student2680 192.168.19.100'
alias  sshm='ssh -l student2680 192.168.20.100'
alias  sshn='ssh -l student2680 192.168.21.100'
alias  ssho='ssh -l student2680 192.168.22.100'

alias pinga='ping 192.168.14.100'
alias pingb='ping 192.168.15.100'
alias pingc='ping 192.168.16.100'
alias pingd='ping 192.168.17.100'
alias pinge='ping 192.168.18.100'
alias pingf='ping 192.168.19.100'
alias pingm='ping 192.168.20.100'
alias pingn='ping 192.168.21.100'
alias pingo='ping 192.168.22.100'
\end{fileverb}
\vspace{0.1in}



%===================================================================
\section{Troubleshooting Notes}
\label{sec_troubleshoot}
%===================================================================

%===================================================================
\subsection{Mechanical Troubleshooting}

If things aren't connecting, consider the set of things that must
work, and methodically swap out with spare components. Besides the
PABLO itself:

\begin{packed_itemize}
\item Swap out the Ethernet cable 
\item Swap out the Ethernet to USB adaptor (if you're using one)
\item Swap out the PABLO power cable. You should be able to look inside the
  PABLO and see the red and green lights come on. If this is happening, then
  you're USB power cable is 99 percent probably OK.
\item If you do not see the LEDs come on inside the PABLO, you may have a bad USB
  power cable. If you are using a USB power hub, check that the hub itself is
  powered on. The ANKER 10-port hubs have a separate power switch on back, and
  there is a blue LED on the front of the ANKER hub when powered on.
\item Of course you can also try another PABLO box.
\item If it turns out the original PABLO box you were given was not
  working, you can un-screw the top and check that all the internal
  connectors are snug.
\end{packed_itemize}

%===================================================================
\subsection{On the MAC - No entry in the dhcpd\_leases file}

If you're not seeing evidence of your PABLO in the form of an entry in
the \var{/var/db/dhcpd\_leases} file:

\begin{packed_itemize}
\item Check your spelling of this file
\item Bring down the Internet Sharing in the Systems Settings window.
  Click on the Info button to the far right of the Internet Sharing
  menu item (the little circle with the 'i' in it, as shown the small
  green circle on the right in Figure
  \ref{fig_osx_sequoia_sharing}). Check all boxes for sharing that
  look like they have anything to do with Ethernet, e.g., \var{Belkin
    USB-C LAN}, or \var{USB 10/100/1000 LAN}. Then un-power your PABLO
  and re-insert the USB power cable, ensuring your Ethernet cable is
  snug on both ends.
\end{packed_itemize}

%===================================================================
\subsection{On the MAC - Multiple entries in the dhcpd\_leases file}

If you see multiple entries in this file, your PABLO, if it is
successfully connected, should be the highest number, e.g.,
\var{192.168.2.3} and not \var{192.168.2.2}.

\vspace{0.1in}
\noindent
This file can be removed if you feel it's warranted. It will be
auto-generated the next/first time a device is connected to your
Mac with Internet sharing enabled.


%===================================================================
\subsection{Connecting to the PABLO - Fall-back Methods}

When the PABLO boots, it will attempt to get an IP address for its
Ethernet port from a DHCP server.  When the PABLO boots, if it cannot
obtain an IP address via DHCP, the Ethernet (\var{eth0}) interface
will fall back to having the IP address of \var{192.168.2.24}. So a
fall-back option for connecting with your laptop, or any machine over
a direct Ethernet connection, is to set your machine's Ethernet IP
address manually to say \var{192.168.2.6}, and just connect with:

\vspace{0.15in}
\begin{consoleverb}
$ ssh -l student2680 192.168.2.24
\end{consoleverb}
\vspace{0.15in}

\noindent
If the above doesn't work, try \cmd{ping 192.168.2.24}. If \cmd{ping}
works then re-check your typing in the \cmd{ssh} command.  If this
option or any of the below methods do not work, your ultimate fallback
is to connect with a monitor and keyboard and check out what is going
on by running \cmd{ifconfig} once you've logged on to the PABLO.


%===================================================================
\subsection{Check the PABLO Power Source}

When the PABLO boots, initially you should see a small red LED turn on
if you look down though the lid. A green light should also blink
periodically as it boots and begins to handle network traffic.

\vspace{0.1in}
\noindent
Consider what you are using for a power source. Even though power-over-USB
should allow you to connect your USB power cable to your laptop, the Pi
may experience a brown-out at some point. 

\end{document}

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