ROS Stack Installation

来源:互联网 发布:新仙女木 知乎 编辑:程序博客网 时间:2024/05/17 05:50

http://wiki.ros.org/ROS/Tutorials/StackInstallation

  • ROS
  • Tutorials
  • StackInstallation

Note: This page needed proofreading and review. This tutorial assumes that you have completed the previous tutorials:ROS tutorials, ros.org.
(!) It is appreciated that problems/questions regarding this tutorial are asked onanswers.ros.org. Don't forget to include in your question the link to this page, 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

目录

  1. What to install
  2. Where are your stacks located
    1. ROS installed via SVN
    2. ROS installed via Pre-compiled binaries (boxturtle)
  3. Downloading from Source
    1. Using SVN to pull down an entire repository
    2. Using GIT to pull down a repository
  4. Installing from source archive

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 selectingBrowse 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 theusb_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 theROS_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 usingSVN then you should get the following, with username replaced by your username.

ROS installed via SVN

切换行号显示
$ echo $ROS_PACKAGE_PATH/home/username/ros/stacks$ more /home/username/ros/setup.shexport ROS_ROOT=/home/username/ros/rosexport PATH=$ROS_ROOT/bin:$PATHexport PYTHONPATH=$ROS_ROOT/core/roslib/src:$PYTHONPATHif [ ! "$ROS_MASTER_URI" ] ; then export ROS_MASTER_URI=http://localhost:11311 ; fiexport ROS_PACKAGE_PATH=/home/username/ros/stackssource $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)

切换行号显示
$ echo $ROS_PACKAGE_PATH/opt/ros/boxturtle/stacks$ more /opt/ros/boxturtle/setup.shexport ROS_ROOT=/opt/ros/boxturtle/rosexport PATH=$ROS_ROOT/bin:$PATHexport PYTHONPATH=$ROS_ROOT/core/roslib/src:$PYTHONPATHif [ ! "$ROS_MASTER_URI" ] ; then export ROS_MASTER_URI=http://localhost:11311 ; fiexport ROS_PACKAGE_PATH=/opt/ros/boxturtle/stackssource $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.

切换行号显示
$ 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 aslibswscale 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 isGit, so in this part we will use git to pull down the CCNY Robotics Lab ROS Repository and we will build thelaser_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