All about Gazebo 9 with ROS

Article by Ricardo Téllez

Learn how to install Gazebo 9 simulator to work with your ROS system.
In this article we are going to see how to replace the default version of Gazebo that comes with the installation of ROS and if previously existing simulations work (or not) with this new version of the simulator.

How to install Gazebo 9 in an existing ROS environment
I presume that you already have a ROS distribution in your system. If you do, you probably installed the version of Gazebo that came by default with that ROS distribution. If you check the documentation of Gazebo, you will see that the following table corresponds to the default versions of Gazebo that automatically install with ROS:

ROS Indigo: Gazebo 2.x
ROS Kinetic: Gazebo 7.x
ROS Lunar: Gazebo 7.x
Let’s see now, how can you proceed to change the default Gazebo version by the newest one (9.x as for 3rd May 2018).

First uninstall the default Gazebo
If you want to install the latest version, you will have to remove first your default installed Gazebo (which was probably installed when you installed ROS). That is easy, because, independently of the ROS version, the same command applies to all the distributions to remove the default Gazebo installation:

sudo apt-get remove ros-<ROS_VERSION>-gazebo*
sudo apt-get remove libgazebo*
sudo apt-get remove gazebo*

After having done the uninstall, no Gazebo files will be in your system, neither the ROS related packages. Let’s now install the new Gazebo 9.

Update the repository
You will need to add the osrfoundation repo to your Linux package system in order to get the new packages of Gazebo.

sudo sh -c ‘echo “deb http://packages.osrfoundation.org/gazebo/ubuntu-stable lsb_release -cs main” > /etc/apt/sources.list.d/gazebo-stable.list’
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -

Then update the repo of packages:

sudo apt-get update

The integration of Gazebo with ROS is performed by means of the series of ros-<ROS_VERSION>-gazebo9 packages. The list of ROS – Gazebo packages that OpenRobotics is usually offering is the following (where in our cas, we used ROS_VERSION=kinetic):

ros-kinetic-gazebo9-dev
ros-kinetic-gazebo9-plugins
ros-kinetic-gazebo9-ros-control
ros-kinetic-gazebo9-msgs
ros-kinetic-gazebo9-ros
ros-kinetic-gazebo9-ros-pkgs

Install Gazebo 9
A very simple command will do it:

sudo apt-get install ros-kinetic-gazebo9-*

That command will install all dependencies. To test if everything is properly working, just type:

gazebo

A window like the this should appear on your screen.

Read more in the original post: www.theconstructsim.com (published on May 4, 2018)