Note: This page needed proofreading and review. This tutorial assumes that you have completed the previous tutorials: ROS tutorials, ros.org.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Stack Installation

Description: This tutorial describes how to install 3rd party stacks

Keywords: stack, package, installation, install

Tutorial Level: BEGINNER

/!\ This tutorial is out-of-date and applies only to rosbuild packages; not to catkin.

What to install

ROS has a growing number of 3rd party software packages that can provide drivers or algorithms you can use on your robot. You can find this software by selecting Browse Software at the top of the page.

Once you have found a package you are interested in you will want to install it. This tutorial will assume that that you are interested in installing the usb_cam package or the laser_ortho_projector package. The instructions for other packages should be roughly the same.

First, you need to locate where your stacks are located by ROS, and depends on your type of installation.

Then, two different ways of installing the repository will be explained:

Using SVN to pull down an entire repository

Using GIT to pull down a repository

Where are your stacks located

ROS stores groups of packages in stacks, and it stores the stacks wherever you want. ROS will search for packages and stacks that are listed in the ROS_PACKAGE_PATH environmental variable.

The location of setup.sh and the default for ROS_PACKAGE_PATH depends on how you installed ROS. If you installed using SVN then you should get the following, with username replaced by your username.

ROS installed via SVN

   1 $ echo $ROS_PACKAGE_PATH
   2 /home/username/ros/stacks
   3 $ more /home/username/ros/setup.sh
   4 export ROS_ROOT=/home/username/ros/ros
   5 export PATH=$ROS_ROOT/bin:$PATH
   6 export PYTHONPATH=$ROS_ROOT/core/roslib/src:$PYTHONPATH
   7 if [ ! "$ROS_MASTER_URI" ] ; then export ROS_MASTER_URI=http://localhost:11311 ;
   8  fi
   9 export ROS_PACKAGE_PATH=/home/username/ros/stacks
  10 source $ROS_ROOT/tools/rosbash/rosbash

If you installed from pre-compiled binaries of debian packages you should get something similar to this.

ROS installed via Pre-compiled binaries (boxturtle)

   1 $ echo $ROS_PACKAGE_PATH
   2 /opt/ros/boxturtle/stacks
   3 $ more /opt/ros/boxturtle/setup.sh
   4 export ROS_ROOT=/opt/ros/boxturtle/ros
   5 export PATH=$ROS_ROOT/bin:$PATH
   6 export PYTHONPATH=$ROS_ROOT/core/roslib/src:$PYTHONPATH
   7 if [ ! "$ROS_MASTER_URI" ] ; then export ROS_MASTER_URI=http://localhost:11311 ;
   8  fi
   9 export ROS_PACKAGE_PATH=/opt/ros/boxturtle/stacks
  10 source $ROS_ROOT/tools/rosbash/rosbash

You can also edit setup.sh if you would like to install your stacks somewhere specific.

export ROS_PACKAGE_PATH=/home/username/ros/stacks:/home/username/project:/home/username/ros_tutorials

Downloading from Source

Most of the packages and stacks you may be interested are available as source code. ROS makes building from source code easy.

Using SVN to pull down an entire repository

So for example lets say you wanted to use the usb_cam driver, and you decided to download the entire Bosch ROS Repository in case there was anything else you needed.

First, make sure you have SVN installed.

   1 $ sudo aptitude install subversion

If you installed the pre-compiled binary version of ROS then you may want to create a directory to build stacks from source. First edit your ROS_PACKAGE_PATH in /opt/ros/boxturtle/setup.sh or in your .bashrc

export ROS_PACKAGE_PATH=~/ros/stacks:/opt/ros/boxturtle/stacks

Next, in a terminal switch to the directory that is now in your ROS_PACKAGE_PATH.

   1 $ mkdir ~/ros && mkdir ~/ros/stacks
   2 $ cd ~/ros/stacks

Then you can checkout the trunk from the svn repository listed in the wiki. The trunk if you are curious is the default branch of code in a svn repository, as opposed to the experimental branch.

   1 $ svn co https://bosch-ros-pkg.svn.sourceforge.net/svnroot/bosch-ros-pkg/trunk/ bosch-ros-pkg

After it is downloaded you can change to the usb_cam directory and compile the source code.

   1 $ cd bosch-ros-pkg/bosch_drivers/usb_cam
   2 $ rosmake --rosdep-install

--rosdep-install will install system dependencies such as libswscale that the code will need to compile. If rosmake produces an error the first time you run it, try running it again as it may have needed to automatically add the subdirectory to its index.

Using GIT to pull down a repository

The other common software configuration management tool you will see used is Git, so in this part we will use git to pull down the CCNY Robotics Lab ROS Repository and we will build the laser_ortho_projector from source.

First, make sure you have Git installed.

   1 $ sudo aptitude install git-core

Next, in a terminal switch to a directory that is in your ROS_PACKAGE_PATH. In this case we will assume that you installed ROS from SVN

   1 cd ~/ros/stacks

Then you can clone the git repository

   1 git clone http://robotics.ccny.cuny.edu/git/ccny-ros-pkg.git/

Once it has finished downloading switch to the directory and run rosmake

   1 cd ccny-ros-pkg/scan_tools/laser_ortho_projector
   2 rosmake --rosdep-install

rosmake may need to be run twice to add the new directory, and compile.

Installing from source archive

The developer may have released a version of the software as a source code archive. This might be a file such as scan_tools-0.1.0.tar.bz2, which we will assume is in your ~/Downloads directory.

   1 cd ~/ros/stacks
   2 mv ~/Downloads/scan_tools-0.1.0.tar.bz2 .
   3 bunzip2 scan_tools-0.1.0.tar.bz2
   4 tar -vpxf scan_tools-0.1.0.tar
   5 rm scan_tools-0.1.0.tar

Wiki: ROS/Tutorials/StackInstallation (last edited 2016-03-16 17:34:43 by AustinHendrix)