ROS Stack Installation

http://wiki.ros.org/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 on answers.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

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

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

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

切换行号显示
$ 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值