Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I think the preferred way of deleting a model is by sending an entity_delete request. I believe this avoids various race conditions and makes sure every subcomponent of Gazebo is notified of the deletion. Here's another explanation.

And here's a snippet of code as used in gz.

msgs::Request *msg = msgs::CreateRequest("entity_delete", modelName);
transport::PublisherPtr pub = node->Advertise<msgs::Request>("~/request");
pub->WaitForConnection();
pub->Publish(*msg, true);
delete msg;