Gazebo | Ignition | Community
Ask Your Question
0

How to delete a model with an world plugin

asked 2014-04-10 05:19:46 -0500

Markus Bader gravatar image

updated 2014-04-10 06:33:21 -0500

Hi

I wrote a WorldPlugin similar to the factory example and now I want to delete a added model but how? The following approach does not work :-(

void delete(const std::string& name){
    # Info world_ is of type physics::WorldPtr 
    physics::ModelPtr p = world_->GetModel(name);
    p->RemoveChildren();        
}

Greetings Markus

edit retag flag offensive close merge delete

Comments

try `p->Fini();` ?

AndreiHaidu gravatar imageAndreiHaidu ( 2014-04-10 07:24:39 -0500 )edit

Thanks Andrei, Fini worked

Markus Bader gravatar imageMarkus Bader ( 2014-04-10 08:03:42 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-04-10 08:05:21 -0500

Markus Bader gravatar image

Based on Andrei's comment I changed my code and now it works.

Thanks to Andrei :-)

void delete(const std::string& name){
    # Info world_ is of type physics::WorldPtr 
    physics::ModelPtr p = world_->GetModel(name);
    p->Fini();        
}
edit flag offensive delete link more
0

answered 2016-07-25 20:36:31 -0500

dhood gravatar image

updated 2016-07-25 20:37:08 -0500

If anyone else comes across this post, you can also do this through a WorldPtr with World::RemoveModel (API link)

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-04-10 05:19:46 -0500

Seen: 3,014 times

Last updated: Jul 25 '16