Strict Requirements
Implementing a new motion planner is very simple using OMPL. There are just two strict requirements:
By satisfying these requirements, the planner can be fully integrated within the existing OMPL framework.
Optional Features
Aside from the strict requirements, there are other methods which can be implemented and practices which should be followed for ease of integration. These are not required, but are strongly recommended for simplicity and consistency:
New Planner Template
The following is a template which can be used to craft a new ompl::base::Planner object:
#include <ompl/base/Planner.h>
#include <ompl/util/RandomNumbers.h>
#include <ompl/tools/config/SelfConfig.h>
namespace ompl
{
class myNewPlanner : public base::Planner
{
public:
myNewPlanner(const base::SpaceInformationPtr &si) : base::Planner(si, "the planner's name")
{
specs_.approximateSolutions = ...;
specs_.recognizedGoal = ...;
...
}
virtual ~myNewPlanner(void)
{
}
virtual base::PlannerStatus solve(const base::PlannerTerminationCondition &ptc)
{
checkValidity();
base::Goal *goal = pdef_->getGoal().get();
while (const base::State *st = pis_.nextStart())
{
}
const base::State *st = pis_.nextGoal(ptc);
const base::State *st = pis_.nextGoal();
while (ptc() == false)
{
}
pdef_->addSolutionPath(...);
}
virtual void clear(void)
{
Planner::clear();
}
virtual void setup(void)
{
Planner::setup();
SelfConfig sc(si_, getName());
sc.configure...
}
virtual void getPlannerData(base::PlannerData &data) const
{
}
};
}