Ask Your Question
0

How to switch local planner in move base?

asked 2017-07-13 21:21:52 -0500

scopus gravatar image

Hi, all. Thanks to @Akif, I have succesfully implemented a package to switch global planner as this link advises. Then I also want to implement a package to switch local planner as the way I did in implementing the global planner switcher. Unfortunately, it was not as smooth as the implementation of global planner switcher. After I implemented a supervisory local planner and launched move_base to test it. An error was output:

[FATAL] [1499944083.575647406, 2061.510000000]: Failed to create the sup_local_planner/sup_l_planner planner, are you sure it is properly registered and that the containing library is built? Exception: Failed to load library /home/scopus/scopus_planning_ws/devel/lib//libsup_local_planner.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Could not load library (Poco exception = /home/scopus/scopus_planning_ws/devel/lib//libsup_local_planner.so: undefined symbol: _ZN11suplPlanner13sup_l_plannerD1Ev)

The content of blp_plugin.xml file is :

    <library path="lib/libsup_local_planner">
  <class name="sup_local_planner/sup_l_planner" type="suplPlanner::sup_l_planner" base_class_type="nav_core::BaseLocalPlanner">
    <description>
    A implementation of a local planner using DWA and ftc approach based on configuration parameters.
    </description>
  </class>
</library>

Parts of my cpp file is:

......

PLUGINLIB_EXPORT_CLASS(suplPlanner::sup_l_planner, nav_core::BaseLocalPlanner)

namespace  suplPlanner {

sup_l_planner::sup_l_planner(std::string name, tf::TransformListener *tf, costmap_2d::Costmap2DROS *costmap_ros)
    :dwa_planner_(),ftc_planner_(),initialized_(false)
{
    initialize(name, tf, costmap_ros);

}
void sup_l_planner::initialize(std::string name, tf::TransformListener *tf, costmap_2d::Costmap2DROS *costmap_ros)
{
    if(!initialized_)
    {
        //costmap_ros_ = costmap_ros;
        pl_type_ = FTC_L;
        ftc_planner_ = boost::shared_ptr<ftc_local_planner::FTCPlanner>(new ftc_local_planner::FTCPlanner(name, tf, costmap_ros));
        dwa_planner_= boost::shared_ptr<dwa_local_planner::DWAPlannerROS>(new dwa_local_planner::DWAPlannerROS(name,tf, costmap_ros));
        ros::NodeHandle private_nh("~/sup_l_Planner");
        change_plan_srv_= private_nh.advertiseService("change_plan",&sup_l_planner::changepl, this);
        initialized_ = true;
    }
    else
        ROS_WARN("This planner has already been initialized, you can't call it twice, doing nothing");

}

You can see that the name of space and the name of class are consistent. So I can't understand why the output error says : "

........., and that names are consistent between this macro and your XML. Error string: Could not load library ......

Looking forward to anyone give me any advice!

Thank you !

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-07-15 13:41:31 -0500

ahendrix gravatar image

I put the error message through c++filt to demangle the function name, and got the following error:

Poco exception = /home/scopus/scopus_planning_ws/devel/lib//libsup_local_planner.so: undefined symbol: suplPlanner::sup_l_planner::~sup_l_planner()

It looks like the destructor for your class was declared virtual (probably in the base class) but you haven't implemented it, and that results in an undefined symbol when loading the library.

edit flag offensive delete link more

Comments

Thank you very much! I found the destructor is defined but not implemented.

scopus gravatar image scopus  ( 2017-07-16 22:04:03 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-07-13 21:21:52 -0500

Seen: 928 times

Last updated: Jul 15 '17