The Gazebo Simulator

The Gazebo Simulator

Gazebo is a new simulator that is compatible with Player/Stage. It allows multiple robots to be simulated in high-fidelity OpenGL, especially useful in outdoor scenes. The client side of Gazebo is Player again and is identical to the Pyro interface for Stage. Gazebo world files are very different, and come in two parts: the world file, and a config file. However, Pyro hides this complexity for the novice user.

This is how worlds look in Gazebo:

The World File

The world file is an XML file that describes all of the items in a world, including the robot, the lighting, objects, sky, and ground. Here is

<?xml version="1.0"?>
    <gravity>0.0 0.0 -9.8</gravity>
    <xyz>1 1 0</xyz>
    <color>0.0 1.0 0.0</color>
    <xyz>0 0 10</xyz>
    <xyz>-1.5 0.0 2.0</xyz>
    <rpy>0.0 30.0 0.0</rpy>
      <size>320 240</size>
      <xyz>0 0</xyz>
    <xyz>-0.35 0 0.25</xyz>
    <rpy>0 0 0</rpy>
    <xyz>-1.5 0.0 2.0</xyz>
    <rpy>0.0 30.0 0.0</rpy>
      <size>320 240</size>
      <xyz>0 0</xyz>
      <xyz>0.0 0 0.101</xyz>
      <xyz>2.0 0.0 0.35</xyz>
      <size>0.7 0.7 0.7</size>
      <color>1 0 0</color>

This world has two cameras: observercam1 and observercam2. However, one camera will be tied to the robot's location, and the other will remain fixed.

The world file also defines sonars and laser. You can see much more detail about this file format at: [WWW]The World File, from the Player/Stage/Gazebo people.

To connect onto a rendered world you also need a config file.

The Config File

In Pyro, a world's associated config file is in the same subdirectory, and has the same name as the world file, but with an appended ".cfg".

  driver "gz_position"
  gz_id "robot1"
  driver "gz_sonars"
  gz_id "sonars1"
  driver "gz_laser"
  gz_id "laser1"
  driver "gz_ptz"
  gz_id "usercam1"
  driver "gz_camera"
  gz_id "usercam1"

In this file, you define a robot just like you would in Player server files. Here, you must know the gz_id of an item which you get from the world file. You must also know the name of the driver, which you can get from the Gazebo Manual, in the section [WWW]Working with Player.

Pyro and Gazebo

You can create your own version of any Gazebo world file by selecting Server:, then GazeboSimulator, then highlight the world you would like to copy and click on the My Copy button. This will copy both the world and config file to your home directory, and open up Emacs (by default) with both files ready to be edited.

When you have made your changes, simple select Server:, then GazeboSimulator, then click the Home button on the top right of the file dialog window. Then select your version of the copied world.


Exercise 1: create a 3D world just like the tutorial world in the Pyrobot and Stage Simulator sections.

Exercise 2: Team up with a partner, and create a world with two robots in it, a maze, and a colored object. Position your robots an equal distance from the object. Then each of you start Pyro (on the same computer, or different ones if you don't have a firewall) and with the brain, each race to see who can get to the colored object first.

Next: The Robocup Simulator Up: Robot Simulators