ROS机器人程序设计(原书第2版)补充资料 教案1 ROS Kinetic系统入门
ROS Kinetic在Ubuntu 16.04.01 安装可参考:http://blog.csdn.net/zhangrelay/article/details/51364622
ROS版本特色和官网wiki可参考:http://blog.csdn.net/zhangrelay/article/details/51371427
ROS入门指南可参考:http://blog.csdn.net/zhangrelay/article/details/51381589
课件正文字体为白色,代码和命令为黄色,右下角数字表示对应中文译著(第2版)页码。
第一章课件下载地址:http://download.csdn.net/detail/zhangrelay/9738564
此indigo版本停止更新,稍后会补充kinetic版本教案和演示幻灯片!
课程为双语课程,配套用书为英文版和中文版,但教案与课件均为英中文混合,并补充全部ROS官网资料供课后阅读与学习。
在开始本课程的学习之前,需要掌握机器人学的基本知识和Ubuntu的使用等。
如果想成为机器人工程师,请阅读知乎专栏:机器人工程师学习计划,5星推荐。
https://zhuanlan.zhihu.com/p/22266788
机器人学的基本知识,可参考课件,Ubuntu使用可参考学习体会。网上资源多多,要善于发现,认真学习。
为什么要学习ROS?ROS有哪些功能?如何学习?请参考快速了解ROS。
ROS 8 Year Montage:http://v.youku.com/v_show/id_XMTg2NjIwMDEwNA
有兴趣看上述youku视频短片,都是使用ROS设计研发的。
教案1 ROS Indigo系统入门
教学目的:掌握ROS Indigo的安装与配置
教学重点:Ubuntu软件源设置与更新,功能包安装等
教学难点:ROS环境配置
教学方法:课堂教学,示例演示
课外作业:安装Ubuntu 14.04 + ROS Indigo
学时分配:2学时
教学内容:详细讲解 ROS Indigo PC安装过程,介绍ROS在虚拟机以及嵌入式系统的安装资料。
具体如下:
1 Getting Started with ROS Indigo
Welcome to the first chapter of this book where you will learn how to install ROS, the new standard software framework in robotics. This book is an update on Learning ROS for Robotics Programming, based in ROS Fuerte. With ROS you will learn how to program and control your robots the easy way, using tons of examples and source code that will show you how to use sensors, devices, or add new functionalities such as autonomous navigation, visual perception, and so on to your robot. Thanks to the open source motto and a community that is developing state-of-the-art algorithms and providing new functionalities, ROS is growing every day.
Throughout this book, you will learn the following:
• Installing ROS Indigo framework on a version of Ubuntu
• The basic operation of ROS
• Debugging and visualizing data
• Programming your robot using this framework
• Connecting sensors, actuators, and devices to create your robot
• Creating a 3D model to use in the simulator
• Using the navigation stack to make your robot autonomous
In this chapter, we are going to install a full version of ROS Indigo in Ubuntu. ROS is fully supported and recommended for Ubuntu, and it is experimental for other operative systems. The version used in this book is the 14.04 (Trusty Tahr) and you can download it for free from http://releases.ubuntu.com/14.04/.
You can find a lot of such examples at: http://wiki.ros.org/Robots.
Now we are going to show you how to install ROS Indigo. Although in this book we use Indigo, you may need to install older versions to use some code that works only with these versions.
As we said before, the operating system used in the book is Ubuntu, and we are going to use it throughout this book and with all the tutorials. If you use another operating system and you want to follow the book, the best option is to install a virtual machine with a copy of Ubuntu. At the end of this chapter, we will explain how to install a virtual machine to use the ROS inside it or download a virtual machine with ROS installed.
Anyway, if you want to try installing it in an operating system other than Ubuntu, you can find instructions to do so in many other operating systems at http://wiki.ros.org/cn/indigo/Installation.
ROS Indigo 安装指南
这是最新发行版本ROS Indigo Igloo的安装指南,要安装前一版本ROS Hydro请阅读Hydro 安装指南。
下面是ROS在各种操作系统和特定机器人平台上的安装说明。
选择操作系统平台稳定:
测试:
非官方安装选项
| 或者选择机器人平台浏览ROS所支持的各种机器人平台: Robots |
PC installation (需要重点掌握)
We assume that you have a PC with a copy of Ubuntu 14.04. We are using Ubuntu because it comes with a Long-Term Support (LTS). That means the community will maintain this version for five years.
Furthermore, it is necessary to have a basic knowledge of Linux and command tools such as the terminal, vim, creating folders, and so on. If you need to learn these tools, you can find a lot of relevant resources on the Internet, or you can find books on these topics instead.
在Ubuntu中安装ROS Indigo
我们已经预编译好ubuntu平台的Debian软件包,直接安装编译好的软件包比从源码编译安装更加高效,这也是我们在ubuntu上的首选安装方式。
如果你需要从源码编译安装(不推荐),请阅读从源码安装方法(下载和编译)。
安装
配置 Ubuntu 软件仓库
配置你的 Ubuntu 软件仓库(repositories) 以允许 "restricted"、"universe" 和 "multiverse"这三种安装模式。 你可以 按照ubuntu中的配置指南来完成配置。
添加 sources.list
配置你的电脑使其能够安装来自 packages.ros.org的软件。 ROS Indigo 仅 支持 Saucy (13.10) 和 Trusty (14.04)。
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
镜像 | 注:强烈建议使用国内或者新加坡的镜像源,这样能够大大提高安装下载速度。 |
To use a mirror, simply run one of the commands below when setting up your sources.list file.
Note: the entire command sequence should be copy/pasted as a single line in the terminal.
USTC (China)
Administrator: USTC LUG
URL: http://mirrors.ustc.edu.cn/ros/
Command:
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
Sun Yat-Sen University (China)
Administrator: FangPeishi
URL: http://mirror.sysu.edu.cn/ros/
Command:
sudo sh -c '. /etc/lsb-release && echo "deb http://mirror.sysu.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
ExBot Robotics Lab (China)
Administrator: poyoten
URL: http://ros.exbot.net/rospackage/ros/
Command:
sudo sh -c '. /etc/lsb-release && echo "deb http://ros.exbot.net/rospackage/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
添加 keys
sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
安装
首先,确保你的Debian软件包索引是最新的:
sudo apt-get update
如果你用的是Ubuntu Trusty 14.04.2并在安装ROS的时候遇到依赖问题,你可能还得安装一些其它系统依赖。
如果你使用的是ubuntu 14.04,请不要安装以下软件,否则会导致你的X server无法正常工作:
sudo apt-get install xserver-xorg-dev-lts-utopic mesa-common-dev-lts-utopic libxatracker-dev-lts-utopic libopenvg1-mesa-dev-lts-utopic libgles2-mesa-dev-lts-utopic libgles1-mesa-dev-lts-utopic libgl1-mesa-dev-lts-utopic libgbm-dev-lts-utopic libegl1-mesa-dev-lts-utopic
如果你使用的是ubuntu 14.04,请不要安装以上软件,否则会导致你的X server无法正常工作
或者尝试 只 安装下面这个工具来修复依赖问题:
sudo apt-get install libgl1-mesa-dev-lts-utopic
关于这个问题的更多信息请查看这个 answers.ros.org 提问 或者这个 launchpad 问题
ROS中有很多各种函数库和工具,我们为你提供了四种默认安装方式,你也可以单独安装某个指定软件包。
桌面完整版安装:(推荐) 包含ROS、rqt、rviz、通用机器人函数库、2D/3D仿真器、导航以及2D/3D感知功能。
在Trusty中Indigo默认搭配使用Gazebo 2,如果你需要升级到Gazebo 3,请查看这些操作说明 关于如何升级Gazebo仿真器。
sudo apt-get install ros-indigo-desktop-full
或者 点击这里
桌面版安装: 包含ROS、rqt、rviz以及通用机器人函数库。
sudo apt-get install ros-indigo-desktop
或者 点击这里
基础版安装: 包含ROS核心软件包、构建工具以及通信相关的程序库,无GUI工具。
sudo apt-get install ros-indigo-ros-base
或者 点击这里
单个软件包安装: 你也可以安装某个指定的ROS软件包(使用软件包名称替换掉下面的PACKAGE):
sudo apt-get install ros-indigo-PACKAGE
例如:sudo apt-get install ros-indigo-slam-gmapping
要查找可用软件包,请运行:
apt-cache search ros-indigo
初始化 rosdep
在开始使用ROS之前你还需要初始化rosdep。rosdep可以方便在你需要编译某些源码的时候为其安装一些系统依赖,同时也是某些ROS核心功能组件所必需用到的工具。
sudo rosdep init rosdep update
环境设置
如果每次打开一个新的终端时ROS环境变量都能够自动配置好(即添加到bash会话中),那将会方便得多:
echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc source ~/.bashrc
如果你安装有多个ROS版本, ~/.bashrc 必须只能 source 你当前使用版本所对应的 setup.bash。
如果你只想改变当前终端下的环境变量,你可以执行命令:
source /opt/ros/indigo/setup.bash
安装 rosinstall
rosinstall 是ROS中一个独立分开的常用命令行工具,它可以方便让你通过一条命令就可以给某个ROS软件包下载很多源码树。
要在ubuntu上安装这个工具,请运行:
sudo apt-get install python-rosinstall
Build farm 状态
你所安装的各种软件包都是通过ROS build farm来编译构建的。你可以在这里查看各种独立软件包的编译状态。
这里重点如下:
1 Configuring your Ubuntu repositories
2 Setting up your source.list file
3 Setting up your keys
4 Installing ROS
5 Initializing rosdep
6 Setting up the environment
7 Getting rosinstall
理解并掌握各步骤的作用和要点。
如何简化简化indigo的安装流程呢?
Usage of single-line install script ros_install.sh
wget https://raw.githubusercontent.com/oroca/oroca-ros-pkg/master/ros_install.sh && ./ros_install.sh %NAME_CATKIN_WS% %NAME_ROS_DISTRO_LOWERCASE%(e.g.)
wget https://raw.githubusercontent.com/oroca/oroca-ros-pkg/master/ros_install.sh && chmod 755 ./ros_install.sh && ./ros_install.sh catkin_ws_oroca indigo
ros_install.sh如下:
#!/bin/bash
# The BSD License
# Copyright (c) 2014 OROCA and ROS Korea Users Groupset -xfunction usage {# Print out usage of this script.echo >&2 "usage: $0 [catkin workspace name (default:catkin_ws)] [ROS distro (default: indigo)"echo >&2 " [-h|--help] Print help message."exit 0
}
# Parse command line. If the number of argument differs from what is expected, call `usage` function.
OPT=`getopt -o h -l help -- $*`
if [ $# != 2 ]; thenusage
fi
eval set -- $OPT
while [ -n "$1" ] ; docase $1 in-h|--help) usage ;;--) shift; break;;*) echo "Unknown option($1)"; usage;;esac
donename_catkinws=$1
name_catkinws=${name_catkinws:="catkin_ws"}
name_ros_distro=$2
name_ros_distro=${name_ros_distro:="indigo"}version=`lsb_release -sc`echo "[Checking the ubuntu version]"
case $version in"saucy" | "trusty" | "vivid" | "wily" | "xenial");;*)echo "ERROR: This script will only work on Ubuntu Saucy(13.10) / Trusty(14.04) / Vivid / Wily / Xenial. Exit."exit 0
esacecho "[Update & upgrade the package]"
sudo apt-get update -qq
sudo apt-get upgrade -qqecho "[Check the 14.04.2 TLS issue]"
relesenum=`grep DISTRIB_DESCRIPTION /etc/*-release | awk -F 'Ubuntu ' '{print $2}' | awk -F ' LTS' '{print $1}'`
if [ "$relesenum" = "14.04.2" ]
thenecho "Your ubuntu version is $relesenum"echo "Intstall the libgl1-mesa-dev-lts-utopic package to solve the dependency issues for the ROS installation specifically on $relesenum"sudo apt-get install -y libgl1-mesa-dev-lts-utopic
elseecho "Your ubuntu version is $relesenum"
fiecho "[Installing chrony and setting the ntpdate]"
sudo apt-get install -y chrony
sudo ntpdate ntp.ubuntu.comecho "[Add the ROS repository]"
if [ ! -e /etc/apt/sources.list.d/ros-latest.list ]; thensudo sh -c "echo \"deb http://packages.ros.org/ros/ubuntu ${version} main\" > /etc/apt/sources.list.d/ros-latest.list"
fiecho "[Download the ROS keys]"
roskey=`apt-key list | grep "ROS builder"`
if [ -z "$roskey" ]; thenwget --quiet https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -
fiecho "[Update & upgrade the package]"
sudo apt-get update -qq
sudo apt-get upgrade -qqecho "[Installing ROS]"
sudo apt-get install -y ros-$name_ros_distro-desktop-full ros-$name_ros_distro-rqt-*echo "[rosdep init and python-rosinstall]"
sudo sh -c "rosdep init"
rosdep update
. /opt/ros/$name_ros_distro/setup.sh
sudo apt-get install -y python-rosinstallecho "[Making the catkin workspace and testing the catkin_make]"
mkdir -p ~/$name_catkinws/src
cd ~/$name_catkinws/src
catkin_init_workspace
cd ~/$name_catkinws/
catkin_makeecho "[Setting the ROS evironment]"
sh -c "echo \"source /opt/ros/$name_ros_distro/setup.bash\" >> ~/.bashrc"
sh -c "echo \"source ~/$name_catkinws/devel/setup.bash\" >> ~/.bashrc"
sh -c "echo \"export ROS_MASTER_URI=http://localhost:11311\" >> ~/.bashrc"
sh -c "echo \"export ROS_HOSTNAME=localhost\" >> ~/.bashrc"echo "[Complete!!!]"exec bashexit 0
How to install VirtualBox and Ubuntu
说明和下载地址如下:http://nootrix.com/software/ros-indigo-virtual-machine/
Bit torrents for virtual machines with ROS Indigo Igloo:
- Fastest option: rosIndigo32Bits.torrent. If you are stuck behind a firewall, you can download the VM from here (slow)
- Fastest option: rosIndigo64Bits.torrent. If you are stuck behind a firewall, you can download the VM from here (slow)
Two VMs are available one with Ubuntu 32Bits and the other with Ubuntu 64Bits. Read the related post about their characteristics before downloading .torrent files.
如有兴趣请自学。
Installing ROS Indigo in BeagleBone Black (BBB)
以自学为主,了解即可。
本课小节:
Summary :
In this chapter, we have installed ROS Indigo on different devices (PC, VirtualBox, and BeagleBone Black) in Ubuntu. With these steps, you have everything necessary installed on your system to start working with ROS and you can also practice the examples in this book. You also have the option of installing ROS using the source code. This option is for advanced users and we recommend you use only the repository as installation as it is more common and normally does not give errors or problems.
It is a good idea to play around with ROS and its installation on a virtual machine. That way, if you have problems with the installation or with something else, you can reinstall a new copy of your operating system and start again.
Normally, with virtual machines, you will not have access to real hardware, for example, sensors or actuators. Anyway, you can use it for testing the algorithms.
课件资料稍后补充。
ROS机器人程序设计(indigo)课件0:http://download.csdn.net/detail/zhangrelay/9716684
以只读模式查看即可。
补充自学资料:
Ubuntu ARM install of ROS Indigo
There are currently builds of ROS for Ubuntu Trusty armhf. These builds include most but not all packages, and save a considerable amount of time compared to doing a full source-based installation.
Supported/Tested Platforms
If this install works for your platform, please list it here:
Snapdragon Flight (Qualcomm Snapdragon 801 Processor)
Inforce IFC6410 (Qualcomm Snapdragon 600 Processor)
eInfochips Eragon600 (Qualcomm Snapdragon 600 Processor)
Nvidia Jetson TK1
- Odroid C1, X, U2, U3, XU3 (Ubuntu 14.04) and XU4 (Ubuntu 14.04)
SolidRun CuBox-i Pro with Ubuntu 14.04 LTS (tested; works)
BeagleBone Black (Ubuntu 14.04)
Parallella http://www.parallella.org (note default shell is not bash)
RadxaRock http://radxa.com/ (Ubuntu 14.04)
- Pandaboard ES (Ubuntu 14.04)
Gumstix Overo Fire with Ubuntu Core 14.04 rootfs
Wandboard Quad (with Robert Nelson's kernel and Ubuntu 14.04) http://wandboard.org
Raspberry Pi 2 (with Ubuntu 14.04 2015-03-02 https://wiki.ubuntu.com/ARM/RaspberryPi)
Google Nexus 5 (with Ubuntu Touch)
DJI Manifold https://developer.dji.com/manifold/ (Ubuntu 14.04)
eInfochips Eragon 410 (Qualcomm Snapdragon 410 Processor)
Dragonboard 410c (Qualcomm Snapdragon 410 Processor)
Orange Pi 2 and probably other Orange Pi's
Installation
Configure your Ubuntu repositories
Configure your Ubuntu repositories to allow "restricted," "universe," and "multiverse." You can follow the Ubuntu guide for instructions on doing this.
Set your Locale
Boost and some of the ROS tools require that the system locale be set. You can set it with:
sudo update-locale LANG=C LANGUAGE=C LC_ALL=C LC_MESSAGES=POSIX
If there is a problem. Then try (other languages could be added):
$ export LANGUAGE=en_US.UTF-8 $ export LANG=en_US.UTF-8 $ export LC_ALL=en_US.UTF-8 $ locale-gen en_US.UTF-8 $ dpkg-reconfigure locales
Setup your sources.list
Setup your computer to accept software from the ARM mirror on packages.ros.org.
Due to limited resources, there are only active builds for Trusty armhf (14.04), since this is the stable, long-term Ubuntu release and is the most-requested distribution in conjunction with ROS Indigo.
Ubuntu 14.04 (Trusty armhf)
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list'
Set up your keys
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
You can try the following command by adding :80 if you have gpg: keyserver timed out error due to a firewall
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
Installation
First, make sure your Debian package index is up-to-date:
sudo apt-get update
There are many different libraries and tools in ROS - not all compile fully on ARM. You can also install ROS packages individually.
ROS-Base: (Bare Bones) ROS package, build, and communication libraries. No GUI tools.
sudo apt-get install ros-indigo-ros-base
Desktop Install: ROS, rqt, rviz, and robot-generic libraries
sudo apt-get install ros-indigo-desktop
Add Individual Packages
- You can install a specific ROS package (replace underscores with dashes of the package name):
sudo apt-get install ros-indigo-PACKAGE
- e.g.
sudo apt-get install ros-indigo-navigation
To find available packages, use:
apt-cache search ros-indigo
The Ubuntu ARM package status is available here
Install Sizes
Base Package | robot variant | desktop variant |
407 MB | 572 MB | ~1GB |
Initialize rosdep
Before you can use ROS, you will need to install and initialize rosdep. rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS.
sudo apt-get install python-rosdep sudo rosdep init rosdep update
Environment setup
It's convenient if the ROS environment variables are automatically added to your bash session every time a new shell is launched:
echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc source ~/.bashrc
If you have more than one ROS distribution installed, ~/.bashrc must only source the setup.bash for the version you are currently using.
If you just want to change the environment of your current shell, you can type:
source /opt/ros/indigo/setup.bash
If you use zsh instead of bash you need to run the following commands to set up your shell:
echo "source /opt/ros/indigo/setup.zsh" >> ~/.zshrc source ~/.zshrc
Getting rosinstall
rosinstall is a frequently used command-line tool in ROS that is distributed separately. It enables you to easily download many source trees for ROS packages with one command.
To install this tool on Ubuntu, run:
sudo apt-get install python-rosinstall
Verifying OS name
Make sure your OS name defined at /etc/lsb-release is as the following. Since ros does not recognize Linaro as an OS, this is necessary. The following is for Ubuntu 14.04, trusty. Modify the release number and name as per your target.
DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 DISTRIB_CODENAME=trusty DISTRIB_DESCRIPTION="Ubuntu 14.04"
Build farm status
The packages that you installed were built by ROS build farm. You can check the status of individual packages here.
Tutorials
Now, to test your installation, please proceed to the ROS Tutorials.
Obtain source code of the installed packages
If you know the location of the repository of each package, you know you can obtain all the code there. But it's often hard even for experienced developers to reach the correct maintained repository of certain packages. Also, in some situations you just want to get the source of the released, installed version of a package. The methods described here the best for these cases.
In earlier days of ROS (supposedly electric or earlier) you can obtain by the way noted in this question.
Now just apt-get source (sudo not needed) as following. You don't even need to explicitly specify deb-src entry etc. This downloads from the server all the files in the released version of the package (i.e. things not installed in the installation rule (e.g. CMakeLists.txt) are also included).
$ apt-get source ros-hydro-laser-pipeline
Drawback might be that you have to specifify a single, exact package name (asterisk doesn't work).
Using RVIZ
It is not recommended to run rviz on most ARM-based CPUs. They're generally too slow, and the version of OpenGL that is provided by the software (mesa) libraries it not new enough to start rviz.
'IF' you have a powerful board with a GPU and vendor-supplied OpenGL libraries, it might be possible to run rviz. The IFC6410 and the NVidia Jetson TK1 are two such boards where rviz will run, although neither is fast enough for graphics-heavy tasks such as displaying pointclouds.
Note that rviz will segfault if you have the GTK_IM_MODULE environment variable set, so it's best to unset it in your ~/.bashrc:
unset GTK_IM_MODULE
Installation Instructions for Indigo in OSX
This page describes how to install Indigo in OSX. OSX is not officially supported by ROS and the installation might fail for several reasons.
Setup
Homebrew
First, go to http://brew.sh to install homebrew.
Next use homebrew to install additional software.
$ brew update $ brew install cmake
And also add our ROS Indigo tap and the Homebrew science tap so you can get some non-standard formulae:
$ brew tap ros/deps $ brew tap osrf/simulation # Gazebo, sdformat, and ogre $ brew tap homebrew/versions # VTK5 $ brew tap homebrew/science # others
Note: if you are upgrading from previous ROS distro try:
$ brew untap ros/DISTRO
Note: It is recommended to use the system python rather than homebrewed python because of problems with segmentation faults. http://answers.ros.org/question/108431/import-tf-segfaults-python-on-os-x-109-with-brewed-python/
Setup Environment
You will need to add these line to your ~/.bashrc or ~/.bash_profile to have Homebrew be at the front of the PATH.
export PATH=/usr/local/bin:$PATH
In order for the above changes to take effect reopen the terminal or run this command:
$ source ~/.bashrc
Setup Environment for Python
You also need to tell python about modules installed by homebrew. The recommended way of doing this are the following commands:
$ mkdir -p ~/Library/Python/2.7/lib/python/site-packages $ echo "$(brew --prefix)/lib/python2.7/site-packages" >> ~/Library/Python/2.7/lib/python/site-packages/homebrew.pth
-
Note: Earlier versions of homebrew required you to additionally add /usr/local/share/python to your PATH, so the added line in your .bashrc might look like this:
export PATH=/usr/local/bin:/usr/local/share/python:$PATH
This is no longer needed.
-
Note: Previously, it was suggested to set PYTHONPATH as such:
export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"
This is problematic, because PYTHONPATH does not distinguish between different python version. The recommended way is creating a .pth file in the user site-packages as outlined above.
Additional Tools
Finally, we need to install a few ROS python tools using pip.
If you don't already have pip install it with:
$ sudo easy_install pip
On OS 10.9 (Mavericks) If pip is installed, check the version installed. If it is not 1.2.1, you will have to delete pip manually and install pip 1.2.1 after deleting:
$ pip --version $ sudo easy_install pip==1.2.1
On OS 10.9 (Mavericks) you might need to install a new version of setuptools before you can install rosinstall_generator:
$ sudo -H pip install -U setuptools
Install the following packages using pip:
$ sudo -H pip install -U wstool rosdep rosinstall rosinstall_generator rospkg catkin-pkg Distribute sphinx
In order to use rosdep, we need to initialize it:
$ 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, rqt, rviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception
$ rosinstall_generator desktop_full --rosdistro indigo --deps --wet-only --tar > indigo-desktop-full-wet.rosinstall $ wstool init -j8 src indigo-desktop-full-wet.rosinstall
Desktop Install (recommended): ROS, rqt, rviz, and robot-generic libraries
$ rosinstall_generator desktop --rosdistro indigo --deps --wet-only --tar > indigo-desktop-wet.rosinstall $ wstool init -j8 src indigo-desktop-wet.rosinstall
ROS-Comm: (Bare Bones) ROS package, build, and communication libraries. No GUI tools.
$ rosinstall_generator ros_comm --rosdistro indigo --deps --wet-only --tar > indigo-ros_comm-wet.rosinstall $ wstool init -j8 src indigo-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 -j8 option downloads 8 packages in parallel.
In addition to the 3 variants above, more are defined in REP 131 such as robot, perception, etc. Just change the package path to the one you want, e.g., for robot do:
$ rosinstall_generator robot --rosdistro indigo --deps --wet-only --tar > indigo-robot-wet.rosinstall $ wstool init -j8 src indigo-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 the rosdep tool for this:
$ rosdep install --from-paths src --ignore-src --rosdistro indigo -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 -yoption 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.
If you installed something from source or from pip and don't want rosdep to try to install it for you use the --skip-keys option. For example if you installed the bootstrap tools such as rosdep, rospkg, and rosinstall_generator from source add the arguments --skip-keys python-rosdep --skip-keys python-rospkg --skip-keys python-catkin-pkg
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/indigo argument to your catkin_make_isolated call.
For usage on a robot without Ubuntu, it is recommended to install compiled code into /opt/ros/indigo 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. Let's 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
Troubleshooting
If you run into problems look here.
Also, some old errors can be found here:
empy fails
Download the package directly from the author: http://www.alcyone.com/software/empy/empy-latest.tar.gz and install manually:
sudo pip uninstall empy tar xzf empy-latest.tar.gz cd empy-3.3 sudo python setup.py install
tf2 fails
TF2 is not necessary to build ROS. The easiest way to fix this is to delete the tf2 folders.
$ rm -rf src/tf2*
pydot fails to install
See:
PyQWT fails to install from brew
When running rosdep on your variant if it tries to install pyqwt and fails with:
executing command [brew install pyqwt] ==> Downloading http://sourceforge.net/projects/pyqwt/files/pyqwt5/PyQwt-5.2.0/PyQwt-5.2.0.tar.gz Already downloaded: /Library/Caches/Homebrew/pyqwt-5.2.0.tar.gz ==> Patching patching file configure/configure.py ==> python configure.py --module-install-path=/usr/local/Cellar/pyqwt/5.2.0/lib/python2.7/site-packages/PyQt4/Qwt5 --sip-install-path=/usr/local/Cellar/pyqwt/5.2.0/share/sip/Qwt5 --uic-install-path=/u 'timelines': [], 'trace': '', 'uic_install_path': '/usr/local/Cellar/pyqwt/5.2.0/lib/python2.7/site-packages/PyQt4'} Requires at least PyQt-4.2 and its development tools. READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting ERROR: the following rosdeps failed to install homebrew: command [brew install pyqwt] failed
Then you need to make sure your PYTHONPATH has the homebrew path added to it (see here. This is part of the instructions above and can be seen as a caveat of pyqt (brew info pyqt).
pcl build problems
Resolving the problems with building PCL 1.6 on OS X is on going. When building the desktop variant, PCL is included but not explicitly required. Therefore the easiest method to get around the PCL build problems is to remove it from the workspace:
$ rm -rf src/pcl_msgs $ rm -rf src/pcl $ rm -rf src/pcl_ros
camera_calibration_parsers build problems
When building camera_calibration_parsers you might get:
==> Processing catkin package: 'camera_calibration_parsers' ==> Building with env: '/opt/ros/hydro/env_cached.sh' Makefile exists, skipping explicit cmake invocation... ==> make cmake_check_build_system in '/Users/bcharrow/ros_catkin_ws/build_isolated/camera_calibration_parsers' ==> make -j2 in '/Users/bcharrow/ros_catkin_ws/build_isolated/camera_calibration_parsers' [ 25%] Building CXX object CMakeFiles/camera_calibration_parsers.dir/src/parse_yml.cpp.o /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp: In function ‘void camera_calibration_parsers::operator>>(const YAML::Node&, camera_calibration_parsers::SimpleMatrix&)’: /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:53: error: no match for ‘operator>>’ in ‘YAML::Node::operator[](const Key&) const [with Key = char [5]](((const char (&)[5])"rows")) >> rows’ /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:50: note: candidates are: void camera_calibration_parsers::operator>>(const YAML::Node&, camera_calibration_parsers::SimpleMatrix&) /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:55: error: no match for ‘operator>>’ in ‘YAML::Node::operator[](const Key&) const [with Key = char [5]](((const char (&)[5])"cols")) >> cols’ /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:50: note: candidates are: void camera_calibration_parsers::operator>>(const YAML::Node&, camera_calibration_parsers::SimpleMatrix&) /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:59: error: no match for ‘operator>>’ in ‘YAML::Node::operator[](const Key&) const [with Key = int](((const int&)((const int*)(& i)))) >> *(m->camera_calibration_parsers::SimpleMatrix::data + ((double*)(((long unsigned int)i) * 8ul)))’ /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:50: note: candidates are: void camera_calibration_parsers::operator>>(const YAML::Node&, camera_calibration_parsers::SimpleMatrix&) /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp: In function ‘bool camera_calibration_parsers::readCalibrationYml(std::istream&, std::string&, sensor_msgs::CameraInfo&)’: /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:119: error: ‘class YAML::Parser’ has no member named ‘GetNextDocument’ /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:121: error: ‘class YAML::Node’ has no member named ‘FindValue’ /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:122: error: no match for ‘operator>>’ in ‘* name_node >> camera_name’ /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:50: note: candidates are: void camera_calibration_parsers::operator>>(const YAML::Node&, camera_calibration_parsers::SimpleMatrix&) /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:126: error: no match for ‘operator>>’ in ‘YAML::Node::operator[](const Key&) [with Key = char [12]](((const char (&)[12])(& camera_calibration_parsers::WIDTH_YML_NAME))) >> cam_info->sensor_msgs::CameraInfo_<std::allocator<void> >::width’ /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:50: note: candidates are: void camera_calibration_parsers::operator>>(const YAML::Node&, camera_calibration_parsers::SimpleMatrix&) /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:127: error: no match for ‘operator>>’ in ‘YAML::Node::operator[](const Key&) [with Key = char [13]](((const char (&)[13])(& camera_calibration_parsers::HEIGHT_YML_NAME))) >> cam_info->sensor_msgs::CameraInfo_<std::allocator<void> >::height’ /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:50: note: candidates are: void camera_calibration_parsers::operator>>(const YAML::Node&, camera_calibration_parsers::SimpleMatrix&) /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:138: error: ‘class YAML::Node’ has no member named ‘FindValue’ /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:139: error: no match for ‘operator>>’ in ‘* model_node >> cam_info->sensor_msgs::CameraInfo_<std::allocator<void> >::distortion_model’ /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:50: note: candidates are: void camera_calibration_parsers::operator>>(const YAML::Node&, camera_calibration_parsers::SimpleMatrix&) /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:148: error: no match for ‘operator>>’ in ‘YAML::Node::operator[](const Key&) const [with Key = char [5]](((const char (&)[5])"rows")) >> D_rows’ /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:50: note: candidates are: void camera_calibration_parsers::operator>>(const YAML::Node&, camera_calibration_parsers::SimpleMatrix&) /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:149: error: no match for ‘operator>>’ in ‘YAML::Node::operator[](const Key&) const [with Key = char [5]](((const char (&)[5])"cols")) >> D_cols’ /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:50: note: candidates are: void camera_calibration_parsers::operator>>(const YAML::Node&, camera_calibration_parsers::SimpleMatrix&) /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:153: error: no match for ‘operator>>’ in ‘YAML::Node::operator[](const Key&) const [with Key = int](((const int&)((const int*)(& i)))) >> cam_info->sensor_msgs::CameraInfo_<std::allocator<void> >::D. std::vector<_Tp, _Alloc>::operator[] [with _Tp = double, _Alloc = std::allocator<double>](((long unsigned int)i))’ /Users/bcharrow/ros_catkin_ws/src/camera_calibration_parsers/src/parse_yml.cpp:50: note: candidates are: void camera_calibration_parsers::operator>>(const YAML::Node&, camera_calibration_parsers::SimpleMatrix&) make[2]: *** [CMakeFiles/camera_calibration_parsers.dir/src/parse_yml.cpp.o] Error 1 make[1]: *** [CMakeFiles/camera_calibration_parsers.dir/all] Error 2 make: *** [all] Error 2 <== Failed to process package 'camera_calibration_parsers': Command '/opt/ros/hydro/env_cached.sh make -j2' returned non-zero exit status 2 Command failed, exiting.
As of January 1, 2013, homebrew's version of yaml-cpp was upgraded to 0.5.0 which uses a different API than camera_calibration_parsers requires.
This is the old solution:
To fix, revert yaml-cpp to 0.3.0:
$ cd /usr/local/Cellar $ brew uninstall yaml-cpp $ brew versions yaml-cpp 0.5.0 git checkout 78b895b /usr/local/Library/Formula/yaml-cpp.rb 0.3.0 git checkout 6e32f8c /usr/local/Library/Formula/yaml-cpp.rb 0.2.5 git checkout ebe6663 /usr/local/Library/Formula/yaml-cpp.rb $ git checkout 6e32f8c /usr/local/Library/Formula/yaml-cpp.rb $ brew install yaml-cpp
And updated the rosdep entry so that it will install yaml-cpp-0.3 rather than yaml-cpp from the upstream Homebrew repository.
The only problem with this approach is that if yaml-cpp 0.5.0 is already installed from brew, 0.3 will fail to link properly, in that event:
$ brew uninstall yaml-cpp yaml-cpp-0.3 $ brew install yaml-cpp-0.3
cv_bridge fails to link
If you get an error like
Linking CXX shared library /Users/tatsch/ros_catkin_ws/devel_isolated/cv_bridge/lib/libcv_bridge.dylib ld: warning: directory not found for option '-L/Users/tatsch/ros_catkin_ws/install_isolated/share/OpenCV/3rdparty/lib' [ 50%] Built target cv_bridge Linking CXX shared library /Users/tatsch/ros_catkin_ws/devel_isolated/cv_bridge/lib/python2.7/site-packages/cv_bridge/boost/cv_bridge_boost.dylib ld: warning: directory not found for option '-L/Users/tatsch/ros_catkin_ws/install_isolated/share/OpenCV/3rdparty/lib' Undefined symbols for architecture x86_64: "_PyErr_SetString", referenced from: failmsg(char const*, ...) in module.cpp.o "_PyExc_TypeError", referenced from: failmsg(char const*, ...) in module.cpp.o "_PyImport_ImportModule", referenced from: init_module_cv_bridge_boost() in module.cpp.o "_PyInt_FromLong", referenced from: boost::python::to_python_value<int const&>::operator()(int const&) const in module.cpp.o "_PyInt_Type", referenced from: boost::python::to_python_value<int const&>::get_pytype() const in module.cpp.o "_PyObject_AsWriteBuffer", referenced from: convert_to_CvMat(_object*, CvMat**, char const*) in module.cpp.o "_PyObject_CallObject", referenced from: FROM_CvMat(CvMat*) in module.cpp.o "_PyObject_GetAttrString", referenced from: FROM_CvMat(CvMat*) in module.cpp.o "_PyString_AsString", referenced from: convert_to_CvMat(_object*, CvMat**, char const*) in module.cpp.o "_Py_BuildValue", referenced from: FROM_CvMat(CvMat*) in module.cpp.o "__Py_NoneStruct", referenced from: boost::python::api::object::object() in module.cpp.o ld: symbol(s) not found for architecture x86_64
Apply this patch
diff --git a/cv_bridge/src/CMakeLists.txt b/cv_bridge/src/CMakeLists.txt index 03a02b8..6c8a69f 100644 --- a/cv_bridge/src/CMakeLists.txt +++ b/cv_bridge/src/CMakeLists.txt @@ -20,6 +20,7 @@ include_directories(SYSTEM ${PYTHON_INCLUDE_PATH} add_library(${PROJECT_NAME}_boost module.cpp) target_link_libraries(${PROJECT_NAME}_boost ${Boost_LIBRARIES} ${catkin_LIBRARIES} + ${PYTHON_LIBRARIES} ${PROJECT_NAME} )
More info in http://answers.ros.org/question/52341/building-cv_bridge-with-catkin-fails/
No builder module in catkin
If catkin is already installed in homebrew, you may get the following message when trying to run catkin_make_isolated
Traceback (most recent call last): File "./src/catkin/bin/catkin_make_isolated", line 13, in <module> from catkin.builder import build_workspace_isolated ImportError: No module named builder
A quick solution is to remove catkin brew installation from the system
brew remove catkin
bondcpp fails
If bondcpp fails with:
==> Processing catkin package: 'bondcpp' ==> Building with env: '/Users/william/ros_catkin_ws/install_isolated/env.sh' Makefile exists, skipping explicit cmake invocation... ==> make cmake_check_build_system in '/Users/william/ros_catkin_ws/build_isolated/bondcpp' ==> make -j1 in '/Users/william/ros_catkin_ws/build_isolated/bondcpp' Linking CXX shared library /Users/william/ros_catkin_ws/devel_isolated/bondcpp/lib/libbondcpp.dylib ld: library not found for -luuid clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [/Users/william/ros_catkin_ws/devel_isolated/bondcpp/lib/libbondcpp.dylib] Error 1 make[1]: *** [CMakeFiles/bondcpp.dir/all] Error 2 make: *** [all] Error 2 <== Failed to process package 'bondcpp': KeyboardInterrupt Command failed, exiting.
Update brew and rosdep:
$ brew update $ rosdep update
Rerun rosdep:
Then it should build.
Pyside brew installation fails with segmentation fault
The output presented denotes a segmentation fault when using shiboken package as part of the pyside compilation process.
/bin/sh: line 1: 22299 Segmentation fault: 11 /usr/local/Cellar/shiboken/1.1.2/bin/shiboken --generator-set=shiboken --enable-parent-ctor-heuristic --enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero /tmp/pyside-rAxK/pyside-qt4.8+1.1.2/macbuild/PySide/pyside_global.h --include-paths=/tmp/pyside-rAxK/pyside-qt4.8+1.1.2/PySide:/usr/local/Cellar/qt/4.8.5/Frameworks --typesystem-paths=/tmp/pyside-rAxK/pyside-qt4.8+1.1.2/PySide:/tmp/pyside-rAxK/pyside-qt4.8+1.1.2/PySide/QtCore --output-directory=/tmp/pyside-rAxK/pyside-qt4.8+1.1.2/macbuild/PySide/QtCore --license-file=/tmp/pyside-rAxK/pyside-qt4.8+1.1.2/PySide/QtCore/../licensecomment.txt /tmp/pyside-rAxK/pyside-qt4.8+1.1.2/macbuild/PySide/QtCore/typesystem_core.xml --api-version=4.8 --drop-type-entries=""
A previous version of qt must be brewed. Uninstall pyside, shiboken and qt
brew uninstall pyside brew uninstall shiboken brew uninstall qt
and then follow this steps
cd `brew --prefix` brew uninstall qt git checkout 7fc8cc0 /usr/local/Library/Formula/qt.rb brew uninstall qt # Might not be necessary on your machine brew install pyside
More information in https://github.com/mxcl/homebrew/issues/21289.
rviz
Link error:
Linking CXX executable /Users/william/ros_catkin_ws/devel_isolated/rviz/lib/rviz/image_view Undefined symbols for architecture x86_64: "_GetCurrentProcess", referenced from: _main in main.cpp.o "_SetFrontProcess", referenced from: _main in main.cpp.o "_TransformProcessType", referenced from: _main in main.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [/Users/william/ros_catkin_ws/devel_isolated/rviz/lib/rviz/image_view] Error 1 make[1]: *** [src/image_view/CMakeFiles/rviz_image_view.dir/all] Error 2 make: *** [all] Error 2 <== Failed to process package 'rviz': KeyboardInterrupt Command failed, exiting.
Install error:
-- Installing: /Users/william/ros_catkin_ws/install_isolated/lib/libdefault_plugin.dylib -- Installing: /Users/william/ros_catkin_ws/install_isolated/lib/python2.7/site-packages/rviz/librviz_shiboken.dylib CMake Error at src/python_bindings/sip/cmake_install.cmake:31 (FILE): file INSTALL cannot find "/Users/william/ros_catkin_ws/devel_isolated/rviz/lib/python2.7/site-packages/rviz/librviz_sip.dylib". Call Stack (most recent call first): src/python_bindings/cmake_install.cmake:33 (INCLUDE) src/cmake_install.cmake:35 (INCLUDE) cmake_install.cmake:155 (INCLUDE) make: *** [install] Error 1 <== Failed to process package 'rviz': KeyboardInterrupt Command failed, exiting.
Both of these errors are solved in this pull request:
https://github.com/ros-visualization/rviz/pull/563
Runtime error:
∫ rosrun rviz rviz [ INFO] [1358386092.761466000]: rviz version 1.9.19 [ INFO] [1358386092.761550000]: compiled against OGRE version 1.7.4 (Cthugha) [ WARN] [1358386096.686693000]: OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library /usr/local/Cellar/ogre/1.7.4/lib/RenderSystem_GL. System Error: dlopen(/usr/local/Cellar/ogre/1.7.4/lib/RenderSystem_GL.dylib, 9): image not found in DynLib::load at /tmp/ogre-w5AP/ogre_src_v1-7-4/OgreMain/src/OgreDynLib.cpp (line 91) terminate called throwing an exceptionAbort trap: 6
Pull request: https://github.com/ros-visualization/rviz/pull/564
Runtime error:
[ INFO] [1358387448.148951000]: rviz version 1.9.19 [ INFO] [1358387448.149035000]: compiled against OGRE version 1.7.4 (Cthugha) 2013-01-16 17:50:52.329 rviz[29323:5c03] invalid drawable [ WARN] [1358387452.385106000]: OGRE EXCEPTION(7:InternalErrorException): Cannot compile GLSL high-level shader : rviz/box.geom Cannot compile GLSL high-level shader : rviz/box.geom ERROR: 0:1: '' : version '150' is not supported ERROR: 0:18: ';' : syntax error Uniform blocks may not have identifiers in GLSL 140 ERROR: 0:23: 'layout' : syntax error syntax error in GLSLProgram::compile at /tmp/ogre-w5AP/ogre_src_v1-7-4/RenderSystems/GL/src/GLSL/src/OgreGLSLExtSupport.cpp (line 65) [ WARN] [1358387452.387979000]: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at /tmp/ogre-w5AP/ogre_src_v1-7-4/OgreMain/src/OgreGpuProgramParams.cpp (line 1425) [ WARN] [1358387452.390215000]: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at /tmp/ogre-w5AP/ogre_src_v1-7-4/OgreMain/src/OgreGpuProgramParams.cpp (line 1425) [ WARN] [1358387452.391235000]: OGRE EXCEPTION(7:InternalErrorException): Cannot compile GLSL high-level shader : rviz/include/pass_depth.geom Cannot compile GLSL high-level shader : rviz/include/pass_depth.geom ERROR: 0:1: '' : version '150' is not supported in GLSLProgram::compile at /tmp/ogre-w5AP/ogre_src_v1-7-4/RenderSystems/GL/src/GLSL/src/OgreGLSLExtSupport.cpp (line 65) terminate called throwing an exceptionAbort trap: 6
https://github.com/ros-visualization/rviz/pull/558
orocos_kdl fails on rosmake -a
orocos_kdl may fail during rosmake -a outputting long error messages that include the line
ld: symbol(s) not found for architecture i386
Erase "i386," from the following line in the Makefile located in orocos_kdl folder
-DCMAKE_OSX_ARCHITECTURES="i386,x86_64"
Deleting build/CMakeCache.txt file may also be necessary for the package to finally compile.
rosdep permission issues
Installing rosdep as sudo may lead to permission issues during installation of dependencies
ERROR: Rosdep experienced an internal error: [Errno 13] Permission denied: '~/.ros/rosdep/sources.cache/index' Please go to the rosdep page [1] and file a bug report with the stack trace below. [1] : http://www.ros.org/wiki/rosdep Traceback (most recent call last): File "/Library/Python/2.7/site-packages/rosdep2/main.py", line 116, in rosdep_main exit_code = _rosdep_main(args) File "/Library/Python/2.7/site-packages/rosdep2/main.py", line 257, in _rosdep_main return _package_args_handler(command, parser, options, args) File "/Library/Python/2.7/site-packages/rosdep2/main.py", line 334, in _package_args_handler lookup = _get_default_RosdepLookup(options) File "/Library/Python/2.7/site-packages/rosdep2/main.py", line 107, in _get_default_RosdepLookup verbose=options.verbose) File "/Library/Python/2.7/site-packages/rosdep2/sources_list.py", line 501, in create_default sources = load_cached_sources_list(sources_cache_dir=sources_cache_dir, verbose=verbose) File "/Library/Python/2.7/site-packages/rosdep2/sources_list.py", line 419, in load_cached_sources_list with open(cache_index, 'r') as f: IOError: [Errno 13] Permission denied: '~/.ros/rosdep/sources.cache/index'
To resolve, recursively change the owner on the ~/.ros directory to the current user:
sudo chown -R <user> /Users/<user>/.ros
tf2_ros fails to build
If you are getting this error while building tf2_ros:
==> make -j4 -l4 in '/Users/Yeison/ros_catkin_ws/build_isolated/tf2_ros' Linking CXX shared library /Users/Yeison/ros_catkin_ws/devel_isolated/tf2_ros/lib/libtf2_ros.dylib Undefined symbols for architecture x86_64:
try to edit src/tf2_ros/CMakeLists.txt according to https://github.com/ros/geometry-experimental/pull/6
CMAKE_OSX_DEPLOYMENT_TARGET errors
Errors such like these:
CMake Error at /usr/local/Cellar/cmake/2.8.10.2/share/cmake/Modules/Platform/Darwin.cmake:190 (message): CMAKE_OSX_DEPLOYMENT_TARGET is '10.6' but CMAKE_OSX_SYSROOT: "" is not set to a MacOSX SDK with a recognized version. Either set CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to empty.
were fixed by commenting one line in ~/ros_catkin_ws/install_isolated/share/ros/core/rosbuild/public.cmake as shown below:
if(APPLE) #SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6" CACHE STRING "Deployment target for OSX" FORCE) endif(APPLE)
"Library not found" errors
A fix to errors like this one
ld: library not found for -l:/usr/local/lib/libboost_signals-mt.dylib
consists in the removal of extra ':' in *.pc files. This can be done automatically using the commands
$ cd ~/ros_catkin_ws/install_isolated/lib/pkgconfig $ find *.pc -print0 | xargs -0 sed -i .bak 's/\-l:/\-l/g'
Note that usually need to make clean the packages where the error occurs.
nodelet_tutorial_math fails to build
If nodelet_tutorial_math fails to build with errors like
------------------------------------------------------------------------------- -- Configuring done -- Generating done -- Build files have been written to: /Users/alex/ros_ws/common_tutorials/nodelet_tutorial_math/build cd build && make -j -l8 Scanning dependencies of target rospack_genmsg_libexe [ 0%] Built target rospack_genmsg_libexe Scanning dependencies of target rosbuild_precompile [ 0%] Built target rosbuild_precompile Scanning dependencies of target nodelet_math [100%] Building CXX object CMakeFiles/nodelet_math.dir/src/plus.cpp.o Linking CXX shared library ../lib/libnodelet_math.dylib clang: warning: argument unused during compilation: '-pthread' Undefined symbols for architecture x86_64: "class_loader::class_loader_private::AbstractMetaObjectBase::addOwningClassLoader(class_loader::ClassLoader*)", referenced from: void class_loader::class_loader_private::registerPlugin<nodelet_tutorial_math::Plus, nodelet::Nodelet>(std::string const&, std::string const&) in plus.cpp.o "class_loader::class_loader_private::AbstractMetaObjectBase::setAssociatedLibraryPath(std::string)", referenced from: void class_loader::class_loader_private::registerPlugin<nodelet_tutorial_math::Plus, nodelet::Nodelet>(std::string const&, std::string const&) in plus.cpp.o "class_loader::class_loader_private::AbstractMetaObjectBase::AbstractMetaObjectBase(std::string const&, std::string const&)", referenced from: class_loader::class_loader_private::AbstractMetaObject<nodelet::Nodelet>::AbstractMetaObject(std::string const&, std::string const&) in plus.cpp.o "class_loader::class_loader_private::AbstractMetaObjectBase::~AbstractMetaObjectBase()", referenced from: class_loader::class_loader_private::AbstractMetaObject<nodelet::Nodelet>::AbstractMetaObject(std::string const&, std::string const&) in plus.cpp.o "class_loader::class_loader_private::getFactoryMapForBaseClass(std::string const&)", referenced from: std::map<std::string, class_loader::class_loader_private::AbstractMetaObjectBase*, std::less<std::string>, std::allocator<std::pair<std::string const, class_loader::class_loader_private::AbstractMetaObjectBase*> > >& class_loader::class_loader_private::getFactoryMapForBaseClass<nodelet::Nodelet>() in plus.cpp.o "class_loader::class_loader_private::getCurrentlyActiveClassLoader()", referenced from: void class_loader::class_loader_private::registerPlugin<nodelet_tutorial_math::Plus, nodelet::Nodelet>(std::string const&, std::string const&) in plus.cpp.o "class_loader::class_loader_private::getCurrentlyLoadingLibraryName()", referenced from: void class_loader::class_loader_private::registerPlugin<nodelet_tutorial_math::Plus, nodelet::Nodelet>(std::string const&, std::string const&) in plus.cpp.o "class_loader::class_loader_private::getPluginBaseToFactoryMapMapMutex()", referenced from: void class_loader::class_loader_private::registerPlugin<nodelet_tutorial_math::Plus, nodelet::Nodelet>(std::string const&, std::string const&) in plus.cpp.o "class_loader::class_loader_private::hasANonPurePluginLibraryBeenOpened(bool)", referenced from: void class_loader::class_loader_private::registerPlugin<nodelet_tutorial_math::Plus, nodelet::Nodelet>(std::string const&, std::string const&) in plus.cpp.o "console_bridge::log(char const*, int, console_bridge::LogLevel, char const*, ...)", referenced from: void class_loader::class_loader_private::registerPlugin<nodelet_tutorial_math::Plus, nodelet::Nodelet>(std::string const&, std::string const&) in plus.cpp.o __GLOBAL__I_a in plus.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[3]: *** [../lib/libnodelet_math.dylib] Error 1 make[2]: *** [CMakeFiles/nodelet_math.dir/all] Error 2 make[1]: *** [all] Error 2 -------------------------------------------------------------------------------} [ rosmake ] Output from build of package nodelet_tutorial_math written to: [ rosmake ] /Users/alex/.ros/rosmake/rosmake_output-20130302-173409/nodelet_tutorial_math/build_output.log [rosmake-5] Finished <<< nodelet_tutorial_math [FAIL] [ 41.04 seconds ]
Add a dependency to class_loader in nodelet_tutorial_math/manifest.xml
<depend package="class_loader"/>
Fix taken from herehttps://github.com/ros/common_tutorials/issues/3
If rosmake -a fails with an error related to "BOOST_JOIN"
If rosmake -a fails with an error related to "BOOST_JOIN", e.g. with
usr/local/Cellar/boost/1.53.0/include/boost/type_traits/detail/has_binary_operator.hp:50: Parse error at "BOOST_JOIN"
As described here you need an updated version of ros-tutorials. I had to do the following to make this update work
$ cd ~/ros_catkin_ws $ rm -rf src/ros_tutorials src/roscpp_tutorials src/rospy_tutorials src/turtlesim $ cd src $ git clone https://github.com/ros/ros_tutorials.git $ cd .. $ rm -rf build_isolated $ catkin_make_isolated --install
orocos_kdl Fails to build on OS X 10.9 (Mavericks)
See this issue: https://github.com/orocos/orocos_kinematics_dynamics/pull/4 And check out the more complete write-up: http://answers.ros.org/question/94771/building-octomap-orocos_kdl-and-other-packages-on-osx-109-solution/
PIL fails to install on OS X 10.9 (Mavericks)
$ sudo ln -s /usr/local/include/freetype2 /usr/local/include/freetype $ sudo pip install pil --allow-external pil --allow-unverified pil
Notice that there's a report (with work around) that ogre failed to be installed via brew.
[ 12%] Building CXX object OgreMain/CMakeFiles/OgreMain.dir/src/OgreGpuProgramParams.cpp.o cd /tmp/ogre-4JyI/ogre_src_v1-7-4/build/OgreMain && /usr/local/Library/ENV/4.3/clang++ -DBOOST_ALL_NO_LIB -DFREEIMAGE_LIB -DOGRE_NONCLIENT_BUILD -DOgreMain_EXPORTS -D_MT -D_USRDLL -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -fPIC -I/tmp/ogre-4JyI/ogre_src_v1-7-4/OgreMain/include -I/tmp/ogre-4JyI/ogre_src_v1-7-4/build/include -I/tmp/ogre-4JyI/ogre_src_v1-7-4/OgreMain/include/OSX -I/usr/local/include -I/opt/X11/include -I/tmp/ogre-4JyI/ogre_src_v1-7-4 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Carbon.framework/Headers -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Cocoa.framework/Headers -I/tmp/ogre-4JyI/ogre_src_v1-7-4/OgreMain/src/nedmalloc -pthread -o CMakeFiles/OgreMain.dir/src/OgreGpuProgramParams.cpp.o -c /tmp/ogre-4JyI/ogre_src_v1-7-4/OgreMain/src/OgreGpuProgramParams.cpp /tmp/ogre-4JyI/ogre_src_v1-7-4/OgreMain/src/OgreFont.cpp:44:10: fatal error: 'freetype.h' file not found #include FT_FREETYPE_H
clang: error: unknown argument: '-mno-fused-madd'
Seen on OS X 10.9 (Mavericks) while rosdep, particularly with pil, netifaces. Error output is something similar as follows:
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/usr/local/include/freetype2 -IlibImaging -I/System/Library/Frameworks/Python.framework/Versions/2.7/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.9-intel-2.7/_imaging.o clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future] clang: note: this will be a hard error (cannot be downgraded to a warning) in the future error: command 'cc' failed with exit status 1
This can be worked around by using -E option in sudo (ref.):
$ export CFLAGS=-Qunused-arguments $ export CPPFLAGS=-Qunused-arguments $ sudo -E pip install PIL
gtk+ fails to install in brew
If an error like the following is displayed:
gtk+: Unsatisfied dependency: XQuartz 2.3.6
XQuartz system must be installed from http://xquartz.macosforge.org/.
rospack fails build with cmake3 - Can't find PythonLibs
ref.
Seen on OS X 10.9 (Mavericks) Hydro with brewed cmake versions 3.0.0 & 3.0.2
Error looks like
-- catkin 0.5.88 -- Boost version: 1.55.0 -- Found the following Boost libraries: -- filesystem -- program_options -- system CMake Error at /usr/local/Cellar/cmake/3.0.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:136 (message): Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is at least version "2.7") Call Stack (most recent call first): /usr/local/Cellar/cmake/3.0.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:343 (_FPHSA_FAILURE_MESSAGE) /usr/local/Cellar/cmake/3.0.0/share/cmake/Modules/FindPythonLibs.cmake:197 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:7 (find_package)
To fix: In rospack/CMakeLists.txt replace
set(PythonLibs_FIND_VERSION "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") find_package(PythonLibs REQUIRED)
with
find_package(PythonLibs "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" REQUIRED)
You could also use the commit which fixes this for hydro:
$ cd src/rospack $ curl https://github.com/ros/rospack/commit/246dd14882b6f782de65961fa495b3395c6d4540.diff | patch -p1 $ cd -
Error compiling rosbag_storage on Yosemite
ref.
Seen on Yosemite 10.10.3. When compiling rosbag_storage, error looks like:
/usr/local/include/boost/format/format_fwd.hpp:24:69: error: no type named 'allocator' in namespace 'std' class Tr = BOOST_IO_STD char_traits<Ch>, class Alloc = std::allocator<Ch> > ~~~~~^ /usr/local/include/boost/format/format_fwd.hpp:24:78: error: expected ',' or '>' in template-parameter-list class Tr = BOOST_IO_STD char_traits<Ch>, class Alloc = std::allocator<Ch> > ^ /usr/local/include/boost/format/format_fwd.hpp:24:83: error: expected unqualified-id class Tr = BOOST_IO_STD char_traits<Ch>, class Alloc = std::allocator<Ch> > ^ /usr/local/include/boost/format/format_fwd.hpp:27:13: error: unknown type name 'basic_format' typedef basic_format<char > format; ^ /usr/local/include/boost/format/format_fwd.hpp:27:25: error: expected unqualified-id typedef basic_format<char > format; ^ /usr/local/include/boost/format/format_fwd.hpp:30:13: error: unknown type name 'basic_format' typedef basic_format<wchar_t > wformat; ^ /usr/local/include/boost/format/format_fwd.hpp:30:25: error: expected unqualified-id typedef basic_format<wchar_t > wformat;
To fix, apply this patch provided by crazyorc:
--- src/roscpp_core/roscpp_traits/include/ros/message_forward.h.orig 2015-04-22 15:04:29.000000000 -0700 +++ src/roscpp_core/roscpp_traits/include/ros/message_forward.h 2015-04-22 15:46:31.000000000 -0700 @@ -28,6 +28,11 @@ #ifndef ROSLIB_MESSAGE_FORWARD_H #define ROSLIB_MESSAGE_FORWARD_H +// Make sure that either __GLIBCXX__ or _LIBCPP_VERSION is defined. +#include <cstddef> + // C++ standard section 17.4.3.1/1 states that forward declarations of STL types // that aren't specializations involving user defined types results in undefined // behavior. Apparently only libc++ has a problem with this and won't compile it.
homebrew: Failed to detect successful installation of pyqt
This error could happen with other module and is not specific to ROS at all. Here we show the error with pyqt as an example.
$ rosdep install --from-paths src --ignore-src --rosdistro indigo -y --as-root pip:no --skip-keys="gazebo" executing command [brew install pyqt] Warning: pyqt-4.11.3 already installed, it's just not linked ERROR: the following rosdeps failed to install homebrew: Failed to detect successful installation of [pyqt]
Simply (re)link pyqt.
$ brew link pyqt
Using native ROS code on Android
This tutorial covers how to cross-compile ROS packages using the Android NDK, and running them on Android as a native activity, as a normal app using the Java Native Interface and rosjava or as native executable. In order to isolate the cross-compilation process, we do it inside a Docker container.
To date, we have cross-compiled the ROS packages that are included in ndk.rosinstall.
Tutorials
- Building native ROS packages
This tutorial show how to build native ROS nodes using the Android NDK
- Building Sample Application using Binary Distribution
This tutorial presents an example Android application which uses the binary distribution of the cross compiled ROS libraries for Android. It is based on the ANT build system and is intended to serve a starting point for a custom application.
- Simple Native Activity Application
This tutorial shows how to create a sample Android native application running ROS native nodes, and run it on an Android device
- move_base Native Activity Application
This tutorial presents an example Android application to show the use of a cross compiled move_base library using an Android Native Activity.
- How to cross-compile any other ROS package for Android
A tutorial on how to cross-compile your favorite ROS package for Android.
- Wrapping your native code as a rosjava node
Steps to create a rosjava android project and add your native compiled nodes as rosjava nodes.
- Using Pluginlib
How to use Pluginlib inside the Android native framework.
Installation Instructions for Indigo in Arch Linux
This page describes how to install Indigo in Arch Linux. Arch Linux is not officially supported by ROS and the installation might fail for several reasons. This page does not (yet) contain instructions for most higher level ROS packages, only for the base system. This includes the middleware and command line tools but not much more.
Method 1: Using the AUR Packages
Installing an AUR helper
First, install base-devel that contains everything needed by makepkg to compile packages on Arch Linux:
pacman -S base-devel
The current most straightforward way to install ROS Indigo is using the AUR packages that start with ros-indigo. Using a helper such as yaourt or packer, it is possible to install all packages related to ROS Indigo and let the Arch Build System take care of all the dependencies involved.
To install yaourt, you can add the archlinuxfr repository to /etc/pacman.conf:
[archlinuxfr] SigLevel = Never Server = http://repo.archlinux.fr/$arch
Then, simply run:
pacman -Sy yaourt
Or if you decide to go for packer:
pacman -Sy packer
Preliminary configuration
Some settings will make the installation process faster:
Set MAKEFLAGS in /etc/makepkg.conf to the number of threads you want to use when compiling. If you want to use the maximum of threads for your system, use the value given by nproc. For instance, if you have 4 cores, use MAKEFLAGS="-j4". If you want to be able to use your computer while installing ROS without much of a performance hit, you may want to lower this value.
You should also make sure that [core], [extra] and possibly [community] are enabled in your /etc/pacman.conf, since some dependencies are part of these official repositories.
Python version
Arch Linux uses Python 3 as its default version, and starting with Indigo, Python 3 is now supported in ROS. However, since several non-core packages have not been fixed for Python 3 yet, we still rely on Python 2.
Since Python 3 is not fully compatible with Python 2, some extra options have to be provided to catkin_make and/or cmaketo make sure that the proper Python executable, headers and libraries are used.
Installing AUR Packages
In the following simple examples I will be using yaourt, however, it is trivial to replace it with packer. In order to see what packages are avaible, simply use:
yaourt ros-indigo
Or view the list of packages online. It is then possible to install a specific subset of the packages (or all of them, using a string like 1-112).
In order to avoid all of the prompts when installing a large number of packages, the use of the following flag may be applied (be warned that you will NOT be prompted for confirmation on any of the packages, only for your password)
yaourt --noconfirm ros-indigo
Using this method, you will be asked only once for the password, and all following packages will be installed without asking the using to edit any PKGBUILD or confirm a package installation. Be warned that should a failure occur in one of the builds, you will not be able to edit a PKBUILD. You can, however, attempt to install that specific package alone and then restart the build process without having to reinstall every package. For instance, should the package ros-indigo-actionlib-msgs fail, you can check it separately with the following procedure:
yaourt -S ros-indigo-actionlib-msgs
Depending on where it fails, different actions are possible. To restart the building process without rebuilding all of the packages, a simple
yaourt --noconfirm --needed ros-indigo
and selecting the packages you want to install will suffice. Once this is done, you will have a complete ROS Indigo installation in /opt/ros/indigo, and you can proceed to follow the ROS Tutorials online. Note, however, that a few extra steps need to be taken:
First, install rosdep with
yaourt -S python2-rosdep
Then, initialize rosdep with
sudo rosdep init rosdep update
Some users could experience problems with the last command. In this case, remove the python2-rosdep package and install python2-pip. Therefore, rosdep could be installed using pip2. In the following, these steps are summarized:
yaourt -Rsc python2-rosdep yaourt -S python2-pip sudo pip2 install -U rosdep
Therefore, init and update rosdep:
sudo rosdep init rosdep update
User configuration
Finally, when initializing a catkin workspace, as specified in the tutorial pages, instead of issuing the command:
catkin_make
some Python 2 flags will need to be added, as in:
catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python2 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so
This step will not be necessary when installing every package, but if an error occurs mentioning a version of Python 3, then it will be needed in order to specify the right version.
To make things easier, you should create a shell function that sets everything ROS-related, and run that function when you want to use some shells for ROS. For instance, you can add something like this in your ~/.bashrc:
# ROS indigo() { source /opt/ros/indigo/setup.bash export PYTHONPATH=/opt/ros/indigo/lib/python2.7/site-packages:$PYTHONPATH export PKG_CONFIG_PATH="/opt/ros/indigo/lib/pkgconfig:$PKG_CONFIG_PATH" # Optionally, you can set: #export ROS_PACKAGE_PATH=/path/to/your/package/path:$ROS_PACKAGE_PATH # Useful aliases alias catkin_make="catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python2 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so" # If you use Gazebo: #source /usr/share/gazebo/setup.sh }
Then, in a shell:
$ indigo $ roscore
Adding New AUR Packages
If you want to help packaging for Arch Linux, you can use import_catkin_packages.py available in arch-ros-stacks. You can fork arch-ros-stacks and contribute by following the instructions in the README.
If you do push your packages to the AUR, other Arch Linux users will be able to install your package by simply typing:
yaourt ros-indigo-package-name
Note that you can also create PKGBUILDs manually (just copy another package's PKGBUILD and adapt it), but the automatic process is probably the safest option, since it gets the latest release version, the adequate dependencies, the short description etc.
Community
If you would like to contribute to packaging ROS on Arch, check arch-ros-stacks on GitHub (as explained in #1.2), or even [https://wiki.archlinux.org/index.php/Talk:Ros].
Installing ROS Indigo on Debian Wheezy
Description: These are instructions to install Indigo on Debian Wheezy.Keywords: Debian, Setup, Indigo
Tutorial Level: BEGINNER
Introduction
This tutorial explains how to install ROS Indigo from source on Debian Wheezy. The instructions roughly follow the source installation on Raspbian OS (which is also Debian-based). However, a few dependencies need to be accounted spcifically for Debian Wheezy.
Prerequisites
These instructions assume that Debian (wheezy) is being used. The download page for current images of Debian Wheezy is https://www.debian.org/releases/stable/debian-installer/.
Setup ROS Repositories
$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu wheezy main" > /etc/apt/sources.list.d/ros-latest.list' $ sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
Enable Wheezy backports repository
Backports are packages from testing or unstable versions od Debian ported back to the stable version to allow access to cutting-edge versions of software on an otherwise stable system.
$ sudo sh -c 'echo "deb http://http.debian.net/debian wheezy-backports main" > /etc/apt/sources.list.d/backports.list'
Now, make sure your Debian package index is up-to-date:
$ sudo apt-get update $ sudo apt-get upgrade
Install bootstrap dependencies
$ sudo apt-get install python-setuptools $ sudo easy_install pip $ sudo pip install -U rosdep rosinstall_generator wstool rosinstall
Initializing rosdep
$ sudo rosdep init $ rosdep update
Installation
Now we will download and build ROS Indigo.
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:
ROS-Comm: (recommended) ROS package, build, and communication libraries. No GUI tools.
$ rosinstall_generator ros_comm --rosdistro indigo --deps --wet-only --exclude roslisp --tar > indigo-ros_comm-wet.rosinstall $ wstool init -j8 src indigo-ros_comm-wet.rosinstall
Desktop: ROS, rqt, rviz, and robot-generic libraries
$ rosinstall_generator desktop --rosdistro indigo --deps --wet-only --exclude roslisp --tar > indigo-desktop-wet.rosinstall $ wstool init -j8 src indigo-desktop-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 -j8 option downloads 8 packages in parallel.
Note: The roslisp package is excluded in these generators because it is not tested. If it works for you, please edit this tutorial.
So far, only these two variants have been tested on Debian Wheezy in Indigo; however, more are defined in REP 131such as robot, perception, etc. Just change the package path to the one you want, e.g., for robot do:
$ rosinstall_generator robot --rosdistro indigo --deps --wet-only --tar > indigo-robot-wet.rosinstall $ wstool init -j8 src indigo-robot-wet.rosinstall
Please feel free to update these instructions as you test more variants.
If wstool init fails or is interrupted, you can resume the download by running:
wstool update -j 4 -t src
Resolve Dependencies
Before you can build your catkin workspace you need to make sure that you have all the required dependencies. We use the rosdep tool for this, however, first, a couple of dependencies not available in the repositories must be manually built.
Dependencies not available in the Debian Wheezy branch
At the time this article was written (01/2015) several packages: libconsole-bridge-dev, liburdfdom-headers-dev, liburdfdom-dev, liblz4-dev, and collada-dom-dev are not in the Debian stable branch, and libopencv-dev and OGRE are old versions. The following are needed for each variant:
Needed for Ros_Comm: libconsole-bridge-dev and liblz4-dev
Needed for Desktop: libconsole-bridge-dev, liblz4-dev, liburdfdom-headers-dev, liburdfdom-dev, collada-dom-devand OGRE and libopencv-dev
These packages can be built from source in a new directory (Also install checkinstall and cmake):
$ mkdir ~/ros_catkin_ws/external_src $ sudo apt-get install checkinstall cmake
libconsole-bridge-dev: Install with the following:
$ cd ~/ros_catkin_ws/external_src $ sudo apt-get install libboost-system-dev libboost-thread-dev $ git clone https://github.com/ros/console_bridge.git $ cd console_bridge $ cmake . $ sudo checkinstall make install
- When check-install asks for any changes, the name (2) needs to change from "console-bridge" to "libconsole-bridge-dev" otherwise rosdep install wont find it. You can also skip generating documentation.
liburdfdom-headers-dev: Install with the following:
$ cd ~/ros_catkin_ws/external_src $ git clone https://github.com/ros/urdfdom_headers.git $ cd urdfdom_headers $ 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 rosdep install wont find it.
liburdfdom-dev: Install with the following:
$ 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 rosdep install wont find it.
collada-dom-dev: Install with the following (Note: You will also need to patch collada_urdf as described here):
$ 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 rosdep install wont find it.
libopencv-dev: Install with the following (be prepared it's gonna take more than an hour; based on http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html):
$ cd ~/ros_catkin_ws/external_src $ git clone https://github.com/Itseez/opencv.git $ mkdir opencv/release $ cd opencv/release $ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. $ make $ sudo checkinstall make install
- When check-install asks for any changes, the name (2) needs to change from "release" to "libopencv-dev" otherwise rosdep install wont find it.
If you have some problems compiling the newest OpenCV, you can try to compile a release version by switching to the 2.4 branch. After git clone, type git checkout 2.4.
- Also, if there is an existing installation of OpenCV 2.3 on the system, you may have to first uninstall it to avoid compilation and installation problems.
liblz4-dev: Install using Wheezy backports:
$ sudo apt-get -t wheezy-backports install liblz4-dev
OGRE: Install newer version through apt-get
$ sudo apt-get remove libogre-1.7.* $ sudo apt-get install libogre-1.8-dev
Note: If you don't want to compile Collada but would like to install the desktop variant, use the following generator:
$ rosinstall_generator desktop --rosdistro indigo --deps --wet-only --exclude roslisp collada_parser collada_urdf --tar > indigo-desktop-wet.rosinstall
Resolving Dependencies with rosdep
The remaining dependencies should be resolved by running rosdep:
$ cd ~/ros_catkin_ws $ rosdep install --from-paths src --ignore-src --rosdistro indigo -y -r --os=debian:wheezy
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.
Note: Rosdep and apt-get may report that python-rosdep, python-catkin-pkg, python-rospkg, and python-rosdistro failed to install; however, you can ignore this error because they have already been installed with pip.
Building the catkin Workspace
Once you have completed downloading the packages and have resolved the dependencies, you are ready to build the catkin packages.
Invoke catkin_make_isolated:
$ sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo
Note: This will install ROS in the equivalent file location to Ubuntu in /opt/ros/indigo however you can modify this as you wish.
Now ROS should be installed! Remember to source the new installation:
$ source /opt/ros/indigo/setup.bash
Maintaining a Source Checkout
Updating the workspace
See the Ubuntu source install instructions for steps on updating the ros_catkin_ws workspace. The same steps should apply to Debian Wheezy.
Adding released packages
You may add additional packages to the installed ros workspace that have been released into the ros ecosystem. First, a new rosinstall file must be created including the new packages (Note, this can also be done at the initial install). For example, if we have installed ros_comm, but want to add ros_control and joystick_drivers, the command would be:
$ cd ~/ros_catkin_ws $ rosinstall_generator ros_comm ros_control joystick_drivers --rosdistro indigo --deps --wet-only --exclude roslisp --tar > indigo-custom_ros.rosinstall
You may keep listing as many ROS packages as you'd like separated by spaces.
Next, update the workspace with wstool:
$ wstool merge -t src indigo-custom_ros.rosinstall $ wstool update -t src
After updating the workspace, you may want to run rosdep to install any new dependencies that are required:
$ rosdep install --from-paths src --ignore-src --rosdistro indigo -y -r --os=debian:wheezy
Finally, now that the workspace is up to date and dependencies are satisfied, rebuild the workspace:
$ sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo
References
http://wiki.ros.org/indigo/Installation/Source
http://wiki.ros.org/hydro/Installation/Debian
http://wiki.ros.org/ROSberryPi/Setting%20up%20Hydro%20on%20RaspberryPi
http://wiki.ros.org/ROSberryPi/Installing%20ROS%20Indigo%20on%20Raspberry%20Pi