在Moveit中如何创建新的规划器(How to create a new motion planner in moveit)
在ROS中源码下载moveit和OMPL的步骤:
As of today (July 2018), the solution to implementing a new sampler (or a planner for that matter) in MoveIt works as follow:
1.Build MoveIt from source. Just follow the instructions on MoveIt website. I tested with ROS Kinetic. (As long as you later use an OMPL version that is compatible with your ROS distro, everything should work fine)
2.Delete the OMPL binaries that should have been installed by the procedure in the previous link. To do that I used sudo apt-get remove and sudo apt-get purge on the libompl-dev package.记得把sudo apt-get install 的OMPL包删掉。
3.Download/Checkout OMPL source code. You can use their BitBucket repository, in the “Download” section, in the “Branches” tab, you can find archives containing source code compatible with your ROS distro. Put the source code in the same catkin workspace as your MoveIt source.
4.Modify OMPL source code as you need. You can find tutorials about adding planners/samplers on their website.在你的MyPlanner.h里面最好是继承base::Planner,例如 class MyPlanner : public base::Planner
5. Modify MoveIt source code. If you added a planner, you need to do that. It shouldn’t be needed if you just added a new sampling strategy. Modify planning_context_manager.h and planning_context_manager.cpp to add your planner just like the original ones. This comes from this webarchive.写完代码后要在planning_context_manager.cpp 添加#include <ompl/geometric/planners/rrt/MyPlanner.h>,还有一定要在planning_context_manager.cpp 里面注册新的planner,例如我的就是 registerPlannerAllocator(“geometric::MyPlanner”, boost::bind(&allocatePlannerog::MyP