ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Load plugin from separate package

asked 2013-07-04 13:08:44 -0500

candronikos gravatar image

updated 2013-07-04 18:07:43 -0500

Is it possible to load a plugin developed in a separate package without declaring it in the package where the base class resides? Would it be enough to declare the plugin in the .cpp file where the actual plugin lives?

When I tried this, I got the error:

[ERROR] [1372978694.271503470]: The plugin failed to load for some reason. Error: According to the loaded plugin descriptions the class amigctrl_plugin/AmigoBot with base class type cruise_plugin_base::PBase does not exist. Declared types are  cruise_core/amigo_locomotion_plugin

So the plugin that I developed isn't listed here. Just the one that exists in the original package. Can plugins only be declared in the package where they are to be loaded? Is there a way around this?

EDIT: Fixed one error, another came up to go. First, for reference:

    <pkg_name plugin="${prefix}/plugin.xml" />

The tag "pkg_name" must be the name of the package where the base class resides. I named it the package name of the actual plugin.

Now we have a new runtime error, saying:

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct null not valid
Aborted (core dumped)

Any advice on this would be appreciated.

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2013-07-07 19:50:28 -0500

candronikos gravatar image

Ok I fixed it myself. What I did was:

  1. Compile the base class into a library (Done is CMakeLists.txt)
  2. Export that library from the base class manifest (Done in manifest.xml in Fuerte)
  3. Depend on the base class package from the plugin packages manifest
  4. Plugin can be declared in a source file within the package where the plugin resides
  5. Export the plugin library (Done in the plugin package manifest.xml)

My only problem was confusing all the names it works now.

edit flag offensive delete link more


i also have a pluginlib in a package and want to use it in another package. i have followed the plugin tutorial. i get an error error: cannot convert ‘boost::shared_ptr<kinematics::kinematicsbase>’ to ‘kinematics::KinematicsBase*’ in assignment. this is my program on the begining: pluginlib::ClassLoader<kinematics::kinematicsbase> poly_loader("kinematics_base", "kinematics::KinematicsBase"); kinematics::KinematicsBase* kinbase=NULL;

rem870 gravatar image rem870  ( 2013-08-17 00:58:38 -0500 )edit

answered 2013-07-04 17:20:07 -0500

weiin gravatar image

A good place to look would be Possibly just a missing xml or export.

edit flag offensive delete link more


Seemed to be the case. The the tag in the export section in the manifest.xml has to be the name of the package where the base class resides. I made it the name of the package that the plugin resides. Now I'm getting another runtime error. Details above.

candronikos gravatar image candronikos  ( 2013-07-04 17:52:47 -0500 )edit

Hard to tell just based on that error line. Most likely you need to check through your plugin code for bugs.

weiin gravatar image weiin  ( 2013-07-04 20:36:05 -0500 )edit

answered 2018-10-24 17:03:42 -0500

updated 2018-10-24 17:04:18 -0500

Additionally of what @candronikos answered (which is very helpful), I would like to add more detail to point #2 : which says "Export that library from the base class manifest (Done in manifest.xml in Fuerte)"

In catkinized versions manifest.xml is obviously now replaced by package.xml and the export must be done like this:

<my_pkg_base_class plugin="${prefix}/plugins.xml" />

where my_pkg_base_class is the pkg name that contains your base class, make sure you are able to do roscd to it!

I spent a lot of time trying to make a moveit move_group capability plugin because I was exporting with my_pkg_base_class as move_group but it should be moveit_ros_move_group, like this:

<moveit_ros_move_group plugin="${prefix}/plugins.xml" />

Even when the namespace and folder name was set to move_group!

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


Asked: 2013-07-04 13:08:44 -0500

Seen: 2,055 times

Last updated: Oct 24 '18