Open JL1709 opened 2 years ago
I can confirm this issue.
I've checked whether /gazebo/get_model_state
still returns a wrong cached state after deleting a model, but it correctly returns a failure. So there must be some hidden internal state which is not reset.
Hi, when deleting a model, let's say "box_1" with pose x = 2.0, y = 2.0 and than spawn a new box, again with name "box_1" but this time with pose x = 0.0 and y = 0.0, the new box will be spawned at the pose of the deleted box (here x = 2.0, y = 2.0) and not at the newly defined pose (but with the newly defined geometry). Way to reproduce the behavior: test.world:
box_1.sdf:
roscore
rosrun gazebo_ros gazebo 'path_to_world_file'/test.world
rosservice call gazebo/delete_model '{model_name: box_1}'
rosrun gazebo_ros spawn_model -file 'path_to_sdf_file'/box_1.sdf -sdf -model box_1
Also when explicitly giving x and y at the spawn_model call ('rosrun gazebo_ros spawn_model ... -model box_1 -x 0.0 -y 0.0) the box will be spawned at the wrong pose. This behavior does not occur when the newly spawned box gets a different name (but for my use case it is important, that they can have the same name). Version: 11.10.2
Thanks for having a look at this issue.