Robotics StackExchange | Archived questions

Gazebo not updating visual position in gzclient

I've encountered an interesting situation in Gazebo 9.3. I'm not sure if it's a bug or not but when setting the position of my model either via /gazebo/setmodelstate topic or via the Gazebo API (using SetWorldPose), the visual position of the model does not change.

Here's a simple example:

1) I have this wooden log with a position of x: 0.0 y: 0.1 z: 0.0.
image description
2) I attempt to change its position to x: 0.0 y: 0.0 z: 0.0. (by using either /gazebo/setmodelstate or Gazebo API)
3) When viewing properties of the object in the Gazebo GUI, the position is displayed correctly.
image description
4) However the position of the visual object in the actual world does not display correctly. (it shows the object to still be at y: 0.1)

And the reason why I think this might be a bug is because this does not happen all the time. About 50% of the time, the position in the world changes correctly and the other 50% of the times the object does not change. I haven't noticed any reasonable logic as to when it changes and when it doesn't.

Does anyone have any insight to this?

Here's the sdf I'm using for the wooden log:

<?xml version="1.0"?>
<sdf version="1.4">
  <model name="wood">
    <static>true</static>
    <link name="wood_link">
      <visual name="wood_visual">
        <geometry>
          <cylinder>
            <radius>0.03</radius>
            <length>0.1</length>
          </cylinder>
        </geometry>
        <material>
          <script>
            <name>Gazebo/WoodFloor</name>
          </script>
        </material>
      </visual>
    </link>
  </model>
</sdf>

I've tried different ways of spawning it into the world (or having it already there in the .world file) but it acts the same way.

Asked by Raskkii on 2018-08-07 03:42:02 UTC

Comments

Is the model selected in the GUI at the moment you send the command? Try making sure the model is not selected and see if you can still reproduce the issue.

Asked by chapulina on 2018-08-07 11:17:37 UTC

I've tried it either way. No difference.

Asked by Raskkii on 2018-08-08 01:25:33 UTC

I have the same problem, any updates on this? For my case, it is not a solution to use <static>false</static>

Asked by rezenders on 2020-07-10 12:48:25 UTC

Any updates on this? I'm facing the same problem.

Asked by clawaster on 2022-12-20 08:45:23 UTC

Answers

This happens to me too. In my case the solution was simply to change static to false:

<static>false</static>

dont know exactly why but it worked(for me). I remember that static models are ignored by the physics engine and therefore not updated. Hope that helps.

Asked by wentz on 2018-08-08 03:05:27 UTC

Comments

Thank you. This does make the object spawn consistently at places i tell it to spawn in. However, the problem is without the static tag, the object falls down whenever I attempt to spawn it higher on the z axis. For my simulation, I need the object to be able to stay statically in the air. Any ideas?

Asked by Raskkii on 2018-08-08 05:02:51 UTC

Oh, I can just set gravity of the model to 0. Now everything works as I need it to. Thanks again!

Asked by Raskkii on 2018-08-08 05:16:35 UTC

I am facing the same issue. I know by changing static to false and gravity to 0, it always works in GUI. However, I don't want to change static to false because I want to allow models penetrate into each other without flying away. If I keep static to true, I don't need to worry about collision at all, but not if I set static to false. Any suggestions?

Asked by captainzhao on 2020-08-20 02:11:20 UTC