Parts of model linger visually after deleting through c++ plugin/ROS

asked 2021-07-01 03:20:22 -0600

melyso gravatar image

I'm writing a plugin for re-loading/changing a terrain model without restarting Gazebo. As far as I can understand, the best way to do this would be to first delete the old model, then insert a model with the same name. This also seems to work well most of the time when testing out the plugin.

However, seemingly randomly, parts of the old model are visible in the simulator after deletion. I can also select them, and even drag them around, but they are not anywhere in the list of models in the scene. Is there anything in the way I'm deleting models that makes this happen, and if so, what should I do differently?

Code snippet:

physics::ModelPtr old_terrain = this->world->ModelByName("terrain");

this->world->RemoveModel(old_terrain);

edit retag flag offensive close merge delete