Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Thanks for answering.

I have tried to send a msg request to delete the model as you recommended it, but it couldn't recognize the light name and it gave me this when I run it: Msg Waiting for master Msg Connected to gazebo master @ Msg Publicized address: Error: No model name specified.

I also tried this with box model but it didnt work , I know that problem goes with recognizing the model name but I dont know how to do it even thouhgh I tried to get the model name in this way to delete the light

std::string modelName= _sdf->GetElement("light")->GetValueString();

but gazebo crashed and gave this error :gazebo: /usr/include/boost/smart_ptr/shared_ptr.hpp:418: T* boost::shared_ptr<t>::operator->() const [with T = sdf::Element]: Assertion `px != 0' failed.

The code below shows how it is done:

if ( this->model2_ ->GetWorld()->GetSimTime() > this->simtime )


// std::string modelName= _sdf->GetElement("light")->GetValueString();

if (!transport::init())


if (vm.count("bulb100"))

modelName = vm["bulb100"].as<std::string>();



std::cerr << "Error: No model name specified.\n";




transport::NodePtr node(new transport::Node());


msgs::Request *msg = msgs::CreateRequest("entity_delete", modelName);

transport::PublisherPtr pub = node->Advertise<msgs::request>("~/request");

// Model file to load



delete msg;



thanks in advance!