On 3/18/2012 6:19 AM, Daniel Puppe wrote:


I try to write a plugin driver for a robot which provices a position2d Interface. I would like to run simulation where this robot is displayed. The robot position in the simulation should be provided by my plugin driver. For testing the y-position is increased in a loop. But the main () function of my driver is never performed. I think something is wrong with my *cfg and *world file. I tried to find out the erro for three evenings now, could you please help me?


I’m using Player 3.1.0.


Thanks, Daniel 



I think you're getting confused between Player and Stage drivers and capabilities.

In a Player config (.cfg) file, you can use a driver that isn't compiled into Player, via the plugin driver framework.  This is what the "plugin" option is for in the driver block.  It looks like that's what you're trying to do, and that also happens to be how Stage Stage interacts with Player (Stage provides a plugin driver for Player).  In your config file, you can see the first entry loads the "stage" driver from the "stageplugin" plugin library.  Stage is kind of a special case, in that any subsequent "stage" drivers in the config file are associated with the first driver block providing the "simulation:0" device.  The "plugin" field in all of these drivers is ignored.

When you load a plugin driver, the name of the driver in the config file has to match the name of the driver inside of your driver code's drivername_Register() function.  You used "faak".  That means, that a driver block that loads your driver will look like:

  name "faak"
  plugin "/path/to/faak_driver.so"
  provides ["position2d:0"]

So you can't use Stage to test a driver that will be interacting with real hardware.  They're separate, so that you can write one algorithm that subscribes to a position2d device, be it Stage or your real device, and will be able to get data and actuate hardware regardless of what's beneath the driver.

If you're trying to create a driver for a real device, you have a good start with the driver that you attached.  You can use the above config file snippet to start testing your driver, and use utilities like playerprint and playerv to monitor the output (i.e. make sure the data published over the position2d interface is what you expect.)

If you're trying to create a Stage controller, or an algorithm that Stage can load and use without involving Player, you should just start Stage with the worldfile, and look at the "ctrl" worldfile option, the examples in the ctrl/ folder of the Stage source, and skeleton Stage controller on github.

If you're trying to create an algorithm to control a robot, you can either keep going with the driver you're writing and have it require a position2d device and act on incoming position2d information, or you can use one of the Player client libraries to accomplish the same task (examples are in examples/ folder of the Player source).

Hope this helps!  Let us know if anything is unclear.  Also, do check out the tutorial page[1] on the wiki for more help.


[1] http://playerstage.sourceforge.net/wiki/Tutorials