Getting started with Gazebo

I don’t actually own a robot (and they don’t come cheap) so the next best thing is a simulator. Gazebo is open source robot simulation software that interfaces nicely with ROS and supports a library of robot models and environments. Gazebo supports Collada (.dae), 3D Systems (.stl), Wavefront (.obj), and W3C SVG (.svg) file formats for custom shapes/meshes. The model is built using the SDF format which uses XML.  If you’ve ever used CAD software (e.g. AutoCAD or SolidWorks) it should be straightforward getting started.

Tutorial tips

Here’s how to learn Gazebo quickly:

  • Install blender (used to extract meshes).
  • Install freecad (used to convert Gazebo file format to the one used by blender).
  • Complete the beginner and intermediate guided tutorials on the official page.

These tutorials cover how the editor works, building your own 3D models from 2D Inskscape drawings, creating structural models using the building editor (from say a 2D laser scan of a building), building sensors from specifications, connecting to ROS and much more. The building editor can be rather stressful to use because there is no Undo functionality, however it does the job for 3D visualisation.

One thing I like about Gazebo is how easy it is to share your models with the community by contributing to the Gazebo online database. This is a simple Git repository you can submit a pull request to and have your model uploaded.

The model editor tutorial shows you how to build a simple wheeled robot with a depth sensor as shown below. The robot drives towards the block, detects it and then stops.


My first simple Gazebo robot simulation. This is from the Model Editor beginner tutorial.

A very nice feature of Gazebo is the ability to simulate real world sensors. This can be done by specifying the sensor characteristics (usually available from the datasheet) as an  SDF model in a world file. SDF is written in XML with tags to define the world, scene, physics, lighting, actor, model, link, joint, collision, material visual and geometry.

The simulation image below shows a Velodyne sensor model before and after adding a mesh. Gaussian noise was used to produce the bottom figure (you can see that there is error in the readings where the rays hit the block).


One of the most powerful features of Gazebo is the plugin. A plugin is C++ code that’s compiled into a shared library that can be used to control the simulation (accessing sensor data, moving objects around etc.). Plugins can are designed to be modular and to be shared easily. They bring models to life.

What to do when Gazebo freezes

Gazebo sometimes doesn’t throw any error messages if it can’t find a path referenced in the model.sdf file (for example in the tag). I encountered this error when I had named my directory incorrectly (the name did not match the one in the tag). Fixing the name sorted out this issue. Running gazebo with verbosity can also help with debugging errors.

Alternatives to Gazebo

There are several other popular robot simulation software packages. For simulating robotic arms MoveIt! is a nice alternative with support for quite of lot of industry robots. Another alternative is V-REP which interfaces nicely with ROS nodes.

How is Gazebo different to rviz?

rviz is the ROS native 3D visualisation environment, that is similar to Gazebo. It lets you see what the robot is seeing (perception from the robot’s perspective) and add markers as well which is very useful for debugging robot applications.

One thought on “Getting started with Gazebo

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s