Fix inserted mesh scale during log playback

#2723 Merged at 6c3209d
  1. Louise Poubel

Reproduce issue

  1. Open Gazebo recording a log gazebo --verbose -r
  2. Insert a double pendulum (to have movement)
  3. Insert a model which has a scaled mesh, such as the table_marble
  4. Close Gazebo
  5. Playback the log file with gazebo --verbose -p ~/.gazebo/log/...
  6. You'll see that the mesh is inserted with the wrong scale.


The solution to this problem was simply to change UnscaledSDF to GetSDF when getting the inserted model.

But that looks fishy, since it looks like the intention of the code was precisely to use unscaled models.

So I went back to the pull request where that line was changed, and it looks like the intention was to properly record scaling while logging and then properly play it back.

I manually checked that even with this fix:

  • It's possible to scale shapes while recording and that is properly played back
  • Undo scaling works (that uses states)
  • The underlying issue of scaled meshes is fixed

So... It looks like it's safe to change that line...

Comments (13)

  1. Shane Loretz

    This seems to double scale objects for me. When I scale a default box and play back the log, the cube starts from the final scale and gets smaller.

    Steps to reproduce

    1. gazebo --verbose --record --record_path /tmp/scale_cube
    2. Insert a cube
    3. Scale the cube down on all three dimension
    4. File -> Quit
    5. gazebo --verbose --pause --play /tmp/scale_cube/state.log
    6. Cube starts already at the final scaling
    7. Playing the log shows the cube get even smaller very quickly (much faster than I scaled it)


    1. Louise Poubel author

      I think you just found out why that was UncaledSDF in the first place! Nice catch!

  2. Jiří Kerner

    Hi, is there plan to merge this fix into Gazebo 8? Still experiencing this issue in Gazebo 8.1.1.