Optimal Rapidly-exploring Random Trees. More...

#include <ompl/geometric/planners/rrt/RRTstar.h>

Inheritance diagram for ompl::geometric::RRTstar:

Classes

struct  CostIndexCompare
 
class  Motion
 Representation of a motion. More...
 

Public Member Functions

 RRTstar (const base::SpaceInformationPtr &si)
 
void getPlannerData (base::PlannerData &data) const override
 Get information about the current run of the motion planner. Repeated calls to this function will update data (only additions are made). This is useful to see what changed in the exploration datastructure, between calls to solve(), for example (without calling clear() in between).
More...
 
base::PlannerStatus solve (const base::PlannerTerminationCondition &ptc) override
 Function that can solve the motion planning problem. This function can be called multiple times on the same problem, without calling clear() in between. This allows the planner to continue work for more time on an unsolved problem, for example. If this option is used, it is assumed the problem definition is not changed (unpredictable results otherwise). The only change in the problem definition that is accounted for is the addition of starting or goal states (but not changing previously added start/goal states). If clearQuery() is called, the planner may retain prior datastructures generated from a previous query on a new problem definition. The function terminates if the call to ptc returns true. More...
 
void clear () override
 Clear all internal datastructures. Planner settings are not affected. Subsequent calls to solve() will ignore all previous work. More...
 
void setup () override
 Perform extra configuration steps, if needed. This call will also issue a call to ompl::base::SpaceInformation::setup() if needed. This must be called before solving. More...
 
void setGoalBias (double goalBias)
 Set the goal bias. More...
 
double getGoalBias () const
 Get the goal bias the planner is using. More...
 
void setRange (double distance)
 Set the range the planner is supposed to use. More...
 
double getRange () const
 Get the range the planner is using. More...
 
void setRewireFactor (double rewireFactor)
 Set the rewiring scale factor, s, such that r_rrg = s \times r_rrg* (or k_rrg = s \times k_rrg*) More...
 
double getRewireFactor () const
 Set the rewiring scale factor, s, such that r_rrg = s \times r_rrg* > r_rrg* (or k_rrg = s \times k_rrg* > k_rrg*) More...
 
template<template< typename T > class NN>
void setNearestNeighbors ()
 Set a different nearest neighbors datastructure. More...
 
void setDelayCC (bool delayCC)
 Option that delays collision checking procedures. When it is enabled, all neighbors are sorted by cost. The planner then goes through this list, starting with the lowest cost, checking for collisions in order to find a parent. The planner stops iterating through the list when a collision free parent is found. This prevents the planner from collision checking each neighbor, reducing computation time in scenarios where collision checking procedures are expensive. More...
 
bool getDelayCC () const
 Get the state of the delayed collision checking option. More...
 
void setTreePruning (bool prune)
 Controls whether the tree is pruned during the search. This pruning removes a vertex if and only if it and all its descendents passes the pruning condition. The pruning condition is whether the lower-bounding estimate of a solution constrained to pass the the vertex is greater than the current solution. Considering the descendents of a vertex prevents removing a descendent that may actually be capable of later providing a better solution once its incoming path passes through a different vertex (e.g., a change in homotopy class). More...
 
bool getTreePruning () const
 Get the state of the pruning option. More...
 
void setPruneThreshold (const double pp)
 Set the fractional change in solution cost necessary for pruning to occur, i.e., prune if the new solution is at least X% better than the old solution. (e.g., 0.0 will prune after every new solution, while 1.0 will never prune.) More...
 
double getPruneThreshold () const
 Get the current prune states percentage threshold parameter. More...
 
void setPrunedMeasure (bool informedMeasure)
 Use the measure of the pruned subproblem instead of the measure of the entire problem domain (if such an expression exists and a solution is present). Currently the only method to calculate this measure in closed-form is through a informed sampler, so this option also requires that. More...
 
bool getPrunedMeasure () const
 Get the state of using the pruned measure. More...
 
void setInformedSampling (bool informedSampling)
 Use direct sampling of the heuristic for the generation of random samples (e.g., x_rand). If a direct sampling method is not defined for the objective, rejection sampling will be used by default. More...
 
bool getInformedSampling () const
 Get the state direct heuristic sampling. More...
 
void setSampleRejection (bool reject)
 Controls whether heuristic rejection is used on samples (e.g., x_rand) More...
 
bool getSampleRejection () const
 Get the state of the sample rejection option. More...
 
void setNewStateRejection (const bool reject)
 Controls whether heuristic rejection is used on new states before connection (e.g., x_new = steer(x_nearest, x_rand)) More...
 
bool getNewStateRejection () const
 Get the state of the new-state rejection option. More...
 
void setAdmissibleCostToCome (const bool admissible)
 Controls whether pruning and new-state rejection uses an admissible cost-to-come estimate or not. More...
 
bool getAdmissibleCostToCome () const
 Get the admissibility of the pruning and new-state rejection heuristic. More...
 
void setOrderedSampling (bool orderSamples)
 Controls whether samples are returned in ordered by the heuristic. This is accomplished by generating a batch at a time. More...
 
bool getOrderedSampling () const
 Get the state of sample ordering. More...
 
void setBatchSize (unsigned int batchSize)
 Set the batch size used for sample ordering. More...
 
unsigned int getBatchSize () const
 Get the batch size used for sample ordering. More...
 
void setFocusSearch (const bool focus)
 A meta parameter to focusing the search to improving the current solution. This is the parameter set by CFOREST. For RRT*, search focusing consists of pruning the existing search and limiting future search. Specifically, this is accomplished by turning on informed sampling, tree pruning and new-state rejection. This flag individually sets the options described above. More...
 
bool getFocusSearch () const
 Get the state of search focusing. More...
 
void setKNearest (bool useKNearest)
 Use a k-nearest search for rewiring instead of a r-disc search. More...
 
bool getKNearest () const
 Get the state of using a k-nearest search for rewiring. More...
 
void setNumSamplingAttempts (unsigned int numAttempts)
 Set the number of attempts to make while performing rejection or informed sampling. More...
 
unsigned int getNumSamplingAttempts () const
 Get the number of attempts to make while performing rejection or informed sampling. More...
 
unsigned int numIterations () const
 
ompl::base::Cost bestCost () const
 
- Public Member Functions inherited from ompl::base::Planner
 Planner (const Planner &)=delete
 
Planneroperator= (const Planner &)=delete
 
 Planner (SpaceInformationPtr si, std::string name)
 Constructor. More...
 
virtual ~Planner ()=default
 Destructor.
 
template<class T >
T * as ()
 Cast this instance to a desired type. More...
 
template<class T >
const T * as () const
 Cast this instance to a desired type. More...
 
const SpaceInformationPtrgetSpaceInformation () const
 Get the space information this planner is using. More...
 
const ProblemDefinitionPtrgetProblemDefinition () const
 Get the problem definition the planner is trying to solve. More...
 
ProblemDefinitionPtrgetProblemDefinition ()
 Get the problem definition the planner is trying to solve. More...
 
const PlannerInputStatesgetPlannerInputStates () const
 Get the planner input states. More...
 
virtual void setProblemDefinition (const ProblemDefinitionPtr &pdef)
 Set the problem definition for the planner. The problem needs to be set before calling solve(). Note: If this problem definition replaces a previous one, it may also be necessary to call clear() or clearQuery(). More...
 
virtual PlannerStatus solve (const PlannerTerminationCondition &ptc)=0
 Function that can solve the motion planning problem. This function can be called multiple times on the same problem, without calling clear() in between. This allows the planner to continue work for more time on an unsolved problem, for example. If this option is used, it is assumed the problem definition is not changed (unpredictable results otherwise). The only change in the problem definition that is accounted for is the addition of starting or goal states (but not changing previously added start/goal states). If clearQuery() is called, the planner may retain prior datastructures generated from a previous query on a new problem definition. The function terminates if the call to ptc returns true. More...
 
PlannerStatus solve (const PlannerTerminationConditionFn &ptc, double checkInterval)
 Same as above except the termination condition is only evaluated at a specified interval. More...
 
PlannerStatus solve (double solveTime)
 Same as above except the termination condition is solely a time limit: the number of seconds the algorithm is allowed to spend planning. More...
 
virtual void clear ()
 Clear all internal datastructures. Planner settings are not affected. Subsequent calls to solve() will ignore all previous work. More...
 
virtual void clearQuery ()
 Clears internal datastructures of any query-specific information from the previous query. Planner settings are not affected. The planner, if able, should retain all datastructures generated from previous queries that can be used to help solve the next query. Note that clear() should also clear all query-specific information along with all other datastructures in the planner. By default clearQuery() calls clear(). More...
 
virtual void getPlannerData (PlannerData &data) const
 Get information about the current run of the motion planner. Repeated calls to this function will update data (only additions are made). This is useful to see what changed in the exploration datastructure, between calls to solve(), for example (without calling clear() in between).
More...
 
const std::string & getName () const
 Get the name of the planner. More...
 
void setName (const std::string &name)
 Set the name of the planner. More...
 
const PlannerSpecsgetSpecs () const
 Return the specifications (capabilities of this planner) More...
 
virtual void setup ()
 Perform extra configuration steps, if needed. This call will also issue a call to ompl::base::SpaceInformation::setup() if needed. This must be called before solving. More...
 
virtual void checkValidity ()
 Check to see if the planner is in a working state (setup has been called, a goal was set, the input states seem to be in order). In case of error, this function throws an exception. More...
 
bool isSetup () const
 Check if setup() was called for this planner. More...
 
ParamSetparams ()
 Get the parameters for this planner. More...
 
const ParamSetparams () const
 Get the parameters for this planner. More...
 
const PlannerProgressPropertiesgetPlannerProgressProperties () const
 Retrieve a planner's planner progress property map. More...
 
virtual void printProperties (std::ostream &out) const
 Print properties of the motion planner. More...
 
virtual void printSettings (std::ostream &out) const
 Print information about the motion planner's settings. More...
 

Protected Member Functions

void allocSampler ()
 Create the samplers. More...
 
bool sampleUniform (base::State *statePtr)
 Generate a sample. More...
 
void freeMemory ()
 Free the memory allocated by this planner. More...
 
double distanceFunction (const Motion *a, const Motion *b) const
 Compute distance between motions (actually distance between contained states) More...
 
void getNeighbors (Motion *motion, std::vector< Motion * > &nbh) const
 Gets the neighbours of a given motion, using either k-nearest of radius as appropriate. More...
 
void removeFromParent (Motion *m)
 Removes the given motion from the parent's child list. More...
 
void updateChildCosts (Motion *m)
 Updates the cost of the children of this node if the cost up to this node has changed. More...
 
int pruneTree (const base::Cost &pruneTreeCost)
 Prunes all those states which estimated total cost is higher than pruneTreeCost. Returns the number of motions pruned. Depends on the parameter set by setPruneStatesImprovementThreshold() More...
 
base::Cost solutionHeuristic (const Motion *motion) const
 Computes the solution cost heuristically as the cost to come from start to the motion plus the cost to go from the motion to the goal. If the parameter use_admissible_heuristic (setAdmissibleCostToCome()) is true, a heuristic estimate of the cost to come is used; otherwise, the current cost to come to the motion is used (which may overestimate the cost through the motion). More...
 
void addChildrenToList (std::queue< Motion *, std::deque< Motion * > > *motionList, Motion *motion)
 Add the children of a vertex to the given list. More...
 
bool keepCondition (const Motion *motion, const base::Cost &threshold) const
 Check whether the given motion passes the specified cost threshold, meaning it will be kept during pruning. More...
 
void calculateRewiringLowerBounds ()
 Calculate the k_RRG* and r_RRG* terms. More...
 
std::string numIterationsProperty () const
 
std::string bestCostProperty () const
 
- Protected Member Functions inherited from ompl::base::Planner
template<typename T , typename PlannerType , typename SetterType , typename GetterType >
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 functions. More...
 
template<typename T , typename PlannerType , typename SetterType >
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. More...
 
void addPlannerProgressProperty (const std::string &progressPropertyName, const PlannerProgressProperty &prop)
 Add a planner progress property called progressPropertyName with a property querying function prop to this planner's progress property map. More...
 

Protected Attributes

base::StateSamplerPtr sampler_
 State sampler. More...
 
base::InformedSamplerPtr infSampler_
 An informed sampler. More...
 
std::shared_ptr< NearestNeighbors< Motion * > > nn_
 A nearest-neighbors datastructure containing the tree of motions. More...
 
double goalBias_ {.05}
 The fraction of time the goal is picked as the state to expand towards (if such a state is available) More...
 
double maxDistance_ {0.}
 The maximum length of a motion to be added to a tree. More...
 
RNG rng_
 The random number generator. More...
 
bool useKNearest_ {true}
 Option to use k-nearest search for rewiring. More...
 
double rewireFactor_ {1.1}
 The rewiring factor, s, so that r_rrt = s \times r_rrt* > r_rrt* (or k_rrt = s \times k_rrt* > k_rrt*) More...
 
double k_rrt_ {0u}
 A constant for k-nearest rewiring calculations. More...
 
double r_rrt_ {0.}
 A constant for r-disc rewiring calculations. More...
 
bool delayCC_ {true}
 Option to delay and reduce collision checking within iterations. More...
 
base::OptimizationObjectivePtr opt_
 Objective we're optimizing. More...
 
MotionbestGoalMotion_ {nullptr}
 The best goal motion. More...
 
std::vector< Motion * > goalMotions_
 A list of states in the tree that satisfy the goal condition. More...
 
bool useTreePruning_ {false}
 The status of the tree pruning option. More...
 
double pruneThreshold_ {.05}
 The tree is pruned when the change in solution cost is greater than this fraction. More...
 
bool usePrunedMeasure_ {false}
 Option to use the informed measure. More...
 
bool useInformedSampling_ {false}
 Option to use informed sampling. More...
 
bool useRejectionSampling_ {false}
 The status of the sample rejection parameter. More...
 
bool useNewStateRejection_ {false}
 The status of the new-state rejection parameter. More...
 
bool useAdmissibleCostToCome_ {true}
 The admissibility of the new-state rejection heuristic. More...
 
unsigned int numSampleAttempts_ {100u}
 The number of attempts to make at informed sampling. More...
 
bool useOrderedSampling_ {false}
 Option to create batches of samples and order them. More...
 
unsigned int batchSize_ {1u}
 The size of the batches. More...
 
std::vector< Motion * > startMotions_
 Stores the start states as Motions. More...
 
base::Cost bestCost_ {std::numeric_limits<double>::quiet_NaN()}
 Best cost found so far by algorithm. More...
 
base::Cost prunedCost_ {std::numeric_limits<double>::quiet_NaN()}
 The cost at which the graph was last pruned. More...
 
double prunedMeasure_ {0.}
 The measure of the problem when we pruned it (if this isn't in use, it will be set to si_->getSpaceMeasure()) More...
 
unsigned int iterations_ {0u}
 Number of iterations the algorithm performed. More...
 
- Protected Attributes inherited from ompl::base::Planner
SpaceInformationPtr si_
 The space information for which planning is done. More...
 
ProblemDefinitionPtr pdef_
 The user set problem definition. More...
 
PlannerInputStates pis_
 Utility class to extract valid input states
More...
 
std::string name_
 The name of this planner. More...
 
PlannerSpecs specs_
 The specifications of the planner (its capabilities) More...
 
ParamSet params_
 A map from parameter names to parameter instances for this planner. This field is populated by the declareParam() function. More...
 
PlannerProgressProperties plannerProgressProperties_
 A mapping between this planner's progress property names and the functions used for querying those progress properties. More...
 
bool setup_
 Flag indicating whether setup() has been called. More...
 

Additional Inherited Members

- Public Types inherited from ompl::base::Planner
using PlannerProgressProperty = std::function< std::string()>
 Definition of a function which returns a property about the planner's progress that can be queried by a benchmarking routine. More...
 
using PlannerProgressProperties = std::map< std::string, PlannerProgressProperty >
 A dictionary which maps the name of a progress property to the function to be used for querying that property. More...
 

Detailed Description

Optimal Rapidly-exploring Random Trees.

Short description
RRT* (optimal RRT) is an asymptotically-optimal incremental sampling-based motion planning algorithm. RRT* algorithm is guaranteed to converge to an optimal solution, while its running time is guaranteed to be a constant factor of the running time of the RRT. The notion of optimality is with respect to a specified OptimizationObjective (set in the ProblemDefinition). If a solution path's cost is within a user-specified cost-threshold, the algorithm terminates before the elapsed time.
External documentation
S. Karaman and E. Frazzoli, Sampling-based Algorithms for Optimal Motion Planning, International Journal of Robotics Research, Vol 30, No 7, 2011. https://arxiv.org/abs/1105.1186

Definition at line 74 of file RRTstar.h.

Constructor & Destructor Documentation

◆ RRTstar()

ompl::geometric::RRTstar::RRTstar ( const base::SpaceInformationPtr &  si)

Definition at line 52 of file RRTstar.cpp.

◆ ~RRTstar()

ompl::geometric::RRTstar::~RRTstar ( )
override

Definition at line 89 of file RRTstar.cpp.

Member Function Documentation

◆ addChildrenToList()

void ompl::geometric::RRTstar::addChildrenToList ( std::queue< Motion *, std::deque< Motion * > > *  motionList,
Motion motion 
)
protected

Add the children of a vertex to the given list.

Definition at line 875 of file RRTstar.cpp.

◆ allocSampler()

void ompl::geometric::RRTstar::allocSampler ( )
protected

Create the samplers.

Definition at line 1097 of file RRTstar.cpp.

◆ bestCost()

ompl::base::Cost ompl::geometric::RRTstar::bestCost ( ) const
inline

Definition at line 326 of file RRTstar.h.

◆ bestCostProperty()

std::string ompl::geometric::RRTstar::bestCostProperty ( ) const
inlineprotected

Definition at line 521 of file RRTstar.h.

◆ calculateRewiringLowerBounds()

void ompl::geometric::RRTstar::calculateRewiringLowerBounds ( )
protected

Calculate the k_RRG* and r_RRG* terms.

Definition at line 1147 of file RRTstar.cpp.

◆ clear()

void ompl::geometric::RRTstar::clear ( )
overridevirtual

Clear all internal datastructures. Planner settings are not affected. Subsequent calls to solve() will ignore all previous work.

Reimplemented from ompl::base::Planner.

Definition at line 145 of file RRTstar.cpp.

◆ distanceFunction()

double ompl::geometric::RRTstar::distanceFunction ( const Motion a,
const Motion b 
) const
inlineprotected

Compute distance between motions (actually distance between contained states)

Definition at line 389 of file RRTstar.h.

◆ freeMemory()

void ompl::geometric::RRTstar::freeMemory ( )
protected

Free the memory allocated by this planner.

Definition at line 641 of file RRTstar.cpp.

◆ getAdmissibleCostToCome()

bool ompl::geometric::RRTstar::getAdmissibleCostToCome ( ) const
inline

Get the admissibility of the pruning and new-state rejection heuristic.

Definition at line 250 of file RRTstar.h.

◆ getBatchSize()

unsigned int ompl::geometric::RRTstar::getBatchSize ( ) const
inline

Get the batch size used for sample ordering.

Definition at line 272 of file RRTstar.h.

◆ getDelayCC()

bool ompl::geometric::RRTstar::getDelayCC ( ) const
inline

Get the state of the delayed collision checking option.

Definition at line 164 of file RRTstar.h.

◆ getFocusSearch()

bool ompl::geometric::RRTstar::getFocusSearch ( ) const
inline

Get the state of search focusing.

Definition at line 292 of file RRTstar.h.

◆ getGoalBias()

double ompl::geometric::RRTstar::getGoalBias ( ) const
inline

Get the goal bias the planner is using.

Definition at line 104 of file RRTstar.h.

◆ getInformedSampling()

bool ompl::geometric::RRTstar::getInformedSampling ( ) const
inline

Get the state direct heuristic sampling.

Definition at line 215 of file RRTstar.h.

◆ getKNearest()

bool ompl::geometric::RRTstar::getKNearest ( ) const
inline

Get the state of using a k-nearest search for rewiring.

Definition at line 304 of file RRTstar.h.

◆ getNeighbors()

void ompl::geometric::RRTstar::getNeighbors ( Motion motion,
std::vector< Motion * > &  nbh 
) const
protected

Gets the neighbours of a given motion, using either k-nearest of radius as appropriate.

Definition at line 603 of file RRTstar.cpp.

◆ getNewStateRejection()

bool ompl::geometric::RRTstar::getNewStateRejection ( ) const
inline

Get the state of the new-state rejection option.

Definition at line 237 of file RRTstar.h.

◆ getNumSamplingAttempts()

unsigned int ompl::geometric::RRTstar::getNumSamplingAttempts ( ) const
inline

Get the number of attempts to make while performing rejection or informed sampling.

Definition at line 316 of file RRTstar.h.

◆ getOrderedSampling()

bool ompl::geometric::RRTstar::getOrderedSampling ( ) const
inline

Get the state of sample ordering.

Definition at line 260 of file RRTstar.h.

◆ getPlannerData()

void ompl::geometric::RRTstar::getPlannerData ( base::PlannerData data) const
overridevirtual

Get information about the current run of the motion planner. Repeated calls to this function will update data (only additions are made). This is useful to see what changed in the exploration datastructure, between calls to solve(), for example (without calling clear() in between).

Reimplemented from ompl::base::Planner.

Definition at line 656 of file RRTstar.cpp.

◆ getPrunedMeasure()

bool ompl::geometric::RRTstar::getPrunedMeasure ( ) const
inline

Get the state of using the pruned measure.

Definition at line 205 of file RRTstar.h.

◆ getPruneThreshold()

double ompl::geometric::RRTstar::getPruneThreshold ( ) const
inline

Get the current prune states percentage threshold parameter.

Definition at line 193 of file RRTstar.h.

◆ getRange()

double ompl::geometric::RRTstar::getRange ( ) const
inline

Get the range the planner is using.

Definition at line 120 of file RRTstar.h.

◆ getRewireFactor()

double ompl::geometric::RRTstar::getRewireFactor ( ) const
inline

Set the rewiring scale factor, s, such that r_rrg = s \times r_rrg* > r_rrg* (or k_rrg = s \times k_rrg* > k_rrg*)

Definition at line 135 of file RRTstar.h.

◆ getSampleRejection()

bool ompl::geometric::RRTstar::getSampleRejection ( ) const
inline

Get the state of the sample rejection option.

Definition at line 224 of file RRTstar.h.

◆ getTreePruning()

bool ompl::geometric::RRTstar::getTreePruning ( ) const
inline

Get the state of the pruning option.

Definition at line 179 of file RRTstar.h.

◆ keepCondition()

bool ompl::geometric::RRTstar::keepCondition ( const Motion motion,
const base::Cost threshold 
) const
protected

Check whether the given motion passes the specified cost threshold, meaning it will be kept during pruning.

Definition at line 883 of file RRTstar.cpp.

◆ numIterations()

unsigned int ompl::geometric::RRTstar::numIterations ( ) const
inline

Definition at line 321 of file RRTstar.h.

◆ numIterationsProperty()

std::string ompl::geometric::RRTstar::numIterationsProperty ( ) const
inlineprotected

Definition at line 517 of file RRTstar.h.

◆ pruneTree()

int ompl::geometric::RRTstar::pruneTree ( const base::Cost pruneTreeCost)
protected

Prunes all those states which estimated total cost is higher than pruneTreeCost. Returns the number of motions pruned. Depends on the parameter set by setPruneStatesImprovementThreshold()

Definition at line 676 of file RRTstar.cpp.

◆ removeFromParent()

void ompl::geometric::RRTstar::removeFromParent ( Motion m)
protected

Removes the given motion from the parent's child list.

Definition at line 620 of file RRTstar.cpp.

◆ sampleUniform()

bool ompl::geometric::RRTstar::sampleUniform ( base::State statePtr)
protected

Generate a sample.

Definition at line 1126 of file RRTstar.cpp.

◆ setAdmissibleCostToCome()

void ompl::geometric::RRTstar::setAdmissibleCostToCome ( const bool  admissible)
inline

Controls whether pruning and new-state rejection uses an admissible cost-to-come estimate or not.

Definition at line 244 of file RRTstar.h.

◆ setBatchSize()

void ompl::geometric::RRTstar::setBatchSize ( unsigned int  batchSize)
inline

Set the batch size used for sample ordering.

Definition at line 266 of file RRTstar.h.

◆ setDelayCC()

void ompl::geometric::RRTstar::setDelayCC ( bool  delayCC)
inline

Option that delays collision checking procedures. When it is enabled, all neighbors are sorted by cost. The planner then goes through this list, starting with the lowest cost, checking for collisions in order to find a parent. The planner stops iterating through the list when a collision free parent is found. This prevents the planner from collision checking each neighbor, reducing computation time in scenarios where collision checking procedures are expensive.

Definition at line 158 of file RRTstar.h.

◆ setFocusSearch()

void ompl::geometric::RRTstar::setFocusSearch ( const bool  focus)
inline

A meta parameter to focusing the search to improving the current solution. This is the parameter set by CFOREST. For RRT*, search focusing consists of pruning the existing search and limiting future search. Specifically, this is accomplished by turning on informed sampling, tree pruning and new-state rejection. This flag individually sets the options described above.

Definition at line 283 of file RRTstar.h.

◆ setGoalBias()

void ompl::geometric::RRTstar::setGoalBias ( double  goalBias)
inline

Set the goal bias.

In the process of randomly selecting states in the state space to attempt to go towards, the algorithm may in fact choose the actual goal state, if it knows it, with some probability. This probability is a real number between 0.0 and 1.0; its value should usually be around 0.05 and should not be too large. It is probably a good idea to use the default value.

Definition at line 98 of file RRTstar.h.

◆ setInformedSampling()

void ompl::geometric::RRTstar::setInformedSampling ( bool  informedSampling)

Use direct sampling of the heuristic for the generation of random samples (e.g., x_rand). If a direct sampling method is not defined for the objective, rejection sampling will be used by default.

Definition at line 985 of file RRTstar.cpp.

◆ setKNearest()

void ompl::geometric::RRTstar::setKNearest ( bool  useKNearest)
inline

Use a k-nearest search for rewiring instead of a r-disc search.

Definition at line 298 of file RRTstar.h.

◆ setNearestNeighbors()

template<template< typename T > class NN>
void ompl::geometric::RRTstar::setNearestNeighbors ( )
inline

Set a different nearest neighbors datastructure.

Definition at line 142 of file RRTstar.h.

◆ setNewStateRejection()

void ompl::geometric::RRTstar::setNewStateRejection ( const bool  reject)
inline

Controls whether heuristic rejection is used on new states before connection (e.g., x_new = steer(x_nearest, x_rand))

Definition at line 231 of file RRTstar.h.

◆ setNumSamplingAttempts()

void ompl::geometric::RRTstar::setNumSamplingAttempts ( unsigned int  numAttempts)
inline

Set the number of attempts to make while performing rejection or informed sampling.

Definition at line 310 of file RRTstar.h.

◆ setOrderedSampling()

void ompl::geometric::RRTstar::setOrderedSampling ( bool  orderSamples)

Controls whether samples are returned in ordered by the heuristic. This is accomplished by generating a batch at a time.

Definition at line 1069 of file RRTstar.cpp.

◆ setPrunedMeasure()

void ompl::geometric::RRTstar::setPrunedMeasure ( bool  informedMeasure)

Use the measure of the pruned subproblem instead of the measure of the entire problem domain (if such an expression exists and a solution is present). Currently the only method to calculate this measure in closed-form is through a informed sampler, so this option also requires that.

Definition at line 942 of file RRTstar.cpp.

◆ setPruneThreshold()

void ompl::geometric::RRTstar::setPruneThreshold ( const double  pp)
inline

Set the fractional change in solution cost necessary for pruning to occur, i.e., prune if the new solution is at least X% better than the old solution. (e.g., 0.0 will prune after every new solution, while 1.0 will never prune.)

Definition at line 187 of file RRTstar.h.

◆ setRange()

void ompl::geometric::RRTstar::setRange ( double  distance)
inline

Set the range the planner is supposed to use.

This parameter greatly influences the runtime of the algorithm. It represents the maximum length of a motion to be added in the tree of motions.

Definition at line 114 of file RRTstar.h.

◆ setRewireFactor()

void ompl::geometric::RRTstar::setRewireFactor ( double  rewireFactor)
inline

Set the rewiring scale factor, s, such that r_rrg = s \times r_rrg* (or k_rrg = s \times k_rrg*)

Definition at line 127 of file RRTstar.h.

◆ setSampleRejection()

void ompl::geometric::RRTstar::setSampleRejection ( bool  reject)

Controls whether heuristic rejection is used on samples (e.g., x_rand)

Definition at line 1033 of file RRTstar.cpp.

◆ setTreePruning()

void ompl::geometric::RRTstar::setTreePruning ( bool  prune)

Controls whether the tree is pruned during the search. This pruning removes a vertex if and only if it and all its descendents passes the pruning condition. The pruning condition is whether the lower-bounding estimate of a solution constrained to pass the the vertex is greater than the current solution. Considering the descendents of a vertex prevents removing a descendent that may actually be capable of later providing a better solution once its incoming path passes through a different vertex (e.g., a change in homotopy class).

Definition at line 922 of file RRTstar.cpp.

◆ setup()

void ompl::geometric::RRTstar::setup ( )
overridevirtual

Perform extra configuration steps, if needed. This call will also issue a call to ompl::base::SpaceInformation::setup() if needed. This must be called before solving.

Reimplemented from ompl::base::Planner.

Definition at line 94 of file RRTstar.cpp.

◆ solutionHeuristic()

ompl::base::Cost ompl::geometric::RRTstar::solutionHeuristic ( const Motion motion) const
protected

Computes the solution cost heuristically as the cost to come from start to the motion plus the cost to go from the motion to the goal. If the parameter use_admissible_heuristic (setAdmissibleCostToCome()) is true, a heuristic estimate of the cost to come is used; otherwise, the current cost to come to the motion is used (which may overestimate the cost through the motion).

Definition at line 896 of file RRTstar.cpp.

◆ solve()

ompl::base::PlannerStatus ompl::geometric::RRTstar::solve ( const base::PlannerTerminationCondition ptc)
overridevirtual

Function that can solve the motion planning problem. This function can be called multiple times on the same problem, without calling clear() in between. This allows the planner to continue work for more time on an unsolved problem, for example. If this option is used, it is assumed the problem definition is not changed (unpredictable results otherwise). The only change in the problem definition that is accounted for is the addition of starting or goal states (but not changing previously added start/goal states). If clearQuery() is called, the planner may retain prior datastructures generated from a previous query on a new problem definition. The function terminates if the call to ptc returns true.

Implements ompl::base::Planner.

Definition at line 165 of file RRTstar.cpp.

◆ updateChildCosts()

void ompl::geometric::RRTstar::updateChildCosts ( Motion m)
protected

Updates the cost of the children of this node if the cost up to this node has changed.

Definition at line 632 of file RRTstar.cpp.

Member Data Documentation

◆ batchSize_

unsigned int ompl::geometric::RRTstar::batchSize_ {1u}
protected

The size of the batches.

Definition at line 497 of file RRTstar.h.

◆ bestCost_

base::Cost ompl::geometric::RRTstar::bestCost_ {std::numeric_limits<double>::quiet_NaN()}
protected

Best cost found so far by algorithm.

Definition at line 503 of file RRTstar.h.

◆ bestGoalMotion_

Motion* ompl::geometric::RRTstar::bestGoalMotion_ {nullptr}
protected

The best goal motion.

Definition at line 464 of file RRTstar.h.

◆ delayCC_

bool ompl::geometric::RRTstar::delayCC_ {true}
protected

Option to delay and reduce collision checking within iterations.

Definition at line 458 of file RRTstar.h.

◆ goalBias_

double ompl::geometric::RRTstar::goalBias_ {.05}
protected

The fraction of time the goal is picked as the state to expand towards (if such a state is available)

Definition at line 436 of file RRTstar.h.

◆ goalMotions_

std::vector<Motion *> ompl::geometric::RRTstar::goalMotions_
protected

A list of states in the tree that satisfy the goal condition.

Definition at line 467 of file RRTstar.h.

◆ infSampler_

base::InformedSamplerPtr ompl::geometric::RRTstar::infSampler_
protected

An informed sampler.

Definition at line 429 of file RRTstar.h.

◆ iterations_

unsigned int ompl::geometric::RRTstar::iterations_ {0u}
protected

Number of iterations the algorithm performed.

Definition at line 513 of file RRTstar.h.

◆ k_rrt_

double ompl::geometric::RRTstar::k_rrt_ {0u}
protected

A constant for k-nearest rewiring calculations.

Definition at line 452 of file RRTstar.h.

◆ maxDistance_

double ompl::geometric::RRTstar::maxDistance_ {0.}
protected

The maximum length of a motion to be added to a tree.

Definition at line 439 of file RRTstar.h.

◆ nn_

std::shared_ptr<NearestNeighbors<Motion *> > ompl::geometric::RRTstar::nn_
protected

A nearest-neighbors datastructure containing the tree of motions.

Definition at line 432 of file RRTstar.h.

◆ numSampleAttempts_

unsigned int ompl::geometric::RRTstar::numSampleAttempts_ {100u}
protected

The number of attempts to make at informed sampling.

Definition at line 491 of file RRTstar.h.

◆ opt_

base::OptimizationObjectivePtr ompl::geometric::RRTstar::opt_
protected

Objective we're optimizing.

Definition at line 461 of file RRTstar.h.

◆ prunedCost_

base::Cost ompl::geometric::RRTstar::prunedCost_ {std::numeric_limits<double>::quiet_NaN()}
protected

The cost at which the graph was last pruned.

Definition at line 506 of file RRTstar.h.

◆ prunedMeasure_

double ompl::geometric::RRTstar::prunedMeasure_ {0.}
protected

The measure of the problem when we pruned it (if this isn't in use, it will be set to si_->getSpaceMeasure())

Definition at line 510 of file RRTstar.h.

◆ pruneThreshold_

double ompl::geometric::RRTstar::pruneThreshold_ {.05}
protected

The tree is pruned when the change in solution cost is greater than this fraction.

Definition at line 473 of file RRTstar.h.

◆ r_rrt_

double ompl::geometric::RRTstar::r_rrt_ {0.}
protected

A constant for r-disc rewiring calculations.

Definition at line 455 of file RRTstar.h.

◆ rewireFactor_

double ompl::geometric::RRTstar::rewireFactor_ {1.1}
protected

The rewiring factor, s, so that r_rrt = s \times r_rrt* > r_rrt* (or k_rrt = s \times k_rrt* > k_rrt*)

Definition at line 449 of file RRTstar.h.

◆ rng_

RNG ompl::geometric::RRTstar::rng_
protected

The random number generator.

Definition at line 442 of file RRTstar.h.

◆ sampler_

base::StateSamplerPtr ompl::geometric::RRTstar::sampler_
protected

State sampler.

Definition at line 426 of file RRTstar.h.

◆ startMotions_

std::vector<Motion *> ompl::geometric::RRTstar::startMotions_
protected

Stores the start states as Motions.

Definition at line 500 of file RRTstar.h.

◆ useAdmissibleCostToCome_

bool ompl::geometric::RRTstar::useAdmissibleCostToCome_ {true}
protected

The admissibility of the new-state rejection heuristic.

Definition at line 488 of file RRTstar.h.

◆ useInformedSampling_

bool ompl::geometric::RRTstar::useInformedSampling_ {false}
protected

Option to use informed sampling.

Definition at line 479 of file RRTstar.h.

◆ useKNearest_

bool ompl::geometric::RRTstar::useKNearest_ {true}
protected

Option to use k-nearest search for rewiring.

Definition at line 445 of file RRTstar.h.

◆ useNewStateRejection_

bool ompl::geometric::RRTstar::useNewStateRejection_ {false}
protected

The status of the new-state rejection parameter.

Definition at line 485 of file RRTstar.h.

◆ useOrderedSampling_

bool ompl::geometric::RRTstar::useOrderedSampling_ {false}
protected

Option to create batches of samples and order them.

Definition at line 494 of file RRTstar.h.

◆ usePrunedMeasure_

bool ompl::geometric::RRTstar::usePrunedMeasure_ {false}
protected

Option to use the informed measure.

Definition at line 476 of file RRTstar.h.

◆ useRejectionSampling_

bool ompl::geometric::RRTstar::useRejectionSampling_ {false}
protected

The status of the sample rejection parameter.

Definition at line 482 of file RRTstar.h.

◆ useTreePruning_

bool ompl::geometric::RRTstar::useTreePruning_ {false}
protected

The status of the tree pruning option.

Definition at line 470 of file RRTstar.h.


The documentation for this class was generated from the following files: