[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

(!) 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.

管理系统依赖项

Description: 本教程将展示如何使用rosdep安装系统依赖项.

Tutorial Level: INTERMEDIATE

Next Tutorial: Roslaunch在大型项目中的使用技巧

  Show EOL distros: 

System Dependencies

ROS packages有时会需要操作系统提供一些外部函数库,这些函数库就是所谓的“系统依赖项”。在一些情况下,这些依赖项并没有被系统默认安装,因此,ROS提供了一个工具rosdep来下载并安装所需系统依赖项。

ROS packages必须在配置文件中声明他们需要哪些系统依赖项。下面我们来看看turtlesim package的配置文件:

$ roscd turtlesim

然后,

$ cat package.xml
  • <package>
    
    ...
    ...
      <build_depend>message_generation</build_depend>
      <build_depend>libqt4-dev</build_depend>
      <build_depend>qt4-qmake</build_depend>
      <build_depend>rosconsole</build_depend>
      <build_depend>roscpp</build_depend>
      <build_depend>roscpp_serialization</build_depend>
      <build_depend>roslib</build_depend>
      <build_depend>rostime</build_depend>
      <build_depend>std_msgs</build_depend>
      <build_depend>std_srvs</build_depend>
    </package>

正如你所看到的,turtlesim 依赖这些函数库和packages.

$ cat manifest.xml
  • <package>
    
    ...
    ...
        <rosdep name="libqt4-dev"/>
        <rosdep name="qt4-qmake"/>
    </package>

正如你所见,turtlesim 依赖于 libqt4-devqt4-qmake.

$ cat manifest.xml
  • <package>
    
    ...
    ...
        <rosdep name="libqt4-dev"/>
        <rosdep name="qt4-qmake"/>
    
    </package>

正如你所见,turtlesim 依赖于 libqt4-devqt4-qmake.

rosdep

rosdep 是一个能够下载并安装ROS packages所需要的系统依赖项的小工具 使用方法:

rosdep install [package]

为turtlesim下载并安装系统依赖项:

$ rosdep install turtlesim

如果是按照教程的顺序学习,那么这很可能是你第一次使用rosdep工具,因此,当执行这条指令,你会看到如下的报错消息:

  • ERROR: your rosdep installation has not been initialized yet.  Please run:
            
        sudo rosdep init
        rosdep update

按照提示执行上边两条指令,并再次安装turtlesim的系统依赖项。

如果你安装的是二进制文件,那么会看到如下信息:

  • All required rosdeps installed successfully

不然,你将看到如下的turtlesim依赖项安装信息:

  • set -o errexit
    set -o verbose
    
    
    if [ ! -f /opt/ros/lib/libboost_date_time-gcc42-mt*-1_37.a ] ; then
      mkdir -p ~/ros/ros-deps
      cd ~/ros/ros-deps
      wget --tries=10 http://pr.willowgarage.com/downloads/boost_1_37_0.tar.gz
      tar xzf boost_1_37_0.tar.gz
      cd boost_1_37_0
      ./configure --prefix=/opt/ros
      make
      sudo make install
    fi
    
    
    if [ ! -f /opt/ros/lib/liblog4cxx.so.10 ] ; then
      mkdir -p ~/ros/ros-deps
      cd ~/ros/ros-deps
      wget --tries=10 http://pr.willowgarage.com/downloads/apache-log4cxx-0.10.0-wg_patched.tar.gz
      tar xzf apache-log4cxx-0.10.0-wg_patched.tar.gz
      cd apache-log4cxx-0.10.0
      ./configure --prefix=/opt/ros
      make
      sudo make install
    fi

rosdep 运行上述bash脚本,并在完成后退出。

Wiki: cn/ROS/Tutorials/rosdep (last edited 2013-10-30 14:18:48 by zhongjin616)