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

pluginlib terminates when there are no plugins

asked 2011-11-14 23:16:37 -0500

dornhege gravatar image

I want to create a scenario where I have one package ("the_exec") that defines an interface the_exec::AEIF and depending on a configuration file loads some plugins.

When I create just the interface and a simple main this line doesn't work:

int main(int argc, char** argv)
    pluginlib::ClassLoader<the_exec::AEIF> poly_loader("the_exec", "the_exec::AEIF");

and gives me:

terminate called after throwing an instance of 'pluginlib::LibraryLoadException'
  what():  rospack could not find the the_exec package containing the_exec::AEIF

This happens even when I do not try to load any plugins.

However, when I define one simple package that contains plugins, even if they are not being loaded it works fine. I cannot guarantee that there are plugins available for this package as they are plugins to be defined optionally, so the program should work without any plugins.

I could probably fix this by defining a dummy plugin in the the_exec package, but I'm wondering if there is a better cleaner way or how to fix this properly.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-11-15 13:26:38 -0500

Patrick Mihelich gravatar image

OK, the error output is a little misleading. rospack plugins returns nothing (no implementations of the interface found), and pluginlib has no way to distinguish this from "couldn't find the package containing the interface."

Can't you just catch the exception?

edit flag offensive delete link more


That somehow makes sense. The package is the same that defines the interface, i.e. the_exec package contains the_exec::AEIF. I even tried instatiating a dummy implementation, but I guess it needs to be registered like a plugin. I can catch the exception for now and interpret that as "no plugins".
dornhege gravatar image dornhege  ( 2011-11-15 21:48:41 -0500 )edit

Question Tools


Asked: 2011-11-14 23:16:37 -0500

Seen: 1,787 times

Last updated: Nov 15 '11