How to create a new motion planner in moveit?
Hello everyone! I am in ROS Kinetic on Ubuntu 16.04, and i would like to make a custom planner in moveit, and i have followed the first six steps from here, and now, i am stuck by this error at 7th step, the error is :
Errors << moveit_planners_ompl:make /home/logan/ws_moveit/logs/moveit_planners_ompl/build.make.012.log
/home/logan/ws_moveit/devel/.private/moveit_planners_ompl/lib/libmoveit_ompl_interface.so.0.9.12: undefined reference to `ompl::geometric::myPlanner::myPlanner(std::shared_ptr<ompl::base::SpaceInformation> const&, bool)'
/home/logan/ws_moveit/devel/.private/moveit_planners_ompl/lib/libmoveit_ompl_interface.so.0.9.12: undefined reference to `ompl::geometric::myPlanner::~myPlanner()'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/logan/ws_moveit/devel/.private/moveit_planners_ompl/lib/moveit_planners_ompl/moveit_ompl_planner] Error 1
make[1]: *** [ompl_interface/CMakeFiles/moveit_ompl_planner.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/home/logan/ws_moveit/devel/.private/moveit_planners_ompl/lib/libmoveit_ompl_interface.so.0.9.12: undefined reference to `ompl::geometric::myPlanner::myPlanner(std::shared_ptr<ompl::base::SpaceInformation> const&, bool)'
/home/logan/ws_moveit/devel/.private/moveit_planners_ompl/lib/libmoveit_ompl_interface.so.0.9.12: undefined reference to `ompl::geometric::myPlanner::~myPlanner()'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/logan/ws_moveit/devel/.private/moveit_planners_ompl/lib/moveit_planners_ompl/moveit_demo_construct_constraints_database] Error 1
make[1]: *** [ompl_interface/CMakeFiles/moveit_demo_construct_constraints_database.dir/all] Error 2
make: *** [all] Error 2
cd /home/logan/ws_moveit/build/moveit_planners_ompl; catkin build --get-env moveit_planners_ompl | catkin env -si /usr/bin/make --jobserver-fds=6,7 -j; cd -
the new planner "myPlanner" was just copied from "ompl/src/ompl/geometric/planners/prm", and i changed all the file's name by "myPlanner" , i just want to know how to add a planner by myself. And i know the problem is appeared after i add the header file that defines the new planner and register my planner in the registerDefaultPlanners() function in "src/moveit_planners/ompl/ompl_interface/src/planning_context_manager.cpp" file. the ompl can cmake and make install success, but the ws_moveit workspace can't build success, and if i remove the content what i add in "planning_context_manager.cpp" file, the ws_moveit workspace can be build success.
If anyone knows some solutions about this problem, please help me, thank you very much!
Just a note: the steps you link to are for adding a new OMPL based planner. It's perfectly possible to add a new planner without building OMPL from sources.
Oh! That's what I hope to do, if you know how to do it, please tell me, i am very grateful!
You'd need to write an implementation of the
planning_interface::PlannerManager
interface and generate a plugin from that.It's not perfect, but see moveit_mpp for a tiny example. Ignore all the loading of other plugins, that is not needed.
Thank you very much! i will try it.