<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%======================================================================
\newpage
\section{Downloading and Building the moos-ivp-extend Tree}
%======================================================================

The first step of today's lab is to set up your own copy of the
\var{moos-ivp-extend} tree, under version control. From this point forward
in the class you will be working with this tree, under version control.

\vspace{0.1in}
\noindent
There are a few choices regarding which version control software to
use. Primarily people either choose (a) \cmd{git}, or (b) \cmd{svn}
(a.k.a., Subversion).  Many people, especially in recent years use
\cmd{git}. If you are a git user, please feel free to continue to use
\cmd{git}. I happen to work primarily with \cmd{svn}, which also has a
reputation for being much easier to use for people new to version
control.

\vspace{0.1in}
\noindent
In 2.680 we will provide all students with your personalized
\var{moos-ivp-extend} tree, already under \cmd{svn} version control,
served from the \pvar{oceanai} class server. This means that an
account will be created for you on this server. You should have
gotten an email about this already.

\vspace{0.1in}
\noindent
If you plan to use \cmd{git}, feel free to ignore the below steps,
(except Section \ref{sec_git}), and please let us know so we can
deactivate your \pvar{oceanai} account. Git users will be responsible
for setting up their own git repository and setting up read access for
the TAs.

\vspace{0.1in}
\noindent
Otherwise for SVN users we ask that you perform the following steps.

%======================================================================
\subsection{Set Up Your Oceanai Server Account}

For those not using \cmd{git}, the \pvar{oceanai} server will be the server
handling the version control of your software tree for the course. It
is the same server from which the \var{moos-ivp} tree, and course web
content is served.

\vspace{0.1in}
\noindent
To get started, follow the instructions in the email we send to you
with the subject \var{"Your \pvar{OCEANAI} account"}. Verify login, and
change your password to something reasonably hard on \pvar{oceanai}. Ideally
your \pvar{oceanai} username is the same as the username on your laptop. If
it is, you can log in simply with:

\vspace{0.1in}
\begin{consoleverb}
$ ssh oceanai.mit.edu
\end{consoleverb}

\vspace{0.1in}
\noindent
If your \pvar{oceanai} username and your laptop username are different, then
an extra argument is needed. For example if you are \var{"kath"} on your
laptop, but username \var{"kathleen"} on \pvar{oceanai}, then you need to
specify your \pvar{oceanai} username as part of the login process:

\vspace{0.1in}
\begin{consoleverb}
$ ssh -l kathleen oceanai.mit.edu
\end{consoleverb}

\vspace{0.1in}
\noindent
Once you have logged on, change the password (using the \cmd{passwd}
command-line utility) and then log out (with either the \cmd{exit} or
\cmd{logout} command-line utility). Please use a reasonably hard
password. Once you have set up your SSH Keys in the below steps, you
will no longer need to enter your password.  We can always reset your
password if you forget.

%======================================================================
\subsection{Check Out Your Software Tree}

Follow the instructions in the second email with the subject \var{"New
  SVN tree"}. Verify that you can check out the svn tree, and build
the code.  Note that you may have already made a folder of this name
at the end of Lab 3.  If so, move that one aside and work with this
one hereafter.  If you don't have the \cmd{svn} command installed you
may have to install the package "subversion" onto your system. See:

\vspace{0.1in}

\urlx{https://oceanai.mit.edu/ivpman/help/svn\_install}

\vspace{0.1in}
\noindent
You will want to check out this tree to be alongside the \var{moos-ivp} tree.
Verify that you can build the tree:

\vspace{0.1in}
\begin{consoleverb}
$ ls 
moos-ivp  moos-ivp-username
$ cd moos-ivp-username
./build.sh
\end{consoleverb}

\vspace{0.1in}
\noindent
Confirm that the build succeeded by examining the contents of
\var{moos-ivp-username/bin}. You should see the binary \app{pXRelayTest}.

\vspace{0.1in}
\noindent
{\bf NOTE:} You need to add \var{moos-ivp-username/bin} to your shell path!

%======================================================================
\subsection{Set up SSH Keys}

Follow the instructions for setting up SSH Keys. This is very
important.  Many of your interactions with version control require you
to present your \pvar{oceanai} credentials, i.e., typing in your
password. Users that don't set up SSH Keys invariably use their
version control less often and have a negative experience in the
process. Those who set up SSH Keys tend to be much more productive and
happy. Just do it. The instructions are here:

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

%======================================================================
\subsection{Start Getting Familiar with the Basics of SVN and Version Control}

Check out the \var{"Getting Started with SVN"} help pages on the class
  website

\begin{packed_itemize}

\item \var{Help Topic: Getting Started with SVN}

\urlx{https://oceanai.mit.edu/ivpman/help/svn\_install}

\item \var{Help Topic: The SVN Checkout Command}
  
\urlx{https://oceanai.mit.edu/ivpman/help/svn_checkout_cmd}

\item \var{Help Topic: The SVN info and log Commands}
  
\urlx{https://oceanai.mit.edu/ivpman/help/svn_info_log_cmds}

\item \var{Help Topic: The SVN Update Command}
  
\urlx{https://oceanai.mit.edu/ivpman/help/svn_update_cmd}

\item \var{Help Topic: The SVN Status Command}
  
\urlx{https://oceanai.mit.edu/ivpman/help/svn_status_cmd}

\item \var{Help Topic: The SVN Add and Remove Commands}
  
\urlx{https://oceanai.mit.edu/ivpman/help/svn_add_remove_cmds}

\item \var{Help Topic: The SVN Move Command}
  
\urlx{https://oceanai.mit.edu/ivpman/help/svn_mv_cmd}

\item \var{Help Topic: The SVN Commit Command}
  
\urlx{https://oceanai.mit.edu/ivpman/help/svn_commit_cmd}

  
\end{packed_itemize}
  

%========================================================================
\subsection{Instructions for Git Users}
\label{sec_git}

If you are an experienced \cmd{git} user, you essentially need to do the
\cmd{git} version of the above steps. Get a copy of the \var{moos-ivp-extend}
tree:

\vspace{0.1in}
\begin{consoleverb}
 $ svn co https://oceanai.mit.edu/svn/moos-ivp-extend/trunk moos-ivp-extend
\end{consoleverb}
\vspace{0.1in}

\vspace{0.1in}
\noindent
Remove the \var{.svn/} directory and establish a tree on GitHub or GitLab. You will
need to set up permissions such that the TAs can have read-only anonymous access.


%---------------------------------------------------------------------------
\subsection{A Peek Under the Hood}

Before moving on to the next exercise, take a quick look at the
Relayer MOOS app class definition from this example. It is shown below
and may also be found in \var{moos-ivp-extend/src/pXRelayTest/}. Note
a couple things:

\begin{packed_itemize}[3]
\item The class declaration, on line 1, declares itself to be a
  subclass of CMOOSApp, the general superclass of all MOOS apps.
\item Our class overrides the three key virtual functions of the
  parent class, declared in lines 8-10.
\item Coding convention: All member functions are declared before all
  member variables. Overridden MOOSApp member functions are declared
  before subclass specific member functions.
\item Coding convention: All member variables begin with \var{m\_}, to
  set them apart from locally declared variables in the code.
\item Coding convention: All member variables protected. Setting member
  variables happens through a public member function, e.g., lines 14,15.
\end{packed_itemize}

\vspace{0.1in}
\footnotesize
\begin{fileverb}
File Relayer.h
1  #include "MOOS/libMOOS/MOOSLib.h"
2  class Relayer : public CMOOSApp
3  {
4   public:
5    Relayer();
6    virtual ~Relayer() {};
7  
8    bool OnStartUp();                        // Overriding key virtual function
9    bool OnNewMail(MOOSMSG_LIST &amp;NewMail);   // Overriding key virtual function
10    bool Iterate();                          // Overriding key virtual functionx
11  
12    bool OnConnectToServer();
13    void RegisterVariables();
14
15    void setIncomingVar(std::string s) {m_incoming_var=s;}
16    void setOutgoingVar(std::string s) {m_outgoing_var=s;}
17  
18   protected:
19    unsigned long int m_tally_recd;
20    unsigned long int m_tally_sent;
21    unsigned long int m_iterations;
22   
23    std::string       m_incoming_var;
24    std::string       m_outgoing_var;
25    double            m_start_time_postings;
26    double            m_start_time_iterations;
27  };
\end{fileverb}
\normalsize


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