All about Gazebo ROS (Gazebo 9)

Gazebo_ROS_Gazebo9_COVER

Written by Ricardo Tellez

04/05/2018

Let’s see how to install Gazebo 9 simulator to work with your ROS system. 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 ROS (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 distro, the same command applies to all the distributions to remove the default Gazebo installation:

$ sudo apt-get remove ros-ROS_DISTRO-gazebo*
$ sudo apt-get remove libgazebo*
$ sudo apt-get remove gazebo*

(replace ROS_DISTRO by your distro name.

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 case, 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.

Gazebo_ROS_install_gazebo

Gazebo 9 robot simulator start screen

[irp posts=”8825″ name=”Launching Husarion ROSbot navigation demo in Gazebo simulation”]

Testing Gazebo with a battery of ROS based simulations

So if you are reading this post is because you are interested in the combo Gazebo / ROS. And your next question should be: will this new version work with our previously working ROS based simulations? The answer to that question is… it depends. It depends for which Gazebo version your simulation was made, and which parts of Gazebo does that simulation use. We have done the following experiments with some of our simulations.

Testing with a robotic arm simulation

Let’s do a simple example: let’s launch a Wam arm robot, which includes several models, a kinect, a laser and an arm robot with joint controllers. The simulation was created for Gazebo 7.x

First, you need to create a catkin_ws:

$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws
$ catkin_make

You can clone and compile the Wam simulation from The Construct public simulations repo with the following commands:

$ cd ~/catkin_ws/src
$ git clone https://TheConstruct@bitbucket.org/theconstructcore/iri_wam.git -b kinetic
$ cd ..
$ catkin_make
$ roslaunch iri_wam_gazebo main.launch

The result is the simulation running just showing some warnings related to xacro namespace redefinitions.

inconsistent namespace redefinitions for xmlns:xacro:
 old: http://ros.org/wiki/xacro
 new: http://www.ros.org/wiki/xacro (/home/ricardo/catkin_ws/src/iri_wam/iri_wam_description/xacro/iri_wam_1.urdf.xacro)

That warning can be resolved by changing in all the affected files, the xacro definition from this:

xmlns:xacro="http://ros.org/wiki/xacro"

to this:

xmlns:xacro="http://www.ros.org/wiki/xacro"

There was no problem executing any of those. Bear in mind that it includes joint controllers as well as a couple of sensor plugins. So no modification was required in the simulation (remember, originally created for Gazebo 7.x).

Gazebo ROS Gazebo9 simulation Wam robot ros

Gazebo 9 simulation of the Wam robot with ROS

Testing with a wheeled robot simulation

Next simulation we tested was the Summit XL robot simulation by Robotnik. We used the following commands:

$ cd ~/catkin_ws/src 
$ git clone https://TheConstruct@bitbucket.org/theconstructcore/summit_xl.git -b kinetic
$ cd ..
$ catkin_make

In this case, we also had no problem when launching the simulation with the following command:

$ roslaunch sumit_xl_course_basics main.launch
Gazebo ROS Gazebo9 Summit XL robot simulation

Summit XL robot simulation running in Gazebo 9

Testing with a full environment simulation

In this case, we decided to test a simulation created by the Gazebo team themselves, which they used for a competition and that was created for Gazebo 8. It is also an interesting simulation because includes a complete biped robot with several sensors, in a full office environment with people moving around, and plenty of stuff. Have a look at it here.

$ cd ~/catkin_ws/src 
$ hg clone https://TheConstruct@bitbucket.org/osrf/servicesim  
$ cd .. 
$ catkin_make
$ roslaunch servicesim servicesim.launch

The simulation worked nicely off-the-shelf.

Gazebo ROS ServiceSim Gazebo9

ServiceSim running in Gazebo 9

Gazebo ROS ServiceSim Gazebo9 robot

ServiceSim running in Gazebo 9

Gazebo ROS Rviz data produced by ServiceSim in Gazebo 9

Rviz showing the data produced by ServiceSim in Gazebo 9

Problems when working with ROS with Gazebo 9

Gazebo is still and will always be a standalone program completely independent from ROS. This makes the work between them is not as smooth as it could be.

No ROS controllers provided

One of the problems I see with Gazebo 9 when working with ROS is that Gazebo provides a lot of interesting robot models through their Ignition Fuel library. However, none of the models includes the ROS controllers. So in case that you want to use the models for a ROS based situation, you need to create the controllers by yourself. One example of this case is the beautiful simulation of the autonomous car environment created by the Gazebo team. The simulation is perfect for a work with autonomous cars, but the only support it has is for Gazebo topics.

Use of SDF format instead of URDF

An additional problem with the models is that they have been created in SDF format. SDF is the default format for creating models and whole simulations in Gazebo 9, but that format is not supported by ROS. This makes more difficult to use the models in Gazebo + ROS simualtions since ROS requires a URDF description of the model to show it on Rviz. (just in case you want to convert SDF models into URDF, check the following tutorial about it).

 

You may be thinking why to use then SDF instead of URDF for defining the simulations. One of the reasons for using SDF in Gazebo instead of URDF (as indicated by Louise Poubel in this interview of the ROS Developers Podcast) is that SDF overcomes some of the limitations of URDF, like for example the creation of closed loops in a robot model. URDF does not allow to create a robot that has a kinematic chain that splits into two at some point and then unite again. SDF handles that with easy. Watch this video to understand the problem:

Based on that, could it be that the most convenient solution would be to change ROS to support SDF instead of changing Gazebo to support URDF?

[irp posts=”9004″ name=”My Robotic Manipulator – Part #1 – Basic URDF and RViz”]

What about ROS plugins?

The ROS plugins for Gazebo 9 are the plugins that provide the access to the different sensors and actuators and other functionalities of the simulator through a ROS interface. ROS plugins packages are provided as a different set of ROS packages from the main Gazebo 9 distribution. Usually, those packages are provided some weeks after the new Gazebo version has been released. The good new is that those packages for Gazebo 9 are already available (good job Jose Luis Rivero 😉 and you already installed them at the beginning of this post.

If you where using standard plugins provided by ROS in your simulations, it is very likely that they will still work off-the-shelf. On the other side, if you have created your own plugins using the Gazebo API for that, chances are that they may not work and may need to adapt small changes done in the plugins API.

Conclusion

With Gazebo 9, the simulator reaches a very mature version were quite detailed simulations can be created. Just check for example the impressive simulation created by OSRF of an autonomous cars environment.  Every new version we find new features, but more important than that, we find more stability (that is, less crashes).

If you want to know what features will be included in the future versions of Gazebo and when are they going to be released, just check the Gazebo roadmap.

Related and useful links




Masterclass 2023 batch2 blog banner

Check Out These Related Posts

129. ros2ai

129. ros2ai

I would like to dedicate this episode to all the ROS Developers who believe that ChatGPT or...

read more

15 Comments

  1. Ricardo Angeli

    Is there a way to install both Gazebo 7 and Gazebo 9 and be able to switch between them?

    Reply
    • Ricardo Tellez

      Not that I’m aware off. I imagine that could be done, but if you want to use Gazebo with ROS that is going to be a mess because you will need to have all the ROS-Gazebo package for each version installed. If possible, I suspect it will be difficult to work with

      Reply
  2. Mitch Pryor

    The html is showing up in your command instructions above.

    Reply
  3. Cyril_J

    Hi,
    Thanks for the article!
    The command “sudo apt-get remove ros-<ROS_VERSION>-gazebo*” isn’t working for me on Ubuntu 16.04 with ROS Kinetic installed:

    sudo apt-get remove ros-<ROS_VERSION>-gazebo*
    [2] 15120
    Usage: lt `parameters’ [versionkey]
    computes the n-point one-loop integrals
    n depends on `parameters’:
    n = 1: m
    n = 2: p m1 m2
    n = 3: p1 p2 p1p2 m1 m2 m3
    n = 4: p1 p2 p3 p4 p1p2 p2p3 m1 m2 m3 m4
    n = 5: p1 p2 p3 p4 p5 p1p2 p2p3 p3p4 p4p5 p5p1 m1 m2 m3 m4 m5
    versionkey can be one of:
    0 = compute version a (same as no versionkey)
    1 = compute version b
    2 = compute a and b, compare, return a
    3 = compute a and b, compare, return b
    [3] 15122
    gt: error: neither tool nor script specified; option -help lists possible tools
    Reading package lists… Done
    ROS_VERSION: command not found
    -gazebo*: command not found
    [3]- Exit 127 ROS_VERSION
    Building dependency tree
    Reading state information… Done
    Package ‘ros’ is not installed, so not removed

    And when I try to do “sudo apt-get remove ros-kinetic-gazebo*”, it tels me that it will uninstall:
    The following packages will be REMOVED:
    ros-kinetic-desktop-full ros-kinetic-gazebo-dev ros-kinetic-gazebo-msgs
    ros-kinetic-gazebo-plugins ros-kinetic-gazebo-ros
    ros-kinetic-gazebo-ros-control ros-kinetic-gazebo-ros-pkgs
    ros-kinetic-simulators

    But I don’t want to remove “ros-kinetic-desktop-full”, is it going to uninstall ROS Kinetic completely ?

    Reply
  4. Coolkid

    Hello, i have some problem with:
    roslaunch iri_wam_gazebo main.launch

    RLException: [main.launch] is neither a launch file in package [iri_wam_gazebo] nor is [iri_wam_gazebo] a launch file name
    The traceback for the exception was written to the log file
    Can you help me?

    Reply
  5. Dileep

    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package ros-kinetic-gazebo9-*
    E: Couldn’t find any package by glob ‘ros-kinetic-gazebo9-*’
    E: Couldn’t find any package by regex ‘ros-kinetic-gazebo9-*’

    Reply
    • abraham

      I’m having same problem please can any body about this

      Reply
    • fozzy

      Those packages do not show up for Ubuntu 16.x (Xenial), so you will have to hunt them down to build from source or upgrade to Ubuntu 18 (I’m trying the former and so far it’s a pain). If you are going to make that level of effort, it may be best to upgrade to melodic as well, which I am currently considering.

      Reply
  6. Yeoh

    Hi,

    Here I’m facing the problem while adding osrfoundation repo to my linux package system. Said the permission is denied, is there any solution for this.
    Your kind of helps is much appreciated~

    Thanks.

    Reply
    • Ricardo Tellez

      You need to use ‘sudo’ to add the repos. You will be asked for the admin password of your system

      Reply
  7. bjh

    There is a missing right angle bracket ( > , I don’t know this will be shown because of html tags or something. ) in the update repository part.

    Reply
  8. Amiya

    I am facing the same issue as Dileep and Abraham reported above. I am on ubuntu 18.04. It looks like kinetic packages are not part of this. Need to know if kinetic can be used with ubuntu 18.04, It appears downgrading to gazebo7 is not feasible.

    Reply
  9. Vivek

    The error I’m getting is: Could not find a package configuration file provided by “effort_controllers” with any of the following names:
    effort_controllersConfig.cmake
    effort_controllers-config.cmake
    Add installation prefix of “effort_controllers” to CMAKE_PREFIX_PATH or set “effort_controllers_DIR” to a directory containing one of the above files. If “effort_controllers” provides a separate development package or SDK, be sure it has been installed.

    Reply
  10. Ninaad Damis

    I had the same problem faced by Dileep and Abraham. I solved it using the following steps from the website below –

    http://gazebosim.org/tutorials?cat=install&tut=install_ubuntu&ver=9.0

    1. First, complete the first two steps given under ‘ Alternative Installation – step by step .
    2. $ sudo apt-get update
    3. $ sudo apt-get install ros-kinetic-gazebo9-*

    Using these steps, I was able to get Gazebo9 working on ROS kinetic.

    Reply

Submit a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest

Share This