Gazebo logo

Working with Player

The Player device server treats Gazebo in exactly the same way that it treats real robot hardware: as a device that is a source of data and a sink for commands. A key advantage of this approach is that users may mix Player abstract drivers with simulation drivers. Thus, for example, drivers such as VFH (Vector Field Histogram) and AMCL (adapative Monte-Carlo localization), will work equally well with simulated and real robots. In the following sections, we describe some basic scenarios that demonstate this interaction.

Gazebo interacts with Player through a plugin driver, libgazeboplugin, located in the player directory within the Gazebo source. In order for all this work, first start Gazebo and the run Player using an appropriate configuration file.

Setting up the Simulation

The basic steps for setting up and running a combined Player/Gazebo simulation are as follows.

Note that Gazebo must be started before the Player server, and that the Player server must re-started whenever Gazebo is re-started.

Example: Using a Single Robot

Consider the case of a single robot with a scanning laser range-finder. The following Gazebo world file snippet will create a Pioneer2DX robot with SICK~LMS200 laser.

  <model:Pioneer2DX>
    <id>robot1</id>
    <xyz>0 0 0.200</xyz>
    <model:SickLMS200>
      <id>laser1</id>
      <xyz>0.0 0.0 0.00</xyz>
    </model:SickLMS200>
  </model:Pioneer2DX>

The corresponding snippet of the Player 2.0 configuration file should look like this:

driver
(
  name "gazebo"
  provides ["simulation:0"]
  plugin "libgazeboplugin"
  server_id "default"
)

driver
(
  name "gazebo"
  provides ["position2d:0"]
  gz_id "robot1"
)

driver
(
  name "gazebo"
  provides ["laser:0"]
  gz_id "laser1"
)

To run this simulation, start Gazebo with:

  $ gazebo <myworld>

where <myworld> is the name of the Gazebo world file, and start Player with

  $ player <myconfig>

where <myconfig> is the name of the Player configuration file. Client programs can connect to the simulated devices devices on the default Player port 6665.

Example: Using a Single Robot with the VFH driver

Abstract devices can be mixed freely with simulated devices in the Player server. Thus, for example, it is possible to use the VFH (Vector Field Histogram) driver with a simulated robot. The following Gazebo world file snippet will create a Pioneer2DX robot with SICK~LMS200 laser.

  <model:Pioneer2DX>
    <id>robot1</id>
    <xyz>0 0 0.200</xyz>
    <model:SickLMS200>
      <id>laser1</id>
      <xyz>0.0 0.0 0.00</xyz>
    </model:SickLMS200>
  </model:Pioneer2DX>

The corresponding snippet of the Player configuration file should look like this:

driver
(
  name "gazebo"
  provides ["simulation:0"]
  plugin "libgazeboplugin"
  server_id "default"
)

driver
(
  name "gazebo"
  provides ["position2d:0"]
  gz_id "robot1"
)

driver
(
  name "gazebo"
  provides ["laser:0"]
  gz_id "laser1"
)

  driver
  (
    name "vfh"
    provides ["position:1"]
    requires ["position:0" "laser:0"]
  )

Note that the configuration file is exactly as per the first example; we have simply added another device to the Player server. The VFH driver will use the simulated robot chassis and laser exactly as it would a real robot chassis and laser.

To run this simulation, start Gazebo with:

  $ gazebo <myworld>

where <myworld> is the name of the Gazebo world file, and start Player with

  $ player <myconfig>

where <myconfig> is the name of the Player configuration file. Client programs can connect to the server on the default Player port 6665.

Example: Using Multiple Robots

There are a number of ways to work with multiple robots. The simplest way is to use multiple instances of the Player server (one for each robot being simulated). The following Gazebo world file snippet will create a pair of Pioneer2DX robots with SICK~LMS200 lasers.

  <model:Pioneer2DX>
    <id>robot1</id>
    <xyz>0 0 0.200</xyz>
    <model:SickLMS200>
      <id>laser1</id>
      <xyz>0.0 0.0 0.00</xyz>
    </model:SickLMS200>
  </model:Pioneer2DX>

  <model:Pioneer2DX>
    <id>robot2</id>
    <xyz>1.0 0 0.200</xyz>
    <model:SickLMS200>
      <id>laser2</id>
      <xyz>0.0 0.0 0.00</xyz>
    </model:SickLMS200>
  </model:Pioneer2DX>

Since there will be two instances of the Player server, two different configuration files are required. For the first robot:

driver
(
  name "gazebo"
  provides ["simulation:0"]
  plugin "libgazeboplugin"
  server_id "default"
)

driver
(
  name "gazebo"
  provides ["position2d:0"]
  gz_id "robot1"
)

driver
(
  name "gazebo"
  provides ["laser:0"]
  gz_id "laser1"
)

and for the second robot:

driver
(
  name "gazebo"
  provides ["simulation:0"]
  plugin "libgazeboplugin"
  server_id "default"
)

driver
(
  name "gazebo"
  provides ["position2d:0"]
  gz_id "robot2"
)

driver
(
  name "gazebo"
  provides ["laser:0"]
  gz_id "laser2"
)


Note that these files are identical apart from the gz_id property. In general, however, the simulated robots may be heterogeneous, in which case the Player configuration files will differ substantially.

To run this simulation, start Gazebo with:

  $ gazebo <myworld>

where <myworld> is the name of the Gazebo world file, and start two instances of Player with

  $ player -p 7000 <myconfig1>

and

  $ player -p 7001 <myconfig2>

where <myconfig1> and <myconfig2> are the two Player configuration files. Client programs can connect to the robots robot1 and robot2 through ports 7000 and 7001, respectively.


Last updated 12 September 2005 21:38:45