AnytimePathShortening.cpp
45 ompl::geometric::AnytimePathShortening::AnytimePathShortening (const ompl::base::SpaceInformationPtr &si) :
56 Planner::declareParam<bool>("shortcut", this, &AnytimePathShortening::setShortcut, &AnytimePathShortening::isShortcutting, "0,1");
57 Planner::declareParam<bool>("hybridize", this, &AnytimePathShortening::setHybridize, &AnytimePathShortening::isHybridizing, "0,1");
58 Planner::declareParam<unsigned int>("max_hybrid_paths", this, &AnytimePathShortening::setMaxHybridizationPath, &AnytimePathShortening::maxHybridizationPaths, "0:1:50");
59 Planner::declareParam<unsigned int>("num_planners", this, &AnytimePathShortening::setDefaultNumPlanners, &AnytimePathShortening::getDefaultNumPlanners, "0:64");
73 OMPL_ERROR("NOT adding planner %s: SpaceInformation instances are different", planner->getName().c_str());
82 OMPL_ERROR("NOT adding planner %s: Planner instances MUST be unique", planner->getName().c_str());
90 void ompl::geometric::AnytimePathShortening::setProblemDefinition(const ompl::base::ProblemDefinitionPtr &pdef)
97 ompl::base::PlannerStatus ompl::geometric::AnytimePathShortening::solve(const ompl::base::PlannerTerminationCondition &ptc)
107 OMPL_INFORM("%s: No optimization objective specified. Defaulting to optimizing path length for the allowed planning time.", getName().c_str());
114 OMPL_WARN("The optimization objective is not set for path length. The specified optimization criteria may not be optimized over.");
131 threads[i] = new boost::thread(boost::bind(&AnytimePathShortening::threadSolve, this, planners_[i].get(), ptc));
173 void ompl::geometric::AnytimePathShortening::threadSolve(base::Planner* planner, const base::PlannerTerminationCondition &ptc)
181 geometric::PathGeometric* sln = static_cast<geometric::PathGeometric*>(pdef_->getSolutionPath().get());
201 void ompl::geometric::AnytimePathShortening::getPlannerData(ompl::base::PlannerData &data) const
210 void ompl::geometric::AnytimePathShortening::getPlannerData(ompl::base::PlannerData &data, unsigned int idx) const
248 ompl::base::PlannerPtr ompl::geometric::AnytimePathShortening::getPlanner(unsigned int idx) const
bool approximateSolutions
Flag indicating whether the planner is able to compute approximate solutions.
Definition: Planner.h:214
void addPlannerProgressProperty(const std::string &progressPropertyName, const PlannerProgressProperty &prop)
Add a planner progress property called progressPropertyName with a property querying function prop to...
Definition: Planner.h:391
Object containing planner generated vertex and edge data. It is assumed that all vertices are unique...
Definition: PlannerData.h:164
std::string getBestCost() const
Return best cost found so far by algorithm.
Definition: AnytimePathShortening.cpp:294
bool isShortcutting(void) const
Return whether the anytime planner will perform shortcutting on paths.
Definition: AnytimePathShortening.cpp:254
A boost shared pointer wrapper for ompl::base::ProblemDefinition.
virtual void getPlannerData(base::PlannerData &data) const
Get information about the most recent run of the motion planner.
Definition: AnytimePathShortening.cpp:201
virtual base::PlannerStatus solve(const base::PlannerTerminationCondition &ptc)
Method that solves the motion planning problem. This method terminates under just two conditions...
Definition: AnytimePathShortening.cpp:97
bool isHybridizing(void) const
Return whether the anytime planner will extract a hybrid path from the set of solution paths...
Definition: AnytimePathShortening.cpp:264
void setMaxHybridizationPath(unsigned int maxPathCount)
Set the maximum number of paths that will be hybridized.
Definition: AnytimePathShortening.cpp:279
Encapsulate a termination condition for a motion planner. Planners will call operator() to decide whe...
Definition: PlannerTerminationCondition.h:64
STL namespace.
AnytimePathShortening(const base::SpaceInformationPtr &si)
Constructor requires the space information to plan in.
Definition: AnytimePathShortening.cpp:45
bool multithreaded
Flag indicating whether multiple threads are used in the computation of the planner.
Definition: Planner.h:211
void setHybridize(bool hybridize)
Enable/disable path hybridization on the set of solution paths.
Definition: AnytimePathShortening.cpp:269
void setDefaultNumPlanners(unsigned int numPlanners)
Set default number of planners to use if none are specified.
Definition: AnytimePathShortening.cpp:284
virtual void setProblemDefinition(const base::ProblemDefinitionPtr &pdef)
Set the problem definition for the planners. The problem needs to be set before calling solve()...
Definition: AnytimePathShortening.cpp:90
unsigned int maxHybridPaths_
The maximum number of paths that will be hybridized. This prohibits hybridization of a very large pat...
Definition: AnytimePathShortening.h:165
A boost shared pointer wrapper for ompl::base::Planner.
virtual void clear(void)
Clear all internal planning datastructures. Planner settings are not affected. Subsequent calls to so...
Definition: AnytimePathShortening.cpp:194
std::vector< base::State * > & getStates()
Get the states that make up the path (as a reference, so it can be modified, hence the function is no...
Definition: PathGeometric.h:219
bool hybridize_
Flag indicating whether to hybridize the set of solution paths.
Definition: AnytimePathShortening.h:161
LogLevel getLogLevel()
Retrieve the current level of logging data. Messages with lower logging levels will not be recorded...
Definition: Console.cpp:126
The planner found an exact solution.
Definition: PlannerStatus.h:66
void setLogLevel(LogLevel level)
Set the minimum level of logging data to output. Messages with lower logging levels will not be recor...
Definition: Console.cpp:120
virtual void threadSolve(base::Planner *planner, const base::PlannerTerminationCondition &ptc)
The function that the planning threads execute when solving a motion planning problem.
Definition: AnytimePathShortening.cpp:173
void setShortcut(bool shortcut)
Enable/disable shortcutting on paths.
Definition: AnytimePathShortening.cpp:259
virtual void setup(void)
Perform any necessary configuration steps. This method also invokes ompl::base::SpaceInformation::set...
Definition: AnytimePathShortening.cpp:217
A class to store the exit status of Planner::solve()
Definition: PlannerStatus.h:48
unsigned int maxHybridizationPaths(void) const
Return the maximum number of paths that will be hybridized.
Definition: AnytimePathShortening.cpp:274
This class contains routines that attempt to simplify geometric paths.
Definition: PathSimplifier.h:66
A boost shared pointer wrapper for ompl::base::SpaceInformation.
virtual void setProblemDefinition(const ProblemDefinitionPtr &pdef)
Set the problem definition for the planner. The problem needs to be set before calling solve()...
Definition: Planner.cpp:75
An optimization objective which corresponds to optimizing path length.
Definition: PathLengthOptimizationObjective.h:47
virtual void checkValidity(void)
Check to see if the planners are in a working state (setup has been called, a goal was set...
Definition: AnytimePathShortening.cpp:237
unsigned int defaultNumPlanners_
The number of planners to use if none are specified. This defaults to the number of cores...
Definition: AnytimePathShortening.h:169
unsigned int getNumPlanners(void) const
Retrieve the number of planners added.
Definition: AnytimePathShortening.cpp:243
static base::PlannerPtr getDefaultPlanner(const base::GoalPtr &goal)
Given a goal specification, decide on a planner for that goal.
Definition: SelfConfig.cpp:250
virtual PlannerStatus solve(const PlannerTerminationCondition &ptc)=0
Function that can solve the motion planning problem. This function can be called multiple times on th...
The planner found an approximate solution.
Definition: PlannerStatus.h:64
A boost shared pointer wrapper for ompl::base::OptimizationObjective.
void addPlanner(base::PlannerPtr &planner)
Adds the given planner to the set of planners used to compute candidate paths.
Definition: AnytimePathShortening.cpp:69
bool optimizingPaths
Flag indicating whether the planner attempts to optimize the path and reduce its length until the max...
Definition: Planner.h:218
std::vector< base::PlannerPtr > planners_
The list of planners used for solving the problem.
Definition: AnytimePathShortening.h:155
Given multiple geometric paths, attempt to combine them in order to obtain a shorter solution...
Definition: PathHybridization.h:70
virtual bool isSatisfied(const State *st) const =0
Return true if the state satisfies the goal constraints.
base::PlannerPtr getPlanner(unsigned int i) const
Retrieve a pointer to the ith planner instance.
Definition: AnytimePathShortening.cpp:248
Definition of a cost value. Can represent the cost of a motion or the cost of a state.
Definition: Cost.h:47
A boost shared pointer wrapper for ompl::base::Path.
unsigned int getDefaultNumPlanners() const
Get default number of planners used if none are specified.
Definition: AnytimePathShortening.cpp:289