在Raspberry上安装ROS

官方安装教程地址:

kinetic--http://wiki.ros.org/ROSberryPi/Installing%20ROS%20Kinetic%20on%20the%20Raspberry%20Pi
indigo--http://wiki.ros.org/ROSberryPi/Installing%20ROS%20Indigo%20on%20Raspberry%20Pi

树莓派操作系统为Raspbian,安装的ROS版本为indigo

首先在源中添加ROS Repositories,并更新源及系统

$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu jessiemain" > /etc/apt/sources.list.d/ros-latest.list'
$ wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get upgrade

安装必要的依赖项

$ sudo apt-get install python-pip python-setuptools python-yaml python-distribute python-docutils python-dateutil python-six
$ sudo pip install rosdep rosinstall_generator wstool rosinstall

配置rosdep

$ sudo rosdep init
$ rosdep update

Fetch源代码

新建一个catkin workspace用来编译安装文件

$ mkdir ~/ros_catkin_ws
$ cd ~/ros_catkin_ws

将源代码fetch到该目录。Destop有完整的ROS功能,适合所有机器人应用(花费时间较长)

rosinstall_generator desktop --rosdistro indigo --deps --wet-only --exclude roslisp --tar > indigo-desktop-wet.rosinstall
wstool init src src indigo-desktop-wet.rosinstall

若中途下载中断,以下命令可以接着下载

wstool update -t src

 

安装Raspbian jessie安装如下五个依赖项:

$ mkdir ~/ros_catkin_ws/external_src
$ sudo apt-get install checkinstall cmake
$ sudo sh -c 'echo "deb-src http://mirrordirector.raspbian.org/raspbian/ testing main contrib non-free rpi" >> /etc/apt/sources.list'
$ sudo apt-get update

libconsole-bridge-dev:

$ cd ~/ros_catkin_ws/external_src
$ sudo apt-get build-dep console-bridge
$ apt-get source -b console-bridge
$ sudo dpkg -i libconsole-bridge0.2*.deb libconsole-bridge-dev_*.deb

liblz4-dev(花费时间较长,请耐心等待):

$ cd ~/ros_catkin_ws/external_src
$ apt-get source -b lz4
$ sudo dpkg -i liblz4-*.deb

liburdffdom-headers-dev

$ cd ~/ros_catkin_ws/external_src
$ git clone https://github.com/ros/urdfdom_headers.git
$ cd urdfdom_headers
$ git reset --hard 9aed725
$ cmake .
$ sudo checkinstall make install
其中有:
When check-install asks for any changes, the name (2) needs to change from "urdfdom-headers" to "liburdfdom-headers-dev"
otherwise the rosdep install wont find it.

liburdfdom-dev

$ cd ~/ros_catkin_ws/external_src
$ sudo apt-get install libboost-test-dev libtinyxml-dev
$ git clone https://github.com/ros/urdfdom.git
$ cd urdfdom
$ cmake .
$ sudo checkinstall make install
其中有:
When check-install asks for any changes, the name (2) needs to change from "urdfdom" to "liburdfdom-dev"
otherwise the rosdep install wont find it.

collada-dom-dev

$ cd ~/ros_catkin_ws/external_src
$ sudo apt-get install libboost-filesystem-dev libxml2-dev
$ wget http://downloads.sourceforge.net/project/collada-dom/Collada%20DOM/Collada%20DOM%202.4/collada-dom-2.4.0.tgz
$ tar -xzf collada-dom-2.4.0.tgz
$ cd collada-dom-2.4.0
$ cmake .
$ sudo checkinstall make install
其中有:
When check-install asks for any changes, the name (2) needs to change from "collada-dom" to "collada-dom-dev"
otherwise the rosdep install wont find it.

 

使用rosdep解决其他依赖问题:

$ cd ~/ros_catkin_ws
$ rosdep install --from-paths src --ignore-src --rosdistro indigo -y -r --os=debian:jessie
其中含义如下:

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 rosdep will finish installing system dependencies and you can continue.

建立工作空间:

ros_catkin_ws$ sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo
出现如下错误:
CMake Error at CMakeLists.txt:6 (find_package):
  By not providing "FindEigen3.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Eigen3", but
  CMake did not find one.

  Could not find a package configuration file provided by "Eigen3" with any
  of the following names:

    Eigen3Config.cmake
    eigen3-config.cmake


编译完成后,indigo就安装好了,安装位置在/opt/ros/indigo。然后对源处理一下:

$ source /opt/ros/indigo/setup.bash

ROS indigo就安装成功!

 

posted @ 2017-07-30 17:54  andyalgorithm  阅读(785)  评论(0编辑  收藏  举报