Using Player

This tutorial describes how to use Gazebo with Player.

The contents of this page include:


Gazebo is designed to mesh nicely with Player through libgazebo. Each libgazebo interface is exposed to player through Gazebo's Player plugin. The code for this plugin is found in gazebo/player.

This tutorial describes how to controll models in a Gazebo simulation using player.

Create the Gazebo World File

The first step is creation of the Gazebo world. Player can only hook into Gazebo when one or more controller and interfaces are present in the world. Each controller must contain at least one interface. The interface defines what commands the controller can receive, and what data the controller can publish.

For example, create a pioneer2dx_position2d controller for any Pioneer2dx robot that you wish to move around. Note that the name of a controller indicates what type of device it attempts to simulate. However, a controller's can be assigned to any type of robot. This flexibility allows models to be quickly created in XML, and utilize prebuilt controllers.

Here we have a Pioneer2dx model with a position controller and interface:

<model:physical name="pioneer2dx_model1">
  <xyz>1 0 0.25</xyz>
  <rpy>0.0 0.0 0.0</rpy>

  <controller:pioneer2dx_position2d name="controller1">
    <interface:position name="position_iface_1"/>

  <include embedded="true">
    <xi:include href="pioneer2dx.model" />

The most important attribute to notice is the name of the interface. In this example the name is "position_iface_1". This name will be used in a Player config file to indicate what interface Player should use when access Gazebo's position device.

Player's Config

Once the Gazebo world is built, we need to tell Player how to communicate with Gazebo's controllers. Continuing with the Pioneer2dx example, the Player config file would contain:

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

  name "gazebo"
  provides ["position2d:0"]
  gz_id "position_iface_1"

The first driver tells Player to load the libgazeboplugin, and that it provides a simulation interface. This section should always be present in the Player config file.

The second drive tells Player that Gazebo has a Position2d interface called "position_iface_1". This name must match an interface name in the Gazebo world file.

Running the Simulation and Player

At this point you have a Gazebo world file, and a Player configuration file. Now it's time to run everything.

First start the simulator:

$ gazebo worlds/

Now start player:

$ cd gazebo/player
$ player gazebo.cfg

Now test the connection using playerv:

$ playerv -h localhost

Playerv will allow you to connect to the position interface and move the robot around.

More Examples

Player can communicate with a wide range of devices, such as lasers, cameras, sonar, etc.

The gazebo/player contains an example Player configuration file called gazebo.cfg that provides examples to many of the playe devices.

The gazebo/worlds contains numberous example worlds which can be used with the gazebo/plaer/gazebo.cfg Player configuration file.

Last updated Aug 04 2007