Ask Your Question
0

Unload a plugin with pluginlib

asked 2017-08-22 02:26:12 -0500

bulgrozer gravatar image

updated 2017-08-22 06:33:12 -0500

Hi everyone,

i'm trying to manage a project with the adaptation of plugins and I created a node with the launch of multiple plugins with different parameters and I can't found in the API code a function to unload a plugin dynamically. I'd like not to use any nodelet because there are some specifications that I don't understand (The bond connection between every nodelets and all).

So is there a simple way to manage the plugin dynamically ?

Thx

Edit 1:

I tried to use the unloadLibraryForClass. It does not delete the object, it just tries to unload the library which is not what I want.

What I'm trying to do for example is to instantiate a plugin, delete it and instantiate it again with a different parameter. The destructor of the base class is virtual so I create a destructor for each of my plugin but it cannot be used because the plugin is of the base type. Same problem with the delete function.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-08-22 02:37:01 -0500

gvdhoorn gravatar image

The C++ API docs list a int pluginlib::ClassLoader<T>::unloadLibraryForClass(const std::string &lookup_name) method:

Decrements the counter for the library containing a class with a given name and attempts to unload it if the counter reaches zero.

That should do what you want, but only in the case that no other users of the library still hold on to it.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2017-08-22 02:26:12 -0500

Seen: 298 times

Last updated: Aug 22 '17