1. 程式人生 > >在Raspberry上安裝ROS

在Raspberry上安裝ROS

class 編譯安裝 utils ont sting tin upd dpkg echo

官方安裝教程地址:

http://wiki.ros.org/ROS/Installation

中文安裝教程

http://lib.csdn.net/article/embeddeddevelopment/30200

樹莓派操作系統為Raspbian,安裝的ROS版本為indigo

首先在源中添加ROS Repositories,並更新源及系統

$ sudo sh -c echo "deb http://packages.ros.org/ros/ubuntu wheezy main" > /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-setuptools python-pip python-yaml python-argparse python-distribute python-docutils python-dateutil python-setuptools 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到該目錄。ROS-Comm時其僅包含一些基礎的軟件,沒有圖形化工具;Destop有完整的ROS功能,適合所有機器人應用。我選擇安裝這個。

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

若中途下載中斷,以下命令會接著下載

wstool update -j 4 -t src

安裝Raspbian倉庫中沒有的一些包

$ 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

使用rosdep解決其他依賴問題:

$ cd ~/ros_catkin_ws
$ rosdep install --from-paths src --ignore-src --rosdistro indigo -y -r --os=debian:wheezy

編譯:

$ sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo

編譯完成後,indigo就安裝好了,安裝位置在/opt/ros/indigo。然後對源處理一下:

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

嘗試運行一下resource命令,若運行正常,則ROS indigo就安裝成功!

在Raspberry上安裝ROS