AN INTRODUCTION TO MOOS

GTRI ROBOLAB也在用MOOS-IvP,这是他们网站上的一篇介绍文章,和我的前一篇文章内容相似。

The Mission Oriented Operating Suite (MOOS) is a publish-and-subscribe middleware software system for robotic platforms.  MOOS-IvP (Interval Programming) is an extension to MOOS that adds a higher level of autonomy and behavior fusion for a robotic system.  The exact implementation of a publish-and-subscribe system can vary between systems, but the basic idea is similar between systems.  In a publish-and-subscribe system, there are parallel nodes that can publish information, subscribe to information, or do both.  For example, an accelerometer node might publish acceleration data, while an autopilot node might subscribe to that acceleration data.  Thus, the publish-and-subscribe system makes sure that when new acceleration data is produced by the accelerometer node, the new data is provided to the autopilot node.  You can read more about MOOS and MOOS-IvP.

We will be installing MOOS on a Linux-based system, Ubuntu.  See the previous tutorials on setting up a virtual machine and the introduction to Linux.

Install the appropriate dependencies first:

$ sudo apt-get install subversion libglut3-dev libx11-dev libxft-dev libtiff-dev cmake g++

If you have problems down the line due to video problems, you may need to install some extra video card drivers.

For nvidia-based cards use:

$ sudo apt-get install nvidia-glx-dev libsm-dev libxext-dev

For ATI-based cards use:

$ sudo apt-get install xorg-driver-fglrx-dev

There are some more specifics about required packages in the README-LINUX.txt file that comes with MOOS-IvP when you download it that you can refer to if you have problems, but these packages generally work.

Now, you can get a copy of the stable version of MOOS using subversion (svn) in your home directory:

$ cd ~
$ svn co https://oceanai.mit.edu/svn/moos-ivp-aro/releases/moos-ivp-12.2 moos-ivp

This will download and create a copy of the MOOS-IvP software in your home directory.  MOOS-IvP 12.2 is the latest stable version as of 8/22/2012.  You should check and see if there is a newer version if you are reading this tutorial much later on at: http://oceanai.mit.edu/moos-ivp/pmwiki/pmwiki.php?n=Site.Download

Once MOOS finishes downloading.  We will move into the MOOS directory and build it, along with MOOS-IvP.

$ cd ~/moos-ivp
$ ./build-moos.sh
$ ./build-ivp.sh

Finally, we need to add the executables that we should built to the operating system’s $PATH variable.  This is accomplished by adding some “export” lines to the .bashrc file in your home directory.  (Remember that every time that you start a new terminal, the script lines in .bashrc are executed?  We will append directory locations to the $PATH variable in this file to account for every new terminal instance.  Also, we have to be careful to not destroy the $PATH variable when we append to it since the operating system uses the $PATH variable to find important programs to execute.  We will use the nano program to edit the .bashrc file.

$ nano ~/.bashrc

Go to the bottom of the file (use the arrow down key, or use (CTRL + v) to page down).  Add the following lines to the end of the file:

#
# Add MOOS executables to the $PATH
#
export PATH=$PATH:~/moos-ivp/ivp/bin
export PATH=$PATH:~/moos-ivp/MOOS/MOOSBin

The #-sign is used for comments.  Thus, the text on the same line after the #-sign is arbitrary. It is important to note that the new PATH variable has all of the same directories as the original PATH variable since we used $PATH to define the new PATH variable (the $-sign only shows up on the right hand side of the equals sign for syntactic reasons).  Also directories are delimited by colons to denote different locations.  To save the new file type:

CTRL + x

When asked if you want to “Save modified buffer,” type the letter “y” for YES. Then nano will ask you which file to write the buffer to.  The default value should point to the .bashrc file in your home directory, so just hit the ENTER key.

In order to test that MOOS was installed correctly, close your open terminal(s).  Open a new terminal with the CTRL + ALT + T shortcut. Now start the main MOOS database server by typing:

$ MOOSDB

If MOOS was installed correctly, you will see the MOOS database startup and print out something like:

***************************************************
*       This is MOOS Server for Community "#1"
*       c. P Newman 2001
*
*       Binding on 9000
*
*       This machine is Little endian
***************************************************

------------CONNECT-------------
New client connected from machine "localhost"
Handshaking....done
clients name is "DBWebServer"
There are now 1 clients connected.
--------------------------------

*****************************************************
serving webpages HTTP on http://machine:9080
*****************************************************

If you received errors, make sure you set the $PATH correctly by typing:

$ echo $PATH

Make sure the $PATH variable contains the directory that holds your MOOSDB executable.  If you followed these instructions, the MOOSDB executable can be found by changing directory and listing:

$ cd ~/moos-ivp/MOOS/MOOSBin
$ ls

Obviously, make sure that the MOOSDB executable is listed in MOOSBin. Another useful Linux function is “which.”  This function will return the complete path to a requested executable.  If you think that MOOSDB is correctly in the $PATH, but it’s not working try typing:

$ which MOOSDB

It should return something like:

/home/username/moos-ivp/MOOS/MOOSBin/MOOSDB

If you are still having problems running MOOSDB, take a close look at the output from the terminal and try to determine if you are missing the necessary packages.

If you want to try running a mission type the following:

$ cd ~/moos-ivp/ivp/missions/m2_berta
$ ./launch

Once the simulation finishes its setup, using the main pMarineViewer mission viewer, click on the DEPLOY button to start the mission.  To stop the mission and close all windows, go to the terminal that you used to setup the mission and type the number 2 to “Exit and Kill Simulation.”

Questions / Comments:
Author: Kevin DeMarco 
[email protected]

你可能感兴趣的:(MOOS)