move_base crashes with custom global planner whenever instantiating base_local_planner::CostmapModel
I have written my own global planner and have successfully registered the plugin so that move_base can detect it.
I am getting a problem where move_base will crash whenever I instantiate an instance of base_local_planner::CostmapModel.
I've removed all the code from my global planner so that it will run as a plugin that does nothing. This is what my initialize function looks like:
void FrontierPlanner::initialize(string name, Costmap2DROS* costmap_ros)
{
map = costmap_ros;
Costmap2D* costmap = map->getCostmap();
base_local_planner::CostmapModel model(*costmap); //The offending line
}
This will cause move_base to crash. If I comment out the third line then it will run no problem. It compiles in both cases as well.
The error move_base gives me is:
[FATAL] [1438809026.524028208]: Failed to create the bob/FrontierPlanner planner, are you sure it is properly registered and that the containing library is built? Exception: Failed to load library /home/viki/catkin_ws/devel/lib//libfrontier_planner_lib.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/viki/catkin_ws/devel/lib//libfrontier_planner_lib.so: undefined symbol: _ZTVN18base_local_planner12CostmapModelE)
[move_base-5] process has died [pid 2554, exit code 1, cmd /opt/ros/indigo/lib/move_base/move_base __name:=move_base __log:=/home/viki/.ros/log/6207c02a-3bb6-11e5-8754-080027c434d6/move_base-5.log].
log file: /home/viki/.ros/log/6207c02a-3bb6-11e5-8754-080027c434d6/move_base-5*.log
Any ideas?
Can you please give some more details (maybe link to a gist)? Showing your
*plugin.xml
for this planner, more details on the implementation as well as theCMakeLists.txt
andpackage.xml
.Otherwise, we can only guess... But something seems to be wrong the way you export your library...
I forgot a target_link_libraries in my CMakeLists.txt. I wasn't linking the library with my plugin to catkin_libraries.
can you then post your solution as an answer and mark it as correct? Helps keeping ROS Answers clean ;-)
I can't accept my own answer because I don't have a high enough reputation lol