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

Revision history [back]

I have found a partial solution. The plugin-base-class should inherit from an auxiliar-untemplated-base-class. After this you can use a dynamic_pointer_cast to the templated plugin-base-class. This is not bad given the dynamic load is itself dynamic, no additional and unexpected runtime errors should occur. given "NavigationNodeComponent" the auxiliar untemplated base class and state_estimator_name the name of the plugin we want to load.

pluginlib::ClassLoader<navigationnodecomponent> loader("rtcus_navigation","rtcus_navigation::NavigationNodeComponent");
shared_ptr<StateEstimation<StateType, ActionType, TimeModel> > new_state_estimation = 
   dynamic_pointer_cast<rtcus_navigation::StateEstimation<StateType, ActionType, TimeModel> >( 
    loader.createInstance(state_estimator_name));

However this is only for the loading stage. How to declare plugin in a more automated way and not manually remains unsolved.