ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Teleporting robot via 'rosservice call /gazebo/set_model_state' produces weird behaviour

asked 2011-09-06 21:32:58 -0500

nitschej gravatar image

updated 2011-09-07 20:27:17 -0500

The problem appears with:

  • zero gravity worlds (<gravity>0 0 0</gravity>) OR models with gravity disabled (<enableGravity>false</enableGravity>)
  • AND models that use <attach> and <include> to include additional models (for example a pioneer2dx with attached sonyvid30)

What to do to make it happen: teleport your robot into some location above the ground, for example run

rosservice call /gazebo/set_model_state '{model_state: { model_name: pioneer2dx_model1, pose: { position: { x: 0, y: 0, z: .6 }, orientation: {x: 0, y: 0, z: 0, w: 0 } }, twist: { linear: {x: 0 , y: 0 ,z: 0 } , angular: { x: 0 , y: 0 , z: 0 } } }}'

What I would expect to happen: The robot appears in the specified location, peacefully floating there.

What actually happens: The robot does indeed appear in the specified location. But it is usually rotating wildly, sometimes also drifting away from its position

A good example is the pioneer2dx_camera.world which I think lives somewhere in most Gazebo installations. Just change the <gravity> specification to zero and try the rosservice call above.

The question is now: Is this a bug? Are there other workarounds known than to not use <attach> and <include> on models?

Edit: I actually use the Diamondback Ubuntu packages. So maybe this isn't relevant for newer versions.

An example, from the pioneer2dx_camera.world file, which shows the behavior :

<model:physical name="pioneer2dx_model1">
  <xyz>0 0 0.145</xyz>
  <rpy>0.0 0.0 0.0</rpy>
  <model:physical name="sonyvid30_model">
    <xyz>0.15 0 0.09</xyz>
    <attach>
      <parentBody>chassis_body</parentBody>
      <myBody>sonyvid30_body</myBody>
    </attach>
    <include embedded="true">
      <xi:include href="../models/sonyvid30.model" />
    </include>
  </model:physical>
  <include embedded="true">
    <xi:include href="../models/pioneer2dx.model" />
  </include>
</model:physical>

An example which does not show the behavior :

<model:physical name="pioneer2dx_model1">
  <xyz>1 1 0.145</xyz>
  <rpy>0.0 0.0 0.0</rpy>
  <include embedded="true">
    <xi:include href="../models/pioneer2dx.model" />
  </include>
</model:physical>

Any other models, that do not use the <attach>...</attach> + <include>...</include> tags are not affected, though I did not test all too many models. This is probably what you meant by "links".

Actually, when watching the "teleport operation" from a distance I can see what probably causes the spinning: The main body, for example the pioneer2dx_model1, appears at the new position instantly, but the attached body, for example the sonyvid30_model seems to remain at the old position for a very short time and then follows main body like it was attached with a rubber band or something the like. The ensuing impact then makes the robot spin and/or drift.

edit retag flag offensive close merge delete

Comments

Can you explain whether your robot has any links attached to it ? Does the behavior occur if you try to teleport different objects than the robot?
Dimitar Simeonov gravatar image Dimitar Simeonov  ( 2011-09-07 10:49:24 -0500 )edit
based on your latest observation, this is because set pose did not follow nested models. It's sounding very much like a bug for nested models. If the simulation was paused, can you check if the "set_model_state" service call only moves the parent-most model?
hsu gravatar image hsu  ( 2011-09-07 20:32:39 -0500 )edit
No, visually it looks ok when paused. Parent and child model appear at the right spot instantly. But when unpausing again the behavior is all the same.
nitschej gravatar image nitschej  ( 2011-09-07 21:15:54 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2011-09-08 14:30:24 -0500

hsu gravatar image

Trying with the pioneer2dx_camera.world confirms that there is a bug with setting pose of nested models in diamondback and electric. The problem is due to a bug in the recursive updates in Entity.cc. Ticketed.

Current work around is to combine nested models into a single model. For example, pioneer2dx_camera.world becomes:

<?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.001</stepTime>
    <gravity>0 0 0</gravity>
    <cfm>0.0000000001</cfm>
    <erp>0.2</erp>

    <stepType>quick</stepType>
    <stepIters>100</stepIters>
    <stepW>1.3</stepW>
    <contactMaxCorrectingVel>100.0</contactMaxCorrectingVel>
    <contactSurfaceLayer>0.00</contactSurfaceLayer>
  </physics:ode>

  <rendering:gui>
    <type>fltk</type>
    <size>800 600</size>
    <updateRate>20</updateRate>
    <pos>0 0</pos>

    <frames>
      <row height="100%">
        <camera width="100%">
          <xyz>0.35 -0.5 0.43</xyz>
          <rpy>0 14 111.5</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 1</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="cylinder1_model">
    <xyz>1 -1.5 0.5</xyz>
    <rpy>0.0 0.0 0.0</rpy>

    <body:cylinder name="cylinder1_body">
      <massMatrix>true</massMatrix> 
      <mass>1.0</mass>
      <ixx>0.01</ixx>
      <ixy>0.00</ixy>
      <ixz>0.00</ixz>
      <iyy>0.01</iyy>
      <iyz>0.00</iyz>
      <izz>0.01</izz>
      <cx>0.0</cx>
      <cy>0.0</cy>
      <cz>0.0</cz>
      <geom:cylinder name="cylinder1_geom">
        <size>0.5 1</size>
        <visual>
          <mesh>unit_cylinder</mesh>
          <material>Gazebo/RustyBarrel</material>
        </visual>
      </geom:cylinder>
    </body:cylinder>
  </model:physical>

  <model:physical name="pioneer2dx_model1">
    <xyz>0 0 0.148</xyz>
    <rpy>0.0 0.0 0.0</rpy>

  <body:box name="sonyvid30_body">
    <xyz>0.15 0.0 0.09</xyz>
    <rpy>0.0 0.0 0.0</rpy>

    <massMatrix>true</massMatrix> 
    <mass>0.1</mass>
    <ixx>0.01</ixx>
    <ixy>0.00</ixy>
    <ixz>0.00</ixz>
    <iyy>0.01</iyy>
    <iyz>0.00</iyz>
    <izz>0.01</izz>
    <cx>0.0</cx>
    <cy ...
(more)
edit flag offensive delete link more
1

answered 2011-09-07 12:01:20 -0500

hsu gravatar image

updated 2011-09-07 12:15:21 -0500

I just tested in electric, and the set_model_pose behavior is as expected.

set_model_pose in Diamondback also seems fine. Are you sure you have the latest debian release?

Try below?

sudo apt-get update
sudo apt-get upgrade

I should mention I am using pioneer2dx model from gazebo, i.e.:

rosrun gazebo gazebo `rospack find gazebo`/gazebo/share/gazebo/worlds/models/pioneer2dx.model
edit flag offensive delete link more

Comments

Yes, all packages are up to date. Gazebo package version is 1.2.8-s1312465587~natty. As mentioned it only works if it is a compound model, try "rosrun gazebo gazebo `rospack find gazebo`/gazebo/share/gazebo/worlds/pioneer2dx_camera.world" instead. But don't forget to disable gravity.
nitschej gravatar image nitschej  ( 2011-09-07 19:41:42 -0500 )edit

Question Tools

Stats

Asked: 2011-09-06 21:32:58 -0500

Seen: 1,803 times

Last updated: Sep 08 '11