Thanks you very much Rich.
I have been looking for a solution in the forum without being able to find it yet.
I hope it can be solved.

Gonzalo

2011/2/1 Rich Mattes <jpgr87@gmail.com>
On 1/31/2011 1:46 PM, Gonzalo Fernando Perez Paina wrote:
> Hello,
> I am trying to use the fakelocalize driver to get the true position of
> a robot in Stage, but it gives me an error.
> I am using the simple.cfg and simple.world files of the examples.
> The Stage version is 3.2.2 and the Player version is 3.0.2.
> The simple.cfg have been modified to add the fakelocalize driver as
> follows
>
> driver
> (
>   name "stage"
>   provides [ "simulation:0" ]
>   plugin "stageplugin"
>
>   # load the named file into the simulator
>   worldfile "simple.world"
> )
>
> # Create a Stage driver and attach position2d and laser interfaces
> # to the model "r0"
> driver
> (
>   name "stage"
>   provides [ "position2d:0" ]
>   model "r0"
> )
>
> driver
> (
>   name "fakelocalize"
> #  provides [ "localize:0" ]
>   provides [ "localize:0" "position2d:1" ]
>   requires [ "simulation:0" ]
>   model "r0"
> #  alwayson 1
> )
>
> And the world file was changed the pioneer model definition as
> pioneer2dx
> (
>   # can refer to the robot by this name
>   name "r0"
>   pose [ -7 -7 0 45 ]
>   sicklaser()
>   # report error-free position in world coordinates
>   localization "odom"
>   odom_error [ 0.03 0.03 0.0 0.05 ]     # Odometry error or slip in X,
> Y and Theta
> )
> to generate odometry with error.
> With this scheme I want to compare the odometry with the true position
> of the robot.
>
> The fakelocalize driver gives the error
> error   : failed to get pose from simulation device
>
> Can some help me with this? What could be wrong?
> Thanks in advance.
> Gonzalo
>
>
> --
> Gonzalo F. Perez Paina
> Centro de Investigación en Informática para la Ingeniería, CIII.
> Universidad Tecnológica Nacional. Facultad Regional Córdoba.
> Maestro M. López esq. Cruz Roja Argentina. CP X5016ZAA
> gperez@scdt.frc.utn.edu.ar
> <mailto:gperez@scdt.frc.utn.edu.ar>ists.sourceforge.net/lists/listinfo/playerstage-users


I spent some time looking into this.  The StgDriver class in
libstageplugin derives itself from Player's Driver class.  It looks like
the StgDriver class is overloading the Player Driver class' Subscribe()
and Unsubscribe() methods.  In the Player Subscribe() and Unsubscribe()
calls, the class will increment and decrement a private variable called
"subscriptions", which is supposed to track whether or not a driver has
any active subscriptions.  This is important, because Player checks to
see if a threaded driver has any subscriptions when it handles a
Request() call.  If Player doesn't see any active subscriptions to a
driver, it won't bother completing the request and will a NULL message.

What I think is going on here is that fakelocalize is sending a
PLAYER_SIMULATION_REQ_GET_POSE2D request to libstageplugin's simulation
interface.  Player goes to send the request and wait for Stage's
response, but it sees that the Stage driver is returning no active
subscriptions.  It assumes that fakelocalize has unsubscribed from the
Stage driver, and just returns a NULL value for the response before
trying to wait for Stage's response.  Stage does eventually respond, but
at that point fakelocalize doesn't know what to do with the message (and
has already committed suicide by calling pthread_cancel()), so things
just hang.

I remember someone mentioning that you can patch Player to think that
it's not sending threaded replies, and things start to work again.  I
think this is the same issue, as a non-threaded request doesn't have the
subscription count check.

I haven't found a solution yet, but I'm working on it.

Rich


------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Playerstage-users mailing list
Playerstage-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-users



--
Gonzalo F. Perez Paina
Centro de Investigación en Informática para la Ingeniería, CIII.
Universidad Tecnológica Nacional. Facultad Regional Córdoba.
Maestro M. López esq. Cruz Roja Argentina. CP X5016ZAA
gperez@scdt.frc.utn.edu.ar