37 #ifndef OMPL_CONTROL_SIMPLE_SETUP_
38 #define OMPL_CONTROL_SIMPLE_SETUP_
40 #include "ompl/base/Planner.h"
41 #include "ompl/control/SpaceInformation.h"
42 #include "ompl/control/PlannerData.h"
43 #include "ompl/base/ProblemDefinition.h"
44 #include "ompl/control/PathControl.h"
45 #include "ompl/geometric/PathGeometric.h"
47 #include "ompl/util/Exception.h"
55 OMPL_CLASS_FORWARD(SimpleSetup);
90 return si_->getStateSpace();
96 return si_->getControlSpace();
102 return si_->getStateValidityChecker();
108 return si_->getStatePropagator();
114 return pdef_->getGoal();
136 return pdef_->getSolutionPath().get();
148 si_->setStateValidityChecker(svc);
154 si_->setStateValidityChecker(svc);
160 si_->setStatePropagator(sp);
166 si_->setStatePropagator(sp);
172 pdef_->setStartAndGoalStates(start, goal, threshold);
178 pdef_->setGoalState(goal, threshold);
185 pdef_->addStartState(state);
191 pdef_->clearStartStates();
205 pdef_->setGoal(goal);
214 if (planner && planner->getSpaceInformation().get() !=
si_.get())
215 throw Exception(
"Planner instance does not match space information");
251 virtual void clear(
void);
254 virtual void print(std::ostream &out = std::cout)
const;
259 virtual void setup(
void);
const ControlSpacePtr & getControlSpace(void) const
Get the current instance of the control space.
const SpaceInformationPtr & getSpaceInformation(void) const
Get the current instance of the space information.
void clearStartStates(void)
Clear the currently set starting states.
Object containing planner generated vertex and edge data. It is assumed that all vertices are unique...
base::PlannerAllocator pa_
The optional planner allocator.
const base::PlannerAllocator & getPlannerAllocator(void) const
Get the planner allocator.
A boost shared pointer wrapper for ompl::base::ProblemDefinition.
void setGoal(const base::GoalPtr &goal)
Set the goal for planning. This call is not needed if setStartAndGoalStates() has been called...
boost::function< void(const base::State *, const Control *, const double, base::State *)> StatePropagatorFn
A function that achieves state propagation.
base::ProblemDefinitionPtr pdef_
The created problem definition.
base::PlannerPtr getDefaultPlanner(const base::GoalPtr &goal)
Given a goal specification, decide on a planner for that goal.
void setStatePropagator(const StatePropagatorFn &sp)
Set the function that performs state propagation.
Definition of a scoped state.
A boost shared pointer wrapper for ompl::base::StateSpace.
Create the set of classes typically needed to solve a control problem.
virtual void clear(void)
Clear all planning data. This only includes data generated by motion plan computation. Planner settings, start & goal states are not affected.
void setPlannerAllocator(const base::PlannerAllocator &pa)
Set the planner allocator to use. This is only used if no planner has been set. This is optional – a...
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...
const base::PlannerPtr & getPlanner(void) const
Get the current planner.
const base::StateValidityCheckerPtr & getStateValidityChecker(void) const
Get the current instance of the state validity checker.
Definition of a control path.
SimpleSetup(const ControlSpacePtr &space)
Constructor needs the control space used for planning.
boost::function< bool(const State *)> StateValidityCheckerFn
If no state validity checking class is specified (StateValidityChecker), a boost function can be spec...
base::PlannerPtr planner_
The maintained planner instance.
Maintain a set of parameters.
void setStartState(const base::ScopedState<> &state)
Clear the currently set starting states and add state as the starting state.
virtual base::PlannerStatus solve(double time=1.0)
Run the planner for a specified amount of time (default is 1 second)
const base::StateSpacePtr & getStateSpace(void) const
Get the current instance of the state space.
A boost shared pointer wrapper for ompl::base::StateValidityChecker.
A boost shared pointer wrapper for ompl::control::ControlSpace.
A boost shared pointer wrapper for ompl::base::Planner.
virtual void setup(void)
This method will create the necessary classes for planning. The solve() method will call this functio...
void setStatePropagator(const StatePropagatorPtr &sp)
Set the instance of StatePropagator to perform state propagation.
void setGoalState(const base::ScopedState<> &goal, const double threshold=std::numeric_limits< double >::epsilon())
A simple form of setGoal(). The goal will be an instance of ompl::base::GoalState.
base::ParamSet & params(void)
Get the parameters for this planning context.
base::ParamSet params_
The parameters that describe the planning context.
const base::ParamSet & params(void) const
Get the parameters for this planning context.
void setStartAndGoalStates(const base::ScopedState<> &start, const base::ScopedState<> &goal, const double threshold=std::numeric_limits< double >::epsilon())
Set the start and goal states to use.
A class to store the exit status of Planner::solve()
virtual void print(std::ostream &out=std::cout) const
Print information about the current setup.
PathControl & getSolutionPath(void) const
Get the solution path. Throw an exception if no solution is available.
base::PlannerStatus last_status_
The status of the last planning request.
const base::ProblemDefinitionPtr & getProblemDefinition(void) const
Get the current instance of the problem definition.
void getPlannerData(base::PlannerData &pd) const
Get information about the exploration data structure the motion planner used.
base::PlannerStatus getLastPlannerStatus(void) const
Return the status of the last planning attempt.
SpaceInformationPtr si_
The created space information.
The exception type for ompl.
const StatePropagatorPtr & getStatePropagator(void) const
Get the instance of the state propagator being used.
bool haveExactSolutionPath(void) const
Return true if a solution path is available (previous call to solve() was successful) and the solutio...
double getLastPlanComputationTime(void) const
Get the amount of time (in seconds) spent during the last planning step.
const base::GoalPtr & getGoal(void) const
Get the current goal definition.
void addStartState(const base::ScopedState<> &state)
Add a starting state for planning. This call is not needed if setStartAndGoalStates() has been called...
void setStateValidityChecker(const base::StateValidityCheckerPtr &svc)
Set the state validity checker to use.
double planTime_
The amount of time the last planning step took.
void setPlanner(const base::PlannerPtr &planner)
Set the planner to use. If the planner is not set, an attempt is made to use the planner allocator...
A boost shared pointer wrapper for ompl::base::Goal.
bool haveSolutionPath(void) const
Return true if a solution path is available (previous call to solve() was successful). The solution may be approximate.
bool configured_
Flag indicating whether the classes needed for planning are set up.
void setStateValidityChecker(const base::StateValidityCheckerFn &svc)
Set the state validity checker to use.