0
$\begingroup$

Rosanswers logo

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.


Originally posted by dornhege on ROS Answers with karma: 31395 on 2011-11-15

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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?


Originally posted by Patrick Mihelich with karma: 4336 on 2011-11-15

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by dornhege on 2011-11-15:
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".

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.