How to install ROS indigo

and live happily ever after


Contents

This guide is intended to be a pain-free, future-proof way of installing ros indigo on a Ubuntu 14.04 machine. It is a collection of information from a variety of different sources, and the gist of it is that it will install ROS from sources in user space in order to avoid messing around with debian packages that are usually out-of-date and/or conflicting with more advanced features.

This page is about ros installation. For a summary about the main ros concepts and some useful command-line tools, go here.

Installing ROS indigo from sources

Why ros indigo? Because it is the same version that has been installed on the Baxter robot we are using at the Social Robotics Lab.

Why installing from sources? It is the way to go if you want to have access to the source files and get a better idea of the middleware. Below, there is a set of instructions, heavily inspired by the official ros wiki.

NOTE: This page provides a complete step-by-step guide on how to setup a workstation for the Baxter robot.

Prerequisites

Setup sources.list

Installing ros indigo is not particularly difficult. First thing is to setup the machine to accept software from packages.ros.org. According to this page (Section 1.2 and 1.3):

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116
sudo apt-get update

Installing bootstrap dependencies

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

sudo apt-get install python-rosdep python-rosinstall-generator python-wstool python-rosinstall build-essential

Initializing rosdep

sudo rosdep init
rosdep update

Building the catkin packages

ros moved away from rosbuild and started to used catkin. From here:

catkin combines CMake macros and Python scripts to provide some functionality on top of CMake’s normal workflow. catkin was designed to be more conventional than rosbuild, allowing for better distribution of packages, better cross-compiling support, and better portability. catkin’s workflow is very similar to CMake’s but adds support for automatic ‘find package’ infrastructure and building multiple, dependent projects at the same time. The name catkin comes from the tail-shaped flower cluster found on willow trees – a reference to Willow Garage where catkin was created.”

In summary: welcome to the modern age!

Creating a catkin workspace

Let’s create a catkin workspace called ros_catkin_ws in your src directory (assuming you have a directory called src for all your code):

cd ~/src
mkdir ros_catkin_ws
cd ros_catkin_ws/

Now, there are a number of options to choose from. The recommended one is the Desktop-Full installation: this will install ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception packages.

rosinstall_generator desktop_full --rosdistro indigo --deps --wet-only --tar > indigo-desktop-full-wet.rosinstall
wstool init -j8 src indigo-desktop-full-wet.ros

Resolving dependencies

Before you can build your catkin workspace, you need to make sure that you have all the required dependencies. They 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.

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

WARNING: this takes a loong time. Go grab a coffee or enjoy your life.

.bashrc

Add this to your ~/.bashrc file:

# Ros stuff
export ROS_ROOT="$HOME/src/ros_catkin_ws/install_isolated"
export PATH=$ROS_ROOT/bin:$PATH
source $ROS_ROOT/setup.bash

Now everything should be set up correctly. It’s time to follow some tutorials.

Installing catkin_tools

From here onward, we will use here catkin_tools instead of catkin_make, so let’s install it before doing anything else. Similarly to ros before, we will download it from sources and install it in user space (from here):

cd ~/src
git clone https://github.com/catkin/catkin_tools.git
cd catkin_tools
pip install -r requirements.txt --upgrade --user
python setup.py install --user --record install_manifest.txt

Why we haven’t been using catkin_tools to compile ros too? Because I have never tested it myself so I can’t recommend it (feel free to try it out yourself).

Installing Baxter SDK from sources

If you need to use the Baxter Research Robot, it is best if you download and install its SDK. It is even better if you download and install the Gazebo simulator to simulate it!

Create a new workspace for the Baxter SDK

In order to decouple the stable ros installation from the baxter SDK, it is better to maintain two separate workspaces (please notice that we are using catkin_tools instead of catkin_make).

cd ~/src
mkdir -p ros_baxter_ws
mkdir -p ros_baxter_ws/src
cd ros_baxter_ws/
catkin init -w .
catkin build

Install SDK Dependencies

sudo apt-get update
sudo apt-get install git-core python-argparse python-wstool python-vcstools python-rosdep ros-indigo-control-msgs ros-indigo-joystick-drivers

Install and compile SDK

cd ~/src/ros_baxter_ws/src
wstool init .
wstool merge https://raw.githubusercontent.com/RethinkRobotics/baxter/master/baxter_sdk.rosinstall
wstool update
cd ~/src/ros_baxter_ws
catkin build

Source the Baxter SDK workspace

Again, go back to the ~/.bashrc, and add the following (it should go after the previous source $ROS_ROOT/setup.bash):

source $HOME/src/ros_baxter_ws/devel/setup.bash

Installing the Baxter simulator

We will add the Baxter simulator to the same ros_baxter_ws we have created before:

cd ~/src/ros_baxter_ws/src
wstool merge https://raw.githubusercontent.com/RethinkRobotics/baxter_simulator/master/baxter_simulator.rosinstall
wstool update
cd ~/src/ros_baxter_ws
catkin build
cp src/baxter/baxter.sh .

Please refer to this link for instructions on how to run it and use it.

Creating a development ROS workspace

Similarly to before, in order to decouple the stable ros installation from the development packages you are working on, it is better to create a third workspace. Below, you can find instructions on how to do it (from here).

cd ~/src
mkdir -p ros_devel_ws
mkdir -p ros_devel_ws/src
cd ros_devel_ws/
catkin init -w .

Even though the workspace is empty (there are no packages in the src folder) you can still build the workspace:

cd ~/src/ros_devel_ws/
catkin build

The catkin build command is a convenience tool for working with catkin workspaces. If you look in your current directory you should now have a build and devel folder. Inside the devel folder you can see that there are now several setup.*sh files. Sourcing any of these files will overlay this workspace on top of your environment:

source devel/setup.bash

To make this permanent, you have to again go back to the ~/.bashrc, and add the following (it should go after the previous source $HOME/src/ros_baxter_ws/devel/setup.bash):

source $HOME/src/ros_devel_ws/devel/setup.bash

To make sure your workspace is properly overlayed by the setup script, make sure ROS_PACKAGE_PATH environment variable includes the directory you are in.

[scazlab@baxter]$ echo $ROS_PACKAGE_PATH
/home/scazlab/code/ros_devel_ws/src:/home/scazlab/code/ros_catkin_ws/install_isolated/share:/home/scazlab/code/ros_catkin_ws/install_isolated/stacks