ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using system() might not help you most of the times. Do not go for system() unless desperate. I used the following code (snippet) in c++.

 #include "gazebo/DeleteModel.h"
    remove(std::string model_name)
         {
           ros::NodeHandle nh("");
           ros::service::waitForService("gazebo/delete_model");
           ros::ServiceClient deleteModelClient = nh.serviceClient<gazebo::DeleteModel>("gazebo/delete_model");
           gazebo::DeleteModel deleteModel;
           deleteModel.request.model_name = model_name;
           deleteModelClient.call(deleteModel);
         }

in main()

remove(<model_name>);

Hope you can modify for python!