set_model_state visual error

asked 2018-01-04 10:52:31 -0600

swordsgnat gravatar image

I'm trying to animate a complex surface in Gazebo as part of a simulation. I have a folder of .StP files representing each successive "frame" of the surface's movement. I have a script written that creates a node that runs code every time /clock is updated. My general strategy is that every time my desired timestep has passed, I pause the simulation (with the pause_physics service), delete the old frame of the surface (using the delete_model service) and then I spawn the new frame of the surface (using the spawn_model service) before unpausing the simulation (with unpause_physics).

That's the idea, anyway. In practice, delete_model has been doing weird things (I have a separate question on the forum about that, which I'll link to once it passes moderation) so I've switched to a workaround strategy. Instead of deleting each old surface, I just use set_model_state to move it 100 units up in the z plane, so it's out of the way and no longer my problem. Thing is, although the set_model_state service call returns successfully, the surface frame doesn't actually move - I just get two surface frames on top of one another; the old one and the new one. To make things weirder, when I look at the gzclient window and check the poses, the old frame says that it's indeed at (0, 0, 100), even though visually it's at (0, 0, 0). If I change any one of the numbers manually through the GUI and press enter, (even a change to (0.1, 0, 100) then the old frame jumps to the actual 100 point, disappearing from view like I want. To make things weirder still, when I have the two frames on top of one another before entering a change manually, if I open a SECOND gzclient window, the frames will be properly animated - the one reporting it's at 100 in z actually IS there.

I know the thousand-dollar question will be "well, it seems to be purely visual, so why do you care?" but as I said, I'm trying to do an animation, so I really want to make it look good visually.

Any thoughts? Thanks in advance!

edit retag flag offensive close merge delete