next up previous contents
Next: 4.2 Defining new device Up: 4. Configuration Files Previous: 4. Configuration Files   Contents

4.1 Basic Syntax

Player's configuration file syntax is very similar to that of Stage (in fact, they use the same parser and much of the following text is adapted from the Stage User Manual). A simple configuration file might look like this:
# The file configures Player to control a Pioneer 2-DX equipped 
# with a gripper and a Sony pan-tilt-zoom camera.

position:0 ( driver "p2os_position" )
sonar:0 ( driver "p2os_sonar" )
gripper:0 ( driver "p2os_gripper" )
ptz:0 ( driver "sonyevid30" )
This example shows the basic syntactic features of the configuration file format: comments, devices, indices, and properties.

Comments are indicated by the # symbol; they may be placed anywhere in the file and continue to the end of the line. For example:

# This file configures Player for a Pioneer robot
Devices are indicated using interface ( ... ) entries; each such entry instantiates a device with interface interface. For example:
position:0 ( ... )
creates a device with a position interface (e.g., a mobile robot). The list of available interfaces is given in Chapter 6.

Player can concurrently control multiple devices with the same interface, and they are differentiated by indices. When instantiating a device, its index is indicated with a colon and number syntax. For example

ptz:1 ( ... )
creates a pan-tilt-zoom device that will be identified with index 1. If the index is not specified, then an index of 0 is assumed. Indices need not be consecutive, but for a given interface, they must be unique. If multiple devices are declared with the same interface and index, then the one that is declared last will replace the others.

Devices have properties, indicated using name value pairs:

position:0 ( driver "p2os_position" port "/dev/ttyS0" )
This entry creates a position device using the driver p2os_position; that driver will control the underlying robot hardware via the serial port /dev/ttyS0. Property values can be either numbers (6665), strings (indicated by double quotes "robot1") or tuples (indicated by brackets [1 1 0]).

There are two special properties, which can be supplied for any device:

Name Type Default Meaning
driver string varies Selects which driver will be loaded for this interface. If no driver is given for a device, then the default driver for the interface will be used. Default drivers for each interface are given in Chapter 6.
alwayson integer 0 Tells the server to subscribe to the device when the server starts up. You might use this to frontload startup time for drivers that take a while to start (e.g., acts), to start a device that will never have any direct clients (e.g., a name service), or for testing a driver without the need to connect a client.
The remaining driver-specific properties and their defaults are given in Chapter 7.

next up previous contents
Next: 4.2 Defining new device Up: 4. Configuration Files Previous: 4. Configuration Files   Contents