Gazebo | Ignition | Community
Ask Your Question
1

How to delete a model entirely, including contact filter

asked 2014-06-07 13:07:02 -0500

EdwardC gravatar image

updated 2014-06-07 13:09:36 -0500

Hi,

In my application I need to dynamically insert, delete and reinsert models. So when I delete a module and reinsert the same module at the same position with the same name, I will get an error which is

Error [ContactManager.cc:267] Filter with the same name already exists! Aborting

Meanwhile, I found that the object of the model is still there even after I 'delete' it use the function provided, which I believe is "Fini()".

So I ran a little test, which I added several lines in front of and after my delete function as follows

cout<<"World: This is a count of the object left: "<<currentWorld->GetModel(module_name).use_count()<<endl;
currentWorld->GetModel(module_name)->Fini();
cout<<"World: This is a count of the object left: "<<currentWorld->GetModel(module_name).use_count()<<endl;

Before I finalize the model, the count of the model instances are 23, and after that operation, the count drop to 7 instead of 1. I checked my entire code again and make sure I reset all the model_ptr instance I used. Therefore, it seems that we can never delete a model entirely.

Is this a bug or I massed something up in my code? Is there a solution without changing the name of the new inserted model? This functionality is crucial to our applications, so please help me!

By the way, the gazebo I used is 1.9.5. Have this been fixed in the new version?

Oh, also

currentWorld->GetPhysicsEngine()->GetContactManager()->GetContacts().size()

always gives me zero, so I don't know how to manually delete contact filter either.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-06-09 16:01:19 -0500

scpeters gravatar image
edit flag offensive delete link more

Comments

By the way, could you show me how to manually disable the contact filters of the models which have already been deleted?

EdwardC gravatar imageEdwardC ( 2014-06-11 12:32:43 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-06-07 13:07:02 -0500

Seen: 516 times

Last updated: Jun 09 '14