Dear Nate:
I think I may have stumbled upon another issue with the Gazebo Simulation
Interface. It seems that some sort of race condition appears if multiple
Simulation Interface proxies are trying to get and set poses of models at the
same time. I have included the source for a simple app that demonstrates the
problem. With gazebo and player running, start the application without any
command-line arguments and then start a second instance of the executable with
a non-zero number of command-line arguments. This creates one proxy that
performs GetPose2d requests and another that performs SetPose2d requests both
at about 10Hz (the player read rate). Depending on the timing, you will see
one of two possible outcomes. Either the GetPose2d instance will hang or the
SetPose2d instance will segfault with an error of:
"playerc error : got the wrong kind of reply (not good).
terminate called after throwing an instance of 'PlayerCc::PlayerError'
Aborted"
Sometimes when the GetPose2d instance freezes, a "playerc warning : warning
: Discarding unclaimed ACK" message will appear in the console of the SetPose2d
instance. I am using Player-2.1.1.
Sandy
App:
#include <stdio.h>
#include <libplayerc++/playerc++.h>
int main(int argc, char ** argv){
double x = 0, y = 0, a = 0;
long count = 0;
bool bGet = true;
PlayerCc::PlayerClient playerClient("localhost", 6665);
PlayerCc::SimulationProxy simulation(&playerClient, 0);
PlayerCc::Position2dProxy position(&playerClient, 0);
if(argc > 1) bGet = false;
if(bGet) printf("Entering Getting mode.\n");
else printf("Entering Setting mode.\n");
while(1){
playerClient.Read();
if(bGet) simulation.GetPose2d((char*)"animal_model", x, y, a);
else simulation.SetPose2d((char*)"pioneer2dx_model1", x, y, a);
printf("%li - Current pose is: %lf, %lf, %lf.\n", count++, x, y, a);
}
return(0);
}
player cfg:
driver
(
name "gazebo"
provides ["simulation:0"]
plugin "/home/freedmst/local/gazebo/lib/libgazeboplugin"
server_id "default"
)
driver
(
name "gazebo"
provides ["position2d:0"]
gz_id "position_iface_0"
)
driver
(
name "gazebo"
provides ["laser:0"]
gz_id "laser_iface_0"
)
driver
(
name "gazebo"
provides ["fiducial:0"]
gz_id "fiducial_iface_0"
)
worldfile:
<?xml version="1.0"?>
<gazebo:world
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:gazebo="http://playerstage.sourceforge.net/gazebo/xmlschema/#gz"
xmlns:model="http://playerstage.sourceforge.net/gazebo/xmlschema/#model"
xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
xmlns:window="http://playerstage.sourceforge.net/gazebo/xmlschema/#window"
xmlns:param="http://playerstage.sourceforge.net/gazebo/xmlschema/#param"
xmlns:body="http://playerstage.sourceforge.net/gazebo/xmlschema/#body"
xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom"
xmlns:joint="http://playerstage.sourceforge.net/gazebo/xmlschema/#joint"
xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
xmlns:ui="http://playerstage.sourceforge.net/gazebo/xmlschema/#ui"
xmlns:rendering="http://playerstage.sourceforge.net/gazebo/xmlschema/#rendering"
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
xmlns:physics="http://playerstage.sourceforge.net/gazebo/xmlschema/#physics"
>
<verbosity>5</verbosity>
<physics:ode>
<stepTime>0.03</stepTime>
<gravity>0 0 -9.8</gravity>
<cfm>10e-5</cfm>
<erp>0.3</erp>
</physics:ode>
<rendering:gui>
<type>fltk</type>
<size>800 600</size>
<pos>0 0</pos>
<xyz>0 0 10</xyz>
<rpy>0 0 0</rpy>
<frames>
<row height="100%">
<camera width="100%">
<xyz>0 0 24</xyz>
<rpy>0 90 0</rpy>
</camera>
</row>
</frames>
</rendering:gui>
<rendering:ogre>
<ambient>0.5 0.5 0.5 1.0</ambient>
</rendering:ogre>
<!-- Ground Plane -->
<model:physical name="plane1_model">
<xyz>0 0 0</xyz>
<rpy>0 0 0</rpy>
<static>true</static>
<body:plane name="plane1_body">
<geom:plane name="plane1_geom">
<normal>0 0 0.5</normal>
<size>2000 2000</size>
<segments>10 10</segments>
<uvTile>100 100</uvTile>
<material>Gazebo/Grey</material>
</geom:plane>
</body:plane>
</model:physical>
<model:physical name="wall1">
<xyz>0 10 0.5</xyz>
<include embedded="true">
<xi:include href="models/wall18.model"/>
</include>
</model:physical>
<model:physical name="wall2">
<xyz>0 -10 0.5</xyz>
<include embedded="true">
<xi:include href="models/wall18.model"/>
</include>
</model:physical>
<model:physical name="wall3">
<xyz>9 0 0.5</xyz>
<rpy>0 0 90</rpy>
<include embedded="true">
<xi:include href="models/wall20.model"/>
</include>
</model:physical>
<model:physical name="wall4">
<xyz>-9 0 0.5</xyz>
<rpy>0 0 90</rpy>
<include embedded="true">
<xi:include href="models/wall20.model"/>
</include>
</model:physical>
<model:physical name="wall5">
<xyz>4 -6 0.5</xyz>
<rpy>0 0 90</rpy>
<include embedded="true">
<xi:include href="models/wall8.model"/>
</include>
</model:physical>
<model:physical name="wall6">
<xyz>-6 -6 0.5</xyz>
<rpy>0 0 90</rpy>
<include embedded="true">
<xi:include href="models/wall8.model"/>
</include>
</model:physical>
<model:physical name="wall7">
<xyz>2 -5 0.5</xyz>
<include embedded="true">
<xi:include href="models/wall4.model"/>
</include>
</model:physical>
<model:physical name="wall8">
<xyz>-4 -5 0.5</xyz>
<include embedded="true">
<xi:include href="models/wall6.model"/>
</include>
</model:physical>
<model:physical name="wall10">
<xyz>-8.5 -5 0.5</xyz>
<include embedded="true">
<xi:include href="models/wall1.model"/>
</include>
</model:physical>
<model:physical name="wall112">
<xyz>-8.5 4 0.5</xyz>
<include embedded="true">
<xi:include href="models/wall1.model"/>
</include>
</model:physical>
<model:physical name="wall13">
<xyz>-6 5 0.5</xyz>
<rpy>0 0 90</rpy>
<include embedded="true">
<xi:include href="models/wall9.model"/>
</include>
</model:physical>
<model:physical name="wall14">
<xyz>4.5 4 0.5</xyz>
<include embedded="true">
<xi:include href="models/wall10.model"/>
</include>
</model:physical>
<model:physical name="wall15">
<xyz>-4.5 4 0.5</xyz>
<include embedded="true">
<xi:include href="models/wall5.model"/>
</include>
</model:physical>
<model:physical name="wall16">
<xyz>4 3 0.5</xyz>
<rpy>0 0 90</rpy>
<include embedded="true">
<xi:include href="models/wall7.model"/>
</include>
</model:physical>
<model:physical name="wall17">
<xyz>4 9 0.5</xyz>
<rpy>0 0 90</rpy>
<include embedded="true">
<xi:include href="models/wall2.model"/>
</include>
</model:physical>
<model:physical name="package_model">
<xyz>-7.5 -9 0.5</xyz>
<canonicalBody>item0_body</canonicalBody>
<static>true</static>
<body:box name="item0_body">
<geom:box name="item0_geom">
<size>0.5 0.5 0.5</size>
<mass>0.01</mass>
<visual>
<mesh>unit_box</mesh>
<size>0.5 0.5 0.5</size>
<material>Gazebo/BumpyMetal</material>
</visual>
<laserFiducialId>0</laserFiducialId>
</geom:box>
</body:box>
</model:physical>
<model:physical name="responder_model">
<xyz>-7.5 9 0.5</xyz>
<canonicalBody>item1_body</canonicalBody>
<static>true</static>
<body:box name="item1_body">
<geom:box name="item1_geom">
<size>0.5 0.5 0.5</size>
<mass>0.01</mass>
<visual>
<mesh>unit_box</mesh>
<size>0.5 0.5 0.5</size>
<material>Gazebo/BumpyMetal</material>
</visual>
<laserFiducialId>1</laserFiducialId>
</geom:box>
</body:box>
</model:physical>
<model:physical name="animal_model">
<xyz>8 7 0.5</xyz>
<canonicalBody>item2_body</canonicalBody>
<static>true</static>
<body:box name="item2_body">
<geom:box name="item2_geom">
<size>0.5 0.5 0.5</size>
<mass>0.01</mass>
<visual>
<mesh>unit_box</mesh>
<size>0.5 0.5 0.5</size>
<material>Gazebo/BumpyMetal</material>
</visual>
<laserFiducialId>2</laserFiducialId>
</geom:box>
</body:box>
</model:physical>
<model:physical name="victim_model">
<xyz>7 -9 0.25</xyz>
<canonicalBody>item3_body</canonicalBody>
<static>true</static>
<body:box name="item3_body">
<geom:box name="item3_geom">
<size>0.5 0.5 0.5</size>
<mass>0.01</mass>
<visual>
<mesh>unit_box</mesh>
<size>0.5 0.5 0.5</size>
<material>Gazebo/BumpyMetal</material>
</visual>
<laserFiducialId>3</laserFiducialId>
</geom:box>
<geom:box name="blood_model">
<xyz>0 .25 0</xyz>
<size>0.3 0.1 0.3</size>
<mass>0.01</mass>
<visual>
<mesh>unit_box</mesh>
<size>0.2 0.1 0.2</size>
<material>Gazebo/Red</material>
</visual>
<laserFiducialId>5</laserFiducialId>
</geom:box>
</body:box>
</model:physical>
<model:physical name="debris_model">
<xyz>-8.2 5.8 0.5</xyz>
<canonicalBody>item4_body</canonicalBody>
<static>true</static>
<body:box name="item4_body">
<geom:box name="item4_geom">
<size>0.5 0.5 0.5</size>
<mass>0.01</mass>
<visual>
<mesh>unit_box</mesh>
<size>0.5 0.5 0.5</size>
<material>Gazebo/BumpyMetal</material>
</visual>
<laserFiducialId>4</laserFiducialId>
</geom:box>
</body:box>
</model:physical>
<model:physical name="pioneer2dx_model1">
<xyz>0 0 0.145</xyz>
<rpy>0.0 0.0 0.0</rpy>
<controller:differential_position2d name="controller1">
<leftJoint>left_wheel_hinge</leftJoint>
<rightJoint>right_wheel_hinge</rightJoint>
<wheelSeparation>0.39</wheelSeparation>
<wheelDiameter>0.15</wheelDiameter>
<torque>5</torque>
<interface:position name="position_iface_0"/>
</controller:differential_position2d>
<model:physical name="laser">
<xyz>0.15 0 0.18</xyz>
<attach>
<parentBody>chassis_body</parentBody>
<myBody>laser_body</myBody>
</attach>
<include embedded="true">
<xi:include href="models/sicklms200.model" />
</include>
<sensor:ray name="laser_2">
<rayCount>361</rayCount>
<rangeCount>361</rangeCount>
<origin>0.05 0 0.0</origin>
<minAngle>-90</minAngle>
<maxAngle>90</maxAngle>
<controller:sicklms200_laser name="laser_controller">
<interface:laser name="laser_iface_1"/>
<interface:fiducial name="fiducial_iface_1"/>
</controller:sicklms200_laser>
</sensor:ray>
</model:physical>
<include embedded="true">
<xi:include href="models/pioneer2dx.model" />
</include>
</model:physical>
<!-- White Directional light -->
<model:renderable name="directional_white">
<light>
<type>directional</type>
<direction>0 -0.6 -0.4</direction>
<diffuseColor>1.0 1.0 1.0</diffuseColor>
<specularColor>0.2 0.2 0.2</specularColor>
<attenuation>1000 1.0 0.0 0</attenuation>
</light>
</model:renderable>
</gazebo:world>
--
[EMAIL PROTECTED]
www.sanfordfreedman.com
"I have yet to see any problem, however complicated, which, when you looked at
it in the right way, did not become still more complicated."
- Poul Anderson
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Playerstage-gazebo mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-gazebo