Unsupported Installation of ROS Hydro from source on Ubuntu 14.04

NOTE: This is an unsupported tutorial, but is intended to help anyone trying to build ROS Hydro from source on Ubuntu 14.04 despite there not being official support for running ROS Hydro on Ubuntu 14.04.

If you are installing ROS on Ubuntu 14.04 for the first time, please install a distribution which is officially supported on that Ubuntu 14.04:

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

Prerequisites

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.

Setup your sources.list

Setup your computer to accept software from packages.ros.org.

  • sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

Mirrors

Source Debs are also available

Set up your keys

  • sudo apt install curl # if you haven't already installed curl
    curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
  • sudo add-apt-repository ppa:openrave/release

Installation

First, make sure your Debian package index is up-to-date:

  • 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 -y git svn mercurial python-pip build-essential
$ sudo pip install -U rosdep rosinstall_generator wstool rosinstall catkin_tools

Initializing rosdep

$ sudo rosdep init
$ rosdep update

Installation

Start by building the core ROS packages.

Building the catkin Packages

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

Create a catkin Workspace

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

  • $ mkdir -p ~/ros_hydro
    $ cd ~/ros_hydro

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 hydro --deps --wet-only --tar > hydro-desktop-full-wet.rosinstall
    $ wstool init -j8 src hydro-desktop-full-wet.rosinstall

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

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

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

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

This will add all of the catkin or wet packages in the given variant and then fetch the sources into the ~/ros_hydro/src directory. 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 hydro --deps --wet-only --tar > hydro-robot-wet.rosinstall
$ wstool init -j8 src hydro-robot-wet.rosinstall

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

wstool update -j 4 -t src

Resolving Dependencies

Figure out which deps are missing on Trusty:

  • sudo apt-get install -y $(rosdep install --from-paths src --ignore-src --rosdistro hydro -y -s | sed '/^#/d' | sed ':a;N;$!ba;s/\n/ /g' | sed 's/sudo apt-get install -y/ /g')

Then run sudo apt-get install -y with all deps which are available.

Deps with known problems:

  • gazebo2
    python-rospkg
    python-catkin-pkg

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 hydro -y

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

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

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

Building the catkin Workspace

Once it has completed downloading the packages and resolving the dependencies you are ready to build the catkin packages with the catkin build command. For documentation on catkin build see: http://catkin_tools.readthedocs.org

Invoke catkin build:

  • $ catkin config --install --cmake-args -DCMAKE_BUILD_TYPE=Release
    $ catkin build

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_hydro/install, if you would like to install some where else then you can do this by adding the --install-space /opt/ros/hydro argument to your catkin config call.

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

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

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

  • $ source ~/ros_hydro/install/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:

$ catkin build

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_hydro/install_isolated/setup.bash

Wiki: hydro/Installation/Trusty (last edited 2017-04-14 21:32:15 by DHood)