All about Gazebo ROS (Gazebo 9)

All about Gazebo ROS (Gazebo 9)

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




Pin It on Pinterest