Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Directory Structure

All kayak related code is located in the "code/marine " directory of the hovergroup svn.  The svn can be viewed or checked out by anyone at https://code.google.com/p/hovergroup/.

Code Block
↓hovergroup
  ↓code
    ↓marine
      →libraries
      →core
      →drivers
      →utils
    ↓personal
      →josh
    ↓marine
  →template
      ...
    ...

The marine directory contains general code for the kayaks not specific to any expeirment.  

Libaries - acomms and utility libraries required to build other hovergroup applications.  You may also want to use these libraries in your own applications, so they have been separated here.  

Core - these applications are required to run a simulation.  

Drivers - hardware drivers only needed on the vehicles.  

Utils - Utilities for log parsing and interacting with the MOOSDB in real time.  

 

The missions directory contains all of the configuration files used to run a MOOS mission on the vehicles. For more information check out Mission File Organization. Ignore the project_files directories and any files located immediately in the ivp-extend directory.

The remaining directories are all for source code. trunk contains the majority of the hovergroup applications and libraries. Individuals also have their own directories for programs that are specific to their experiments. The base directory can be copied and renamed to create new individual directories.

ivp-extend -> base

personal directory is for code written for specific experiments or applications.

Template - a template for creating your own personal directory that links to the hovergroup libraries.  

Looking deeper

Each of the directories above can be built separately using cmake.  Inside of each directory we should see something similar to the following.  Let's look at the basic structure of one of these directories.

Code Block
↓hovergroup
  ↓ivp-extend↓code
    ↓base↓marine
      →bin→core
      →build
      →data→bin
      →docs
      →lib
      →missions
      →scripts→src
      →src
       build_proto.sh
        CMakeLists.txt

Here's what you should know:

bin - Where built executables are placed.

data - If you need to associate some sort of data file with your program that doesn't depend on the mission, this might be the place for it.

docs - For documentation, though usually the wiki is preferred.

lib - Where built libraries are placed.

missions - You can use this directory for testing mission files, but actual missions should use the ivp-extend/missions directory.

scripts - For command line scripts, which we'll come back to.

src - The source code itself.

...

Within the src directory you'll see that each library or application has its own folder, and within those folder are header and source files. Folders for libraries are prefixed with lib_. Almost every folder also contains a CMakeLists.txt.

Building

We'll take the marine/core directory as an example.  The first step to building the code in a directory is compiling any protobufs by running the build_proto.sh script.  Next, run cmake within the directory: Let's switch to ivp-extend/trunk now to look at how the code gets built. make is responsible for building the c++ source code into an executable, but it needs a Makefile to tell it what to do. We use cmake to create these Makefiles. Cmake is run from the top directory (ivp-extend/trunk) using the command

Highlight
color#a0a0a0
cmake .
or
Highlight
color#a0a0a0
ccmake .
if you need a user interface. It drills down through the source tree looking at every CMakeLists.txt file on the way. The CMake files at different levels do different things:

ivp-extend/trunkcode/marine/core/CMakeLists.txt - This is the most complicated file, responsible for finding various dependencies. Typically you should not  You may need to change modify this file depending on your checkout location to make sure cmake can find moos, moos-ivp, goby, and other hovergroup dependencies.  

ivp-extend/trunk/src/CMakeLists.txt - This file simply tells cmake which directories to look in. You'll need to add a line here for each new program or library.

ivp-extend/trunk/src/iHoverKayak/CmakeLists.txt - The last level contains instructions for how to build that specific application or library. Any libraries your program needs to link must be defined here.

Running cmake will create some new files and directories as well as the makefiles. Once you've run cmake you can simply run make to build everything. None of the files created by cmake or make should be added to the svn.

Finally, simply run make to build the code.  

Starting your own application

Let's switch back to your own directory, copied from the base. Inside the scripts directory you'll find GenMOOSApp. This script can create a blank slate MOOS application for you. Call it using the syntax:To create a new application, run the GenMOOSApp script located in "hovergroup/code/marine/scripts"

Code Block
GenMOOSApp [app-name] [prefix]

...