{转官网}ROS-Hydro安装

Installing from source

Install from source requires that you download and compile the source code on your own. ROS Hydro ONLY supports Precise, Quantal, and Raring. Other platforms are possible to use but are not expected to work out of the box. Target platforms are defined in REP 3

Prerequisites

Installing bootstrap dependencies

These tools are used to facilitate the download and management of ROS packages and their dependencies, among other things.

Ubuntu:

Fedora:

  • $ sudo yum install python-rosdep python-rosinstall_generator python-wstool python-rosinstall @buildsys-build

    Some packages used in ROS are not currently available in the Fedora RPM repositories. Most of the other packages are available in RPM Fusion. See RPM Fusion Command Line Setup.

    Any packages not available in RPM Fusion are staged in the SDSM&T ROS RPM staging repository, which is available from csc.mcs.sdsmt.edu.

Generic (pip):

  • If you are using a non-Debian system you need to make sure that you have all build tools (compiler, CMake, etc.) installed. You can install all ROS Python tools via PIP:
    $ sudo pip install -U rosdep rosinstall_generator wstool rosinstall

Initializing rosdep

$ sudo rosdep init
$ rosdep update

Installation

Start by building the core ROS packages.

Building the catkin Packages

ROS is in the process of converting to a new build system, catkin, but not all of the packages have been converted and the two build systems cannot be used simultaneously. Therefore it is necessary to build the core ROS packages first (catkin packages) and then the rest.

Create a catkin Workspace

In order to build the core packages, you will need a catkin workspace. Create one now:

  • $ mkdir ~/ros_catkin_ws
    $ cd ~/ros_catkin_ws

Next we will want to fetch the core packages so we can build them. We will use wstool for this. Select the wstool command for the particular variant you want to install:

Desktop-Full Install: ROS, rqtrviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception

  • $ rosinstall_generator desktop_full --rosdistro hydro --deps --wet-only --tar > hydro-desktop-full-wet.rosinstall
    $ wstool init -j8 src hydro-desktop-full-wet.rosinstall

Desktop Install (recommended): ROS, rqtrviz, and robot-generic libraries

  • $ rosinstall_generator desktop --rosdistro hydro --deps --wet-only --tar > hydro-desktop-wet.rosinstall
    $ wstool init -j8 src hydro-desktop-wet.rosinstall

ROS-Comm: (Bare Bones) ROS package, build, and communication libraries. No GUI tools.

  • $ rosinstall_generator ros_comm --rosdistro hydro --deps --wet-only --tar > hydro-ros_comm-wet.rosinstall
    $ wstool init -j8 src hydro-ros_comm-wet.rosinstall

This will add all of the catkin or wet packages in the given variant and then fetch the sources into the ~/ros_catkin_ws/srcdirectory. The command will take a few minutes to download all of the core ROS packages into the src folder. The -j8option downloads 8 packages in parallel.

In addition to the 3 variants above, more are defined in REP 131 such as robotperception, etc. Just change the package path to the one you want, e.g., for robot do:

$ rosinstall_generator robot --rosdistro hydro --deps --wet-only --tar > hydro-robot-wet.rosinstall
$ wstool init -j8 src hydro-robot-wet.rosinstall

If wstool init fails or is interrupted, you can resume the download by running:

wstool update -j 4 -t src

Resolving Dependencies

Before you can build your catkin workspace you need to make sure that you have all the required dependencies. We use therosdep tool for this:

  • $ rosdep install --from-paths src --ignore-src --rosdistro hydro -y

This will look at all of the packages in the src directory and find all of the dependencies they have. Then it will recursively install the dependencies.

The --from-paths option indicates we want to install the dependencies for an entire directory of packages, in this case src. The --ignore-src option indicates to rosdep that it shouldn't try to install any ROS packages in the src folder from the package manager, we don't need it to since we are building them ourselves. The --rosdistro option is required because we don't have a ROS environment setup yet, so we have to indicate to rosdep what version of ROS we are building for. Finally, the -y option indicates to rosdep that we don't want to be bothered by too many prompts from the package manager.

After a while (and maybe some prompts for your password) rosdep will finish installing system dependencies and you can continue.

Building the catkin Workspace

Once it has completed downloading the packages and resolving the dependencies you are ready to build the catkin packages. We will use the catkin_make_isolated command because there are both catkin and plain cmake packages in the base install, when developing on your catkin only workspaces you should use catkin/commands/catkin_make.

Invoke catkin_make_isolated:

  • $ ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release

Note: You might want to select a different CMake build type (e.g. RelWithDebInfo or Debug, see http://cmake.org/cmake/help/v2.8.12/cmake.html#variable:CMAKE_BUILD_TYPE).

Note: The default catkin installation location would be ~/ros_catkin_ws/install_isolated, if you would like to install some where else then you can do this by adding the --install-space /opt/ros/hydro argument to your catkin_make_isolatedcall.

For usage on a robot without Ubuntu, it is recommended to install compiled code into /opt/ros/hydro just as the Ubuntu packages would do. Don't do this in Ubuntu, as the packages would collide with apt-get packages. It is also possible to install elsewhere (e.g. /usr), but it is not recommended unless you really know what you are doing.

Please see REP 122: Filesystem Hierarchy Layout for more detailed documentation on how the installed files are placed.

Note: In the above command we are running the catkin_make_isolated command from the catkin source folder because it has not been installed yet, once installed it can be called directly.

Now the packages should have been installed to ~/ros_catkin_ws/install_isolated or to wherever you specified with the --install-space argument. If you look in that directory you will see that a setup.bash file have been generated. To utilize the things installed there simply source that file. Lets do that now before building the rest of ROS:

  • $ source ~/ros_catkin_ws/install_isolated/setup.bash

Maintaining a Source Checkout

If we want to keep our source checkout up to date, we will have to periodically update our rosinstall file, download the latest sources, and rebuild our workspace.

Update the workspace

To update your workspace, first move your existing rosinstall file so that it doesn't get overwritten, and generate an updated version. For simplicity, we will cover the *destop-full* variant. For other variants, update the filenames and rosinstall_generator arguments appropriately.

$ mv -i hydro-desktop-full-wet.rosinstall hydro-desktop-full-wet.rosinstall.old
$ rosinstall_generator desktop_full --rosdistro hydro --deps --wet-only --tar > hydro-desktop-full-wet.rosinstall

Then, compare the new rosinstall file to the old version to see which packages will be updated:

$ diff -u hydro-desktop-full-wet.rosinstall hydro-desktop-full-wet.rosinstall.old

If you're satified with these changes, incorporate the new rosinstall file into the workspace and update your workspace:

$ wstool merge -t src hydro-desktop-full-wet.rosinstall
$ wstool update -t src

Rebuild your workspace

Now that the workspace is up to date with the latest sources, rebuild it:

$ ./src/catkin/bin/catkin_make_isolated --install

If you specified the --install-space option when your workspace initially, you should specify it again when rebuilding your workspace

Once your workspace has been rebuilt, you should source the setup files again:

$ source ~/ros_catkin_ws/install_isolated/setup.bash
安装ROS Humble版(Software Foundation Release,通常指Hydro、Indigo、Jade等较早版本)的Sophus库,需要遵循一些基本步骤,因为Sophus是一个用于机器人学的外部开源库,不是ROS的核心包。以下是针对Ubuntu系统的一个简要指南: 1. **更新系统**: 首先,确保你的Ubuntu是最新的,运行 `sudo apt-get update` 和 `sudo apt-get upgrade`。 2. **安装必要的依赖**: 安装ROS Humble所需的开发工具和依赖项,比如: ``` sudo apt-get install ros-${distro}-desktop ros-${distro}-common ``` 将`${distro}`替换为你实际使用的ROS发行版名称,如`hydro`、`indigo`等。 3. **获取Sophus源码**: 由于Sophus不在标准的ROS仓库中,你需要从GitHub或其他官方源获取源码。访问 Sophus GitHub页面(https://github.com/orocos/orocos_kinematics_dynamics),克隆或下载最新版本的代码。 4. **构建安装**: 进入Sophus目录,然后按照项目的README文件指示配置CMake并编译。通常需要创建一个`ament_cmake`化的项目,例如: ``` cd /path/to/sophus mkdir build cd build colcon build --symlink-install ``` 5. **将 Sophus 添加到ROS路径**: 如果你想让ROS能够自动找到Sophus,需要将其添加到`AMENT_PACKAGE_PATH`环境变量中。你可以编辑`~/.bashrc`或`~/.bash_profile`,添加如下行: ```bash export AMENT_PACKAGE_PATH=$AMENT_PACKAGE_PATH:/path/to/sophus/build/install ``` 6. **重启终端**: 最后,关闭当前终端窗口,然后打开一个新的,以应用新设置。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值