Contents
- Installing ROS kinetic from sources
- Installing
catkin_tools
- Installing Intera SDK from sources
- Creating a development ROS workspace
This guide is intended to be a most pain-free, future-proof way of installing ros kinetic
on a Ubuntu 16.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 kinetic from sources
Why ros kinetic
? Because it is the same version that is installed on the Sawyer robot we use in our 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 Sawyer robot.
Prerequisites
Setup sources.list
Installing ros kinetic
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://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
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
combinesCMake
macros andPython
scripts to provide some functionality on top ofCMake
’s normal workflow.catkin
was designed to be more conventional thanrosbuild
, allowing for better distribution of packages, better cross-compiling support, and better portability.catkin
’s workflow is very similar toCMake
’s but adds support for automatic ‘find package’ infrastructure and building multiple, dependent projects at the same time. The namecatkin
comes from the tail-shaped flower cluster found on willow trees – a reference to Willow Garage wherecatkin
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 kinetic --deps --wet-only --tar > kinetic-desktop-full-wet.rosinstall
wstool init -j8 src kinetic-desktop-full-wet.rosinstall
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. NOTE: some of the packages might be unavailable and may need to be installed separately. apt-cache search ros-kinetic
is a useful command for finding needed packages. This command lists available packages for kinetic and can be used to quickly find and install needed packages.
rosdep install --from-paths src --ignore-src --rosdistro kinetic -y -r
apt-cache search ros-kinetic
A useful command that resolves most dependency issues is as follows.
sudo apt-get install git-core python-argparse python-wstool python-vcstools python-rosdep ros-kinetic-control-msgs ros-kinetic-joystick-drivers ros-kinetic-xacro ros-kinetic-tf2-ros ros-kinetic-rviz ros-kinetic-cv-bridge ros-kinetic-actionlib ros-kinetic-actionlib-msgs ros-kinetic-dynamic-reconfigure ros-kinetic-trajectory-msgs ros-kinetic-rospy-message-converter
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 Intera SDK from sources
If you need to use the Sawyer 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 Intera SDK
In order to decouple the stable ros
installation from the Intera 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_sawyer_ws
mkdir -p ros_sawyer_ws/src
cd ros_sawyer_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-kinetic-control-msgs ros-kinetic-joystick-drivers ros-kinetic-xacro ros-kinetic-tf2-ros ros-kinetic-rviz ros-kinetic-cv-bridge ros-kinetic-actionlib ros-kinetic-actionlib-msgs ros-kinetic-dynamic-reconfigure ros-kinetic-trajectory-msgs ros-kinetic-rospy-message-converter
Install and compile SDK
cd ~/src/ros_sawyer_ws/src
wstool init .
git clone https://github.com/RethinkRobotics/sawyer_robot.git
wstool merge sawyer_robot/sawyer_robot.rosinstall
wstool update
cd ~/src/ros_sawyer_ws
catkin build
Source the Intera 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_sawyer_ws/devel/setup.bash
Installing the Sawyer simulator
We will add the Sawyer simulator to the same ros_sawyer_ws
we have created before:
cd ~/src/ros_sawyer_ws/src
git clone https://github.com/RethinkRobotics/sawyer_simulator.git
wstool init .
wstool merge sawyer_simulator/sawyer_simulator.rosinstall
wstool update
cd ~/src/ros_sawyer_ws
catkin build
cp src/sawyer/sawyer.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_sawyer_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/hiro/code/ros_devel_ws/src:/home/hiro/code/ros_catkin_ws/install_isolated/share:/home/hiro/code/ros_catkin_ws/install_isolated/stacks