37 #ifndef OMPL_BASE_PLANNER_
38 #define OMPL_BASE_PLANNER_
40 #include "ompl/base/SpaceInformation.h"
41 #include "ompl/base/ProblemDefinition.h"
42 #include "ompl/base/PlannerData.h"
43 #include "ompl/base/PlannerStatus.h"
44 #include "ompl/base/PlannerTerminationCondition.h"
45 #include "ompl/base/GenericParam.h"
47 #include "ompl/util/Time.h"
48 #include "ompl/util/ClassForward.h"
49 #include "ompl/util/Deprecation.h"
50 #include <boost/function.hpp>
51 #include <boost/concept_check.hpp>
52 #include <boost/noncopyable.hpp>
53 #include <boost/lexical_cast.hpp>
65 OMPL_CLASS_FORWARD(Planner);
177 return addedStartStates_;
183 return sampledGoalsCount_;
190 unsigned int addedStartStates_;
191 unsigned int sampledGoalsCount_;
245 BOOST_CONCEPT_ASSERT((boost::Convertible<T*, Planner*>));
247 return static_cast<T*
>(
this);
252 const T*
as(
void)
const
255 BOOST_CONCEPT_ASSERT((boost::Convertible<T*, Planner*>));
257 return static_cast<const T*
>(
this);
301 virtual void clear(
void);
312 const std::string&
getName(
void)
const;
315 void setName(
const std::string &name);
324 virtual void setup(
void);
368 template<
typename T,
typename PlannerType,
typename SetterType,
typename GetterType>
369 void declareParam(
const std::string &name,
const PlannerType &planner,
const SetterType& setter,
const GetterType& getter,
const std::string &rangeSuggestion =
"")
371 params_.
declareParam<T>(name, boost::bind(setter, planner, _1), boost::bind(getter, planner));
372 if (!rangeSuggestion.empty())
373 params_[name].setRangeSuggestion(rangeSuggestion);
377 template<
typename T,
typename PlannerType,
typename SetterType>
378 void declareParam(
const std::string &name,
const PlannerType &planner,
const SetterType& setter,
const std::string &rangeSuggestion =
"")
381 if (!rangeSuggestion.empty())
382 params_[name].setRangeSuggestion(rangeSuggestion);
bool approximateSolutions
Flag indicating whether the planner is able to compute approximate solutions.
Planner(const SpaceInformationPtr &si, const std::string &name)
Constructor.
void addPlannerProgressProperty(const std::string &progressPropertyName, const PlannerProgressProperty &prop)
Add a planner progress property called progressPropertyName with a property querying function prop to...
Properties that planners may have.
Object containing planner generated vertex and edge data. It is assumed that all vertices are unique...
virtual ~Planner(void)
Destructor.
const ParamSet & params(void) const
Get the parameters for this planner.
void declareParam(const std::string &name, const PlannerType &planner, const SetterType &setter, const GetterType &getter, const std::string &rangeSuggestion="")
This function declares a parameter for this planner instance, and specifies the setter and getter fun...
virtual void setup(void)
Perform extra configuration steps, if needed. This call will also issue a call to ompl::base::SpaceIn...
virtual void printProperties(std::ostream &out) const
Print properties of the motion planner.
A boost shared pointer wrapper for ompl::base::ProblemDefinition.
GoalType recognizedGoal
The type of goal specification the planner can use.
const std::string & getName(void) const
Get the name of the planner.
boost::function< PlannerPtr(const SpaceInformationPtr &)> PlannerAllocator
Definition of a function that can allocate a planner.
Encapsulate a termination condition for a motion planner. Planners will call operator() to decide whe...
bool isSetup(void) const
Check if setup() was called for this planner.
const ProblemDefinitionPtr & getProblemDefinition(void) const
Get the problem definition the planner is trying to solve.
ProblemDefinitionPtr pdef_
The user set problem definition.
bool multithreaded
Flag indicating whether multiple threads are used in the computation of the planner.
bool directed
Flag indicating whether the planner is able to account for the fact that the validity of a motion fro...
Maintain a set of parameters.
const T * as(void) const
Cast this instance to a desired type.
void setName(const std::string &name)
Set the name of the planner.
ParamSet params_
A map from parameter names to parameter instances for this planner. This field is populated by the de...
bool setup_
Flag indicating whether setup() has been called.
bool provingSolutionNonExistence
Flag indicating whether the planner is able to prove that no solution path exists.
const PlannerSpecs & getSpecs(void) const
Return the specifications (capabilities of this planner)
A boost shared pointer wrapper for ompl::base::Planner.
T * as(void)
Cast this instance to a desired type.
virtual void checkValidity(void)
Check to see if the planner is in a working state (setup has been called, a goal was set...
Base class for a planner.
void declareParam(const std::string &name, const PlannerType &planner, const SetterType &setter, const std::string &rangeSuggestion="")
This function declares a parameter for this planner instance, and specifies the setter function...
const SpaceInformationPtr & getSpaceInformation(void) const
Get the space information this planner is using.
A class to store the exit status of Planner::solve()
virtual void setProblemDefinition(const ProblemDefinitionPtr &pdef)
Set the problem definition for the planner. The problem needs to be set before calling solve()...
Definition of an abstract state.
PlannerInputStates pis_
Utility class to extract valid input states.
PlannerSpecs specs_
The specifications of the planner (its capabilities)
virtual PlannerStatus solve(const PlannerTerminationCondition &ptc)=0
Function that can solve the motion planning problem. This function can be called multiple times on th...
GoalType
The type of goal.
ParamSet & params(void)
Get the parameters for this planner.
void declareParam(const std::string &name, const typename SpecificParam< T >::SetterFn &setter, const typename SpecificParam< T >::GetterFn &getter=typename SpecificParam< T >::GetterFn())
This function declares a parameter name, and specifies the setter and getter functions.
Definition of a problem to be solved. This includes the start state(s) for the system and a goal spec...
const PlannerProgressProperties & getPlannerProgressProperties() const
Retrieve a planner's planner progress property map.
virtual void clear(void)
Clear all internal datastructures. Planner settings are not affected. Subsequent calls to solve() wil...
std::string name_
The name of this planner.
virtual void getPlannerData(PlannerData &data) const
Get information about the current run of the motion planner. Repeated calls to this function will upd...
bool optimizingPaths
Flag indicating whether the planner attempts to optimize the path and reduce its length until the max...
const PlannerInputStates & getPlannerInputStates(void) const
Get the planner input states.
SpaceInformationPtr si_
The space information for which planning is done.
virtual void printSettings(std::ostream &out) const
Print information about the motion planner's settings.
std::map< std::string, PlannerProgressProperty > PlannerProgressProperties
A dictionary which maps the name of a progress property to the function to be used for querying that ...
PlannerProgressProperties plannerProgressProperties_
A mapping between this planner's progress property names and the functions used for querying those pr...
boost::function< bool()> PlannerTerminationConditionFn
Signature for functions that decide whether termination conditions have been met for a planner...
This bit is set if casting to generic goal regions (ompl::base::Goal) is possible. This bit shold always be set.
boost::function< std::string()> PlannerProgressProperty
Definition of a function which returns a property about the planner's progress that can be queried by...