Writing configuration files
From The Player Project
m (Reverted edits by 212.72.30.140 (Talk); changed back to last version by 130.107.66.231) |
(→Examples) |
||
Line 1: | Line 1: | ||
==Overview== | ==Overview== | ||
- | Player needs to know which drivers to instantiate and to which device addresses each should be bound. This information is usually specified in a Player configuration file (it can also be done directly from code by calling into [http://playerstage.sourceforge.net/doc/Player- | + | Player needs to know which drivers to instantiate and to which device addresses each should be bound. This information is usually specified in a Player configuration file (it can also be done directly from code by calling into [http://playerstage.sourceforge.net/doc/Player-svn/player/group__libplayercore.html libplayercore]). |
A Player configuration file is a text file that, by convention, has the extension .cfg. The file is composed of one or more driver sections, each of which instantiates and configures a single driver. Consider an example: | A Player configuration file is a text file that, by convention, has the extension .cfg. The file is composed of one or more driver sections, each of which instantiates and configures a single driver. Consider an example: | ||
Line 12: | Line 12: | ||
</pre> | </pre> | ||
- | This block instantiates the [http://playerstage.sourceforge.net/doc/Player- | + | This block instantiates the [http://playerstage.sourceforge.net/doc/Player-svn/player/group__driver__sicklms200.html sicklms200] driver. The provides keyword is used to specify the device address to which the driver will be bound. Using this configuration, an instance of the [http://playerstage.sourceforge.net/doc/Player-svn/player/group__driver__sicklms200.html sicklms200] driver will be available as laser :0. |
==Basic syntax== | ==Basic syntax== | ||
Line 36: | Line 36: | ||
* '''name''' (string) : The name of the driver to instantiate, as it was provided to DriverTable::AddDriver(). This option is mandatory. | * '''name''' (string) : The name of the driver to instantiate, as it was provided to DriverTable::AddDriver(). This option is mandatory. | ||
- | * '''plugin''' (string) : The name of a shared library (i.e., a "plugin") that contains the driver. This shared library will be loaded before attempting to instantiate the driver. See Writing a Player driver for more information on writing and using driver plugins. | + | * '''plugin''' (string) : The name of a shared library (i.e., a "plugin") that contains the driver. This shared library will be loaded before attempting to instantiate the driver. See [[Writing a Player driver]] for more information on writing and using driver plugins. If you are using a built-in driver, you do not need to use this option. |
* '''provides''' (tuple of strings): The device address(es) through which the driver can be accessed. This option is mandatory. | * '''provides''' (tuple of strings): The device address(es) through which the driver can be accessed. This option is mandatory. | ||
* '''requires''' (tuple of strings): The device address(es) to which the driver will subscribe. | * '''requires''' (tuple of strings): The device address(es) to which the driver will subscribe. | ||
===provides=== | ===provides=== | ||
- | Most drivers (e.g., [http://playerstage.sourceforge.net/doc/Player- | + | Most drivers (e.g., [http://playerstage.sourceforge.net/doc/Player-svn/player/group__driver__sicklms200.html sicklms200]) support a single interface. Thus their provides value is a tuple containing a single string. |
- | Some drivers support multiple interfaces. For example, the [http://playerstage.sourceforge.net/doc/Player- | + | Some drivers support multiple interfaces. For example, the [http://playerstage.sourceforge.net/doc/Player-svn/player/group__driver__amcl.html amcl] driver supports the [http://playerstage.sourceforge.net/doc/Player-svn/player/group__interface__localize.html localize] and the [http://playerstage.sourceforge.net/doc/Player-svn/player/group__interface__position2d.html position2d] interfaces, so its provides line might look like this: |
<pre> | <pre> | ||
provides ["localize:0" "position2d:0"] | provides ["localize:0" "position2d:0"] | ||
Line 53: | Line 53: | ||
Most drivers (e.g., sicklms200) don't need any other devices to do their work. Thus no requires option is given. | Most drivers (e.g., sicklms200) don't need any other devices to do their work. Thus no requires option is given. | ||
- | Some drivers require other devices. For example, the [http://playerstage.sourceforge.net/doc/Player- | + | Some drivers require other devices. For example, the [http://playerstage.sourceforge.net/doc/Player-svn/player/group__driver__vfh.html vfh] driver, a local navigation / obstacle-avoidance algorithm, needs two devices: a [http://playerstage.sourceforge.net/doc/Player-svn/player/group__interface__position2d.html position2d] device to command and a laser device from which to read laser scans. This driver in turn provides a [http://playerstage.sourceforge.net/doc/Player-svn/player/group__interface__position2d.html position2d] device to which target poses can be sent. So the vfh driver might be configured like so: |
<pre> | <pre> | ||
driver | driver | ||
Line 109: | Line 109: | ||
</pre> | </pre> | ||
That is, take input from position2d:0 and treat it as odometry, and take input from map:0 and treat is a laser map. No key necessary for laser:0, because amcl only supports one laser interface. | That is, take input from position2d:0 and treat it as odometry, and take input from map:0 and treat is a laser map. No key necessary for laser:0, because amcl only supports one laser interface. | ||
+ | |||
==Types== | ==Types== | ||
The following types are supported for option values: | The following types are supported for option values: | ||
Line 187: | Line 188: | ||
==Examples== | ==Examples== | ||
- | The Player source code has a bunch of examples under the | + | * The Player source code has a bunch of examples under the [http://playerstage.svn.sourceforge.net/playerstage/code/player/trunk/config config/] directory |
+ | * [http://www.eng.upm.edu.my/~kmbs/files/hacks/hardware/robot/playerstage/index.html khepera.cfg] - Configuration file for [http://en.wikipedia.org/wiki/Khepera_mobile_robot khepera] mobile robot | ||
+ | |||
+ | [[Category:Documentation]] | ||
+ | [[Category:Tutorials]] |