SPArse Roadmap Spanner Version 2.0 More...

#include <ompl/tools/thunder/SPARSdb.h>

Inheritance diagram for ompl::geometric::SPARSdb:

Classes

struct  CandidateSolution
 Struct for passing around partially solved solutions. More...
 
class  CustomVisitor
 
struct  edge_collision_state_t
 
class  edgeWeightMap
 
class  foundGoalException
 
struct  InterfaceData
 Interface information storage class, which does bookkeeping for criterion four. More...
 
struct  InterfaceHashStruct
 
struct  vertex_color_t
 
struct  vertex_interface_data_t
 
struct  vertex_state_t
 

Public Types

enum  GuardType {
  START , GOAL , COVERAGE , CONNECTIVITY ,
  INTERFACE , QUALITY
}
 Enumeration which specifies the reason a guard is added to the spanner. More...
 
enum  EdgeCollisionState { NOT_CHECKED , IN_COLLISION , FREE }
 Possible collision states of an edge. More...
 
using VertexIndexType = unsigned long int
 The type used internally for representing vertex IDs. More...
 
using VertexPair = std::pair< VertexIndexType, VertexIndexType >
 Pair of vertices which support an interface. More...
 
using InterfaceHash = std::unordered_map< VertexPair, InterfaceData >
 the hash which maps pairs of neighbor points to pairs of states More...
 
using VertexProperties = boost::property< vertex_state_t, base::State *, boost::property< boost::vertex_predecessor_t, VertexIndexType, boost::property< boost::vertex_rank_t, VertexIndexType, boost::property< vertex_color_t, GuardType, boost::property< vertex_interface_data_t, InterfaceHashStruct > > > > >
 The underlying roadmap graph. More...
 
using EdgeProperties = boost::property< boost::edge_weight_t, double, boost::property< edge_collision_state_t, int > >
 
using Graph = boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, VertexProperties, EdgeProperties >
 
using Vertex = boost::graph_traits< Graph >::vertex_descriptor
 Vertex in Graph. More...
 
using Edge = boost::graph_traits< Graph >::edge_descriptor
 Edge in Graph. More...
 
using EdgeCollisionStateMap = boost::property_map< Graph, edge_collision_state_t >::type
 Access map that stores the lazy collision checking status of each edge. More...
 
- 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...
 

Public Member Functions

 SPARSdb (const base::SpaceInformationPtr &si)
 Constructor. More...
 
 ~SPARSdb () override
 Destructor. More...
 
void setProblemDefinition (const base::ProblemDefinitionPtr &pdef) override
 
void setStretchFactor (double t)
 Sets the stretch factor. More...
 
void setSparseDeltaFraction (double D)
 Sets vertex visibility range as a fraction of max. extent. More...
 
void setDenseDeltaFraction (double d)
 Sets interface support tolerance as a fraction of max. extent. More...
 
void setMaxFailures (unsigned int m)
 Sets the maximum failures until termination. More...
 
unsigned int getMaxFailures () const
 Retrieve the maximum consecutive failure limit. More...
 
double getDenseDeltaFraction () const
 Retrieve the dense graph interface support delta. More...
 
double getSparseDeltaFraction () const
 Retrieve the sparse graph visibility range delta. More...
 
double getStretchFactor () const
 Retrieve the spanner's set stretch factor. More...
 
bool getGuardSpacingFactor (double pathLength, double &numGuards, double &spacingFactor)
 
bool getGuardSpacingFactor (double pathLength, int &numGuards, double &spacingFactor)
 Calculate the distance that should be used in inserting nodes into the db. More...
 
bool addPathToRoadmap (const base::PlannerTerminationCondition &ptc, ompl::geometric::PathGeometric &solutionPath)
 
bool checkStartGoalConnection (ompl::geometric::PathGeometric &solutionPath)
 
bool addStateToRoadmap (const base::PlannerTerminationCondition &ptc, base::State *newState)
 
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. Start and goal states from the currently specified ProblemDefinition are cached. This means that between calls to solve(), input states are only added, not removed. When using PRM as a multi-query planner, the input states should be however cleared, without clearing the roadmap itself. This can be done using the clearQuery() function. More...
 
void clearQuery () override
 Clear the query previously loaded from the ProblemDefinition. Subsequent calls to solve() will reuse the previously computed roadmap, but will clear the set of input states constructed by the previous call to solve(). This enables multi-query functionality for PRM. More...
 
void clear () override
 Clear all internal datastructures. Planner settings are not affected. Subsequent calls to solve() will ignore all previous work. More...
 
template<template< typename T > class NN>
void setNearestNeighbors ()
 Set a different nearest neighbors datastructure. More...
 
bool getSimilarPaths (int nearestK, const base::State *start, const base::State *goal, CandidateSolution &candidateSolution, const base::PlannerTerminationCondition &ptc)
 Search the roadmap for the best path close to the given start and goal states that is valid. 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...
 
const GraphgetRoadmap () const
 Retrieve the computed roadmap. More...
 
unsigned int getNumVertices () const
 Get the number of vertices in the sparse roadmap. More...
 
unsigned int getNumEdges () const
 Get the number of edges in the sparse roadmap. More...
 
unsigned int getNumConnectedComponents () const
 Get the number of disjoint sets in the sparse roadmap. More...
 
unsigned int getNumPathInsertionFailed () const
 Get the number of times a path was inserted into the database and it failed to have connectivity. More...
 
unsigned int getNumConsecutiveFailures () const
 description More...
 
long unsigned int getIterations () const
 Get the number of iterations the algorithm performed. More...
 
bool convertVertexPathToStatePath (std::vector< Vertex > &vertexPath, const base::State *actualStart, const base::State *actualGoal, CandidateSolution &candidateSolution, bool disableCollisionWarning=false)
 Convert astar results to correctly ordered path. More...
 
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...
 
void setPlannerData (const base::PlannerData &data)
 Set the sparse graph from file. More...
 
bool reachedFailureLimit () const
 Returns whether we have reached the iteration failures limit, maxFailures_. More...
 
void printDebug (std::ostream &out=std::cout) const
 Print debug information about planner. More...
 
void clearEdgeCollisionStates ()
 Clear all past edge state information about in collision or not. More...
 
- 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 freeMemory ()
 Free all the memory allocated by the planner. More...
 
void checkQueryStateInitialization ()
 Check that the query vertex is initialized (used for internal nearest neighbor searches) More...
 
bool checkAddCoverage (const base::State *qNew, std::vector< Vertex > &visibleNeighborhood)
 Checks to see if the sample needs to be added to ensure coverage of the space. More...
 
bool checkAddConnectivity (const base::State *qNew, std::vector< Vertex > &visibleNeighborhood)
 Checks to see if the sample needs to be added to ensure connectivity. More...
 
bool checkAddInterface (const base::State *qNew, std::vector< Vertex > &graphNeighborhood, std::vector< Vertex > &visibleNeighborhood)
 Checks to see if the current sample reveals the existence of an interface, and if so, tries to bridge it. More...
 
bool checkAddPath (Vertex v)
 Checks vertex v for short paths through its region and adds when appropriate. More...
 
void resetFailures ()
 A reset function for resetting the failures count. More...
 
void findGraphNeighbors (base::State *state, std::vector< Vertex > &graphNeighborhood, std::vector< Vertex > &visibleNeighborhood)
 Finds visible nodes in the graph near state. More...
 
bool findGraphNeighbors (const base::State *state, std::vector< Vertex > &graphNeighborhood)
 Finds nodes in the graph near state NOTE: note tested for visibility. More...
 
void approachGraph (Vertex v)
 Approaches the graph from a given vertex. More...
 
Vertex findGraphRepresentative (base::State *st)
 Finds the representative of the input state, st
More...
 
void findCloseRepresentatives (base::State *workState, const base::State *qNew, Vertex qRep, std::map< Vertex, base::State * > &closeRepresentatives, const base::PlannerTerminationCondition &ptc)
 Finds representatives of samples near qNew_ which are not his representative. More...
 
void updatePairPoints (Vertex rep, const base::State *q, Vertex r, const base::State *s)
 High-level method which updates pair point information for repV_ with neighbor r. More...
 
void computeVPP (Vertex v, Vertex vp, std::vector< Vertex > &VPPs)
 Computes all nodes which qualify as a candidate v" for v and vp. More...
 
void computeX (Vertex v, Vertex vp, Vertex vpp, std::vector< Vertex > &Xs)
 Computes all nodes which qualify as a candidate x for v, v', and v". More...
 
VertexPair index (Vertex vp, Vertex vpp)
 Rectifies indexing order for accessing the vertex data. More...
 
InterfaceDatagetData (Vertex v, Vertex vp, Vertex vpp)
 Retrieves the Vertex data associated with v,vp,vpp. More...
 
void distanceCheck (Vertex rep, const base::State *q, Vertex r, const base::State *s, Vertex rp)
 Performs distance checking for the candidate new state, q against the current information. More...
 
void abandonLists (base::State *st)
 When a new guard is added at state st, finds all guards who must abandon their interface information and deletes that information. More...
 
Vertex addGuard (base::State *state, GuardType type)
 Construct a guard for a given state (state) and store it in the nearest neighbors data structure. More...
 
void connectGuards (Vertex v, Vertex vp)
 Connect two guards in the roadmap. More...
 
bool getPaths (const std::vector< Vertex > &candidateStarts, const std::vector< Vertex > &candidateGoals, const base::State *actualStart, const base::State *actualGoal, CandidateSolution &candidateSolution, const base::PlannerTerminationCondition &ptc)
 Check if there exists a solution, i.e., there exists a pair of milestones such that the first is in start and the second is in goal, and the two milestones are in the same connected component. If a solution is found, the path is saved. More...
 
bool lazyCollisionSearch (const Vertex &start, const Vertex &goal, const base::State *actualStart, const base::State *actualGoal, CandidateSolution &candidateSolution, const base::PlannerTerminationCondition &ptc)
 Repeatidly search through graph for connection then check for collisions then repeat. More...
 
bool lazyCollisionCheck (std::vector< Vertex > &vertexPath, const base::PlannerTerminationCondition &ptc)
 Check recalled path for collision and disable as needed. More...
 
void checkForSolution (const base::PlannerTerminationCondition &ptc, base::PathPtr &solution)
 
bool constructSolution (Vertex start, Vertex goal, std::vector< Vertex > &vertexPath) const
 Given two milestones from the same connected component, construct a path connecting them and set it as the solution. More...
 
bool sameComponent (Vertex m1, Vertex m2)
 Check if two milestones (m1 and m2) are part of the same connected component. This is not a const function since we use incremental connected components from boost. More...
 
double distanceFunction (const Vertex a, const Vertex b) const
 Compute distance between two milestones (this is simply distance between the states of the milestones) More...
 
- 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::ValidStateSamplerPtr sampler_
 Sampler user for generating valid samples in the state space. More...
 
std::shared_ptr< NearestNeighbors< Vertex > > nn_
 Nearest neighbors data structure. More...
 
Graph g_
 Connectivity graph. More...
 
std::vector< VertexstartM_
 Array of start milestones. More...
 
std::vector< VertexgoalM_
 Array of goal milestones. More...
 
Vertex queryVertex_
 Vertex for performing nearest neighbor queries. More...
 
double stretchFactor_ {3.}
 Stretch Factor as per graph spanner literature (multiplicative bound on path quality) More...
 
double sparseDeltaFraction_ {.25}
 Maximum visibility range for nodes in the graph as a fraction of maximum extent. More...
 
double denseDeltaFraction_ {.001}
 Maximum range for allowing two samples to support an interface as a fraction of maximum extent. More...
 
unsigned int maxFailures_ {5000u}
 The number of consecutive failures to add to the graph before termination. More...
 
unsigned int numPathInsertionFailures_ {0u}
 Track how many solutions fail to have connectivity at end. More...
 
unsigned int nearSamplePoints_
 Number of sample points to use when trying to detect interfaces. More...
 
PathSimplifierPtr psimp_
 A path simplifier used to simplify dense paths added to the graph. More...
 
boost::property_map< Graph, boost::edge_weight_t >::type edgeWeightProperty_
 Access to the weights of each Edge. More...
 
EdgeCollisionStateMap edgeCollisionStateProperty_
 Access to the collision checking state of each Edge. More...
 
boost::property_map< Graph, vertex_state_t >::type stateProperty_
 Access to the internal base::state at each Vertex. More...
 
boost::property_map< Graph, vertex_color_t >::type colorProperty_
 Access to the colors for the vertices. More...
 
boost::property_map< Graph, vertex_interface_data_t >::type interfaceDataProperty_
 Access to the interface pair information for the vertices. More...
 
boost::disjoint_sets< boost::property_map< Graph, boost::vertex_rank_t >::type, boost::property_map< Graph, boost::vertex_predecessor_t >::type > disjointSets_
 Data structure that maintains the connected components. More...
 
RNG rng_
 Random number generator. More...
 
bool addedSolution_ {false}
 A flag indicating that a solution has been added during solve() More...
 
unsigned int consecutiveFailures_ {0u}
 A counter for the number of consecutive failed iterations of the algorithm. More...
 
long unsigned int iterations_ {0ul}
 A counter for the number of iterations of the algorithm. More...
 
double sparseDelta_ {0.}
 Maximum visibility range for nodes in the graph. More...
 
double denseDelta_ {0.}
 Maximum range for allowing two samples to support an interface. More...
 
std::vector< VertexstartVertexCandidateNeighbors_
 Used by getSimilarPaths. More...
 
std::vector< VertexgoalVertexCandidateNeighbors_
 
bool verbose_ {false}
 Option to enable debugging output. 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...
 

Detailed Description

SPArse Roadmap Spanner Version 2.0

Short description
SPARSdb is a variant of the SPARS algorithm which removes the dependency on having the dense graph, D. It works through similar mechanics, but uses a different approach to identifying interfaces and computing shortest paths through said interfaces.

This version has been modified for use with Thunder

External documentation
A. Dobson, K. Bekris, Improving Sparse Roadmap Spanners, IEEE International Conference on Robotics and Automation (ICRA) May 2013. [PDF]

Definition at line 85 of file SPARSdb.h.

Member Typedef Documentation

◆ Edge

using ompl::geometric::SPARSdb::Edge = boost::graph_traits<Graph>::edge_descriptor

Edge in Graph.

Definition at line 298 of file SPARSdb.h.

◆ EdgeCollisionStateMap

Access map that stores the lazy collision checking status of each edge.

Definition at line 304 of file SPARSdb.h.

◆ EdgeProperties

using ompl::geometric::SPARSdb::EdgeProperties = boost::property<boost::edge_weight_t, double, boost::property<edge_collision_state_t, int> >

Wrapper for the double assigned to an edge as its weight property.

Definition at line 286 of file SPARSdb.h.

◆ Graph

using ompl::geometric::SPARSdb::Graph = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, VertexProperties, EdgeProperties>

The underlying boost graph type (undirected weighted-edge adjacency list with above properties).

Definition at line 290 of file SPARSdb.h.

◆ InterfaceHash

the hash which maps pairs of neighbor points to pairs of states

Definition at line 185 of file SPARSdb.h.

◆ Vertex

using ompl::geometric::SPARSdb::Vertex = boost::graph_traits<Graph>::vertex_descriptor

Vertex in Graph.

Definition at line 295 of file SPARSdb.h.

◆ VertexIndexType

using ompl::geometric::SPARSdb::VertexIndexType = unsigned long int

The type used internally for representing vertex IDs.

Definition at line 104 of file SPARSdb.h.

◆ VertexPair

Pair of vertices which support an interface.

Definition at line 107 of file SPARSdb.h.

◆ VertexProperties

using ompl::geometric::SPARSdb::VertexProperties = boost::property< vertex_state_t, base::State *, boost::property< boost::vertex_predecessor_t, VertexIndexType, boost::property<boost::vertex_rank_t, VertexIndexType, boost::property<vertex_color_t, GuardType, boost::property<vertex_interface_data_t, InterfaceHashStruct> >> >>

The underlying roadmap graph.

Any BGL graph representation could be used here. Because we
expect the roadmap to be sparse (m<n^2), an adjacency_list is more appropriate than an adjacency_matrix. Edges are undirected.

Properties of vertices*

Note: If boost::vecS is not used for vertex storage, then there must also be a boost:vertex_index_t property manually added.

Properties of edges*

  • edge_weight_t - cost/distance between two vertices
  • edge_collision_state_t - used for lazy collision checking, determines if an edge has been checked already for collision. 0 = not checked/unknown, 1 = in collision, 2 = free Wrapper for the vertex's multiple as its property.

Definition at line 277 of file SPARSdb.h.

Member Enumeration Documentation

◆ EdgeCollisionState

Possible collision states of an edge.

Definition at line 225 of file SPARSdb.h.

◆ GuardType

Enumeration which specifies the reason a guard is added to the spanner.

Definition at line 89 of file SPARSdb.h.

Constructor & Destructor Documentation

◆ SPARSdb()

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

Constructor.

Definition at line 99 of file SPARSdb.cpp.

◆ ~SPARSdb()

ompl::geometric::SPARSdb::~SPARSdb ( )
override

Destructor.

Definition at line 129 of file SPARSdb.cpp.

Member Function Documentation

◆ abandonLists()

void ompl::geometric::SPARSdb::abandonLists ( base::State st)
protected

When a new guard is added at state st, finds all guards who must abandon their interface information and deletes that information.

Definition at line 1584 of file SPARSdb.cpp.

◆ addGuard()

ompl::geometric::SPARSdb::Vertex ompl::geometric::SPARSdb::addGuard ( base::State state,
GuardType  type 
)
protected

Construct a guard for a given state (state) and store it in the nearest neighbors data structure.

Definition at line 1601 of file SPARSdb.cpp.

◆ addPathToRoadmap()

bool ompl::geometric::SPARSdb::addPathToRoadmap ( const base::PlannerTerminationCondition ptc,
ompl::geometric::PathGeometric solutionPath 
)

Definition at line 641 of file SPARSdb.cpp.

◆ addStateToRoadmap()

bool ompl::geometric::SPARSdb::addStateToRoadmap ( const base::PlannerTerminationCondition ptc,
base::State newState 
)

Definition at line 939 of file SPARSdb.cpp.

◆ approachGraph()

void ompl::geometric::SPARSdb::approachGraph ( Vertex  v)
protected

Approaches the graph from a given vertex.

Definition at line 1332 of file SPARSdb.cpp.

◆ checkAddConnectivity()

bool ompl::geometric::SPARSdb::checkAddConnectivity ( const base::State qNew,
std::vector< Vertex > &  visibleNeighborhood 
)
protected

Checks to see if the sample needs to be added to ensure connectivity.

Definition at line 1079 of file SPARSdb.cpp.

◆ checkAddCoverage()

bool ompl::geometric::SPARSdb::checkAddCoverage ( const base::State qNew,
std::vector< Vertex > &  visibleNeighborhood 
)
protected

Checks to see if the sample needs to be added to ensure coverage of the space.

Definition at line 1065 of file SPARSdb.cpp.

◆ checkAddInterface()

bool ompl::geometric::SPARSdb::checkAddInterface ( const base::State qNew,
std::vector< Vertex > &  graphNeighborhood,
std::vector< Vertex > &  visibleNeighborhood 
)
protected

Checks to see if the current sample reveals the existence of an interface, and if so, tries to bridge it.

Definition at line 1130 of file SPARSdb.cpp.

◆ checkAddPath()

bool ompl::geometric::SPARSdb::checkAddPath ( Vertex  v)
protected

Checks vertex v for short paths through its region and adds when appropriate.

Definition at line 1173 of file SPARSdb.cpp.

◆ checkForSolution()

void ompl::geometric::SPARSdb::checkForSolution ( const base::PlannerTerminationCondition ptc,
base::PathPtr &  solution 
)
protected

Thread that checks for solution

◆ checkQueryStateInitialization()

void ompl::geometric::SPARSdb::checkQueryStateInitialization ( )
protected

Check that the query vertex is initialized (used for internal nearest neighbor searches)

Definition at line 1050 of file SPARSdb.cpp.

◆ checkStartGoalConnection()

bool ompl::geometric::SPARSdb::checkStartGoalConnection ( ompl::geometric::PathGeometric solutionPath)

Definition at line 844 of file SPARSdb.cpp.

◆ clear()

void ompl::geometric::SPARSdb::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 164 of file SPARSdb.cpp.

◆ clearEdgeCollisionStates()

void ompl::geometric::SPARSdb::clearEdgeCollisionStates ( )

Clear all past edge state information about in collision or not.

Definition at line 1835 of file SPARSdb.cpp.

◆ clearQuery()

void ompl::geometric::SPARSdb::clearQuery ( )
overridevirtual

Clear the query previously loaded from the ProblemDefinition. Subsequent calls to solve() will reuse the previously computed roadmap, but will clear the set of input states constructed by the previous call to solve(). This enables multi-query functionality for PRM.

Reimplemented from ompl::base::Planner.

Definition at line 157 of file SPARSdb.cpp.

◆ computeVPP()

void ompl::geometric::SPARSdb::computeVPP ( Vertex  v,
Vertex  vp,
std::vector< Vertex > &  VPPs 
)
protected

Computes all nodes which qualify as a candidate v" for v and vp.

Definition at line 1501 of file SPARSdb.cpp.

◆ computeX()

void ompl::geometric::SPARSdb::computeX ( Vertex  v,
Vertex  vp,
Vertex  vpp,
std::vector< Vertex > &  Xs 
)
protected

Computes all nodes which qualify as a candidate x for v, v', and v".

Definition at line 1510 of file SPARSdb.cpp.

◆ connectGuards()

void ompl::geometric::SPARSdb::connectGuards ( Vertex  v,
Vertex  vp 
)
protected

Connect two guards in the roadmap.

Definition at line 1626 of file SPARSdb.cpp.

◆ constructSolution()

bool ompl::geometric::SPARSdb::constructSolution ( Vertex  start,
Vertex  goal,
std::vector< Vertex > &  vertexPath 
) const
protected

Given two milestones from the same connected component, construct a path connecting them and set it as the solution.

Parameters
start
goal
vertexPath
Returns
true if candidate solution found

Definition at line 416 of file SPARSdb.cpp.

◆ convertVertexPathToStatePath()

bool ompl::geometric::SPARSdb::convertVertexPathToStatePath ( std::vector< Vertex > &  vertexPath,
const base::State actualStart,
const base::State actualGoal,
CandidateSolution candidateSolution,
bool  disableCollisionWarning = false 
)

Convert astar results to correctly ordered path.

Parameters
vertexPath- in reverse
start- actual start that is probably not included in new path
goal- actual goal that is probably not included in new path
path- returned solution
disableCollisionWarning- if the func should ignore edges that are not checked
Returns
true on success

Definition at line 1654 of file SPARSdb.cpp.

◆ distanceCheck()

void ompl::geometric::SPARSdb::distanceCheck ( Vertex  rep,
const base::State q,
Vertex  r,
const base::State s,
Vertex  rp 
)
protected

Performs distance checking for the candidate new state, q against the current information.

Definition at line 1539 of file SPARSdb.cpp.

◆ distanceFunction()

double ompl::geometric::SPARSdb::distanceFunction ( const Vertex  a,
const Vertex  b 
) const
inlineprotected

Compute distance between two milestones (this is simply distance between the states of the milestones)

Definition at line 697 of file SPARSdb.h.

◆ findCloseRepresentatives()

void ompl::geometric::SPARSdb::findCloseRepresentatives ( base::State workState,
const base::State qNew,
Vertex  qRep,
std::map< Vertex, base::State * > &  closeRepresentatives,
const base::PlannerTerminationCondition ptc 
)
protected

Finds representatives of samples near qNew_ which are not his representative.

Definition at line 1374 of file SPARSdb.cpp.

◆ findGraphNeighbors() [1/2]

void ompl::geometric::SPARSdb::findGraphNeighbors ( base::State state,
std::vector< Vertex > &  graphNeighborhood,
std::vector< Vertex > &  visibleNeighborhood 
)
protected

Finds visible nodes in the graph near state.

Definition at line 1277 of file SPARSdb.cpp.

◆ findGraphNeighbors() [2/2]

bool ompl::geometric::SPARSdb::findGraphNeighbors ( const base::State state,
std::vector< Vertex > &  graphNeighborhood 
)
protected

Finds nodes in the graph near state NOTE: note tested for visibility.

Parameters
state- vertex to find neighbors around
result
Returns
false is no neighbors found

Definition at line 1293 of file SPARSdb.cpp.

◆ findGraphRepresentative()

ompl::geometric::SPARSdb::Vertex ompl::geometric::SPARSdb::findGraphRepresentative ( base::State st)
protected

Finds the representative of the input state, st

Definition at line 1346 of file SPARSdb.cpp.

◆ freeMemory()

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

Free all the memory allocated by the planner.

Definition at line 175 of file SPARSdb.cpp.

◆ getData()

ompl::geometric::SPARSdb::InterfaceData & ompl::geometric::SPARSdb::getData ( Vertex  v,
Vertex  vp,
Vertex  vpp 
)
protected

Retrieves the Vertex data associated with v,vp,vpp.

Definition at line 1534 of file SPARSdb.cpp.

◆ getDenseDeltaFraction()

double ompl::geometric::SPARSdb::getDenseDeltaFraction ( ) const
inline

Retrieve the dense graph interface support delta.

Definition at line 422 of file SPARSdb.h.

◆ getGuardSpacingFactor()

bool ompl::geometric::SPARSdb::getGuardSpacingFactor ( double  pathLength,
int &  numGuards,
double &  spacingFactor 
)

Calculate the distance that should be used in inserting nodes into the db.

Parameters
pathlength - from the trajectory
numguards - the output result
spacingfactor - what fraction of the sparsedelta should be used in placing guards
Returns

Definition at line 577 of file SPARSdb.cpp.

◆ getIterations()

long unsigned int ompl::geometric::SPARSdb::getIterations ( ) const
inline

Get the number of iterations the algorithm performed.

Definition at line 550 of file SPARSdb.h.

◆ getMaxFailures()

unsigned int ompl::geometric::SPARSdb::getMaxFailures ( ) const
inline

Retrieve the maximum consecutive failure limit.

Definition at line 416 of file SPARSdb.h.

◆ getNumConnectedComponents()

unsigned int ompl::geometric::SPARSdb::getNumConnectedComponents ( ) const
inline

Get the number of disjoint sets in the sparse roadmap.

Definition at line 523 of file SPARSdb.h.

◆ getNumConsecutiveFailures()

unsigned int ompl::geometric::SPARSdb::getNumConsecutiveFailures ( ) const
inline

description

Definition at line 544 of file SPARSdb.h.

◆ getNumEdges()

unsigned int ompl::geometric::SPARSdb::getNumEdges ( ) const
inline

Get the number of edges in the sparse roadmap.

Definition at line 517 of file SPARSdb.h.

◆ getNumPathInsertionFailed()

unsigned int ompl::geometric::SPARSdb::getNumPathInsertionFailed ( ) const
inline

Get the number of times a path was inserted into the database and it failed to have connectivity.

Definition at line 538 of file SPARSdb.h.

◆ getNumVertices()

unsigned int ompl::geometric::SPARSdb::getNumVertices ( ) const
inline

Get the number of vertices in the sparse roadmap.

Definition at line 511 of file SPARSdb.h.

◆ getPaths()

bool ompl::geometric::SPARSdb::getPaths ( const std::vector< Vertex > &  candidateStarts,
const std::vector< Vertex > &  candidateGoals,
const base::State actualStart,
const base::State actualGoal,
CandidateSolution candidateSolution,
const base::PlannerTerminationCondition ptc 
)
protected

Check if there exists a solution, i.e., there exists a pair of milestones such that the first is in start and the second is in goal, and the two milestones are in the same connected component. If a solution is found, the path is saved.

Definition at line 254 of file SPARSdb.cpp.

◆ getPlannerData()

void ompl::geometric::SPARSdb::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 1721 of file SPARSdb.cpp.

◆ getRoadmap()

const Graph & ompl::geometric::SPARSdb::getRoadmap ( ) const
inline

Retrieve the computed roadmap.

Definition at line 505 of file SPARSdb.h.

◆ getSimilarPaths()

bool ompl::geometric::SPARSdb::getSimilarPaths ( int  nearestK,
const base::State start,
const base::State goal,
CandidateSolution candidateSolution,
const base::PlannerTerminationCondition ptc 
)

Search the roadmap for the best path close to the given start and goal states that is valid.

Parameters
nearestK- unused
start
goal
geometricSolution- the resulting path
Returns

Definition at line 194 of file SPARSdb.cpp.

◆ getSparseDeltaFraction()

double ompl::geometric::SPARSdb::getSparseDeltaFraction ( ) const
inline

Retrieve the sparse graph visibility range delta.

Definition at line 428 of file SPARSdb.h.

◆ getStretchFactor()

double ompl::geometric::SPARSdb::getStretchFactor ( ) const
inline

Retrieve the spanner's set stretch factor.

Definition at line 434 of file SPARSdb.h.

◆ index()

ompl::geometric::SPARSdb::VertexPair ompl::geometric::SPARSdb::index ( Vertex  vp,
Vertex  vpp 
)
protected

Rectifies indexing order for accessing the vertex data.

Definition at line 1524 of file SPARSdb.cpp.

◆ lazyCollisionCheck()

bool ompl::geometric::SPARSdb::lazyCollisionCheck ( std::vector< Vertex > &  vertexPath,
const base::PlannerTerminationCondition ptc 
)
protected

Check recalled path for collision and disable as needed.

Definition at line 485 of file SPARSdb.cpp.

◆ lazyCollisionSearch()

bool ompl::geometric::SPARSdb::lazyCollisionSearch ( const Vertex start,
const Vertex goal,
const base::State actualStart,
const base::State actualGoal,
CandidateSolution candidateSolution,
const base::PlannerTerminationCondition ptc 
)
protected

Repeatidly search through graph for connection then check for collisions then repeat.

Returns
true if a valid path is found

Definition at line 308 of file SPARSdb.cpp.

◆ printDebug()

void ompl::geometric::SPARSdb::printDebug ( std::ostream &  out = std::cout) const

Print debug information about planner.

Definition at line 559 of file SPARSdb.cpp.

◆ reachedFailureLimit()

bool ompl::geometric::SPARSdb::reachedFailureLimit ( ) const

Returns whether we have reached the iteration failures limit, maxFailures_.

Definition at line 554 of file SPARSdb.cpp.

◆ resetFailures()

void ompl::geometric::SPARSdb::resetFailures ( )
protected

A reset function for resetting the failures count.

Definition at line 1272 of file SPARSdb.cpp.

◆ sameComponent()

bool ompl::geometric::SPARSdb::sameComponent ( Vertex  m1,
Vertex  m2 
)
protected

Check if two milestones (m1 and m2) are part of the same connected component. This is not a const function since we use incremental connected components from boost.

Definition at line 549 of file SPARSdb.cpp.

◆ setDenseDeltaFraction()

void ompl::geometric::SPARSdb::setDenseDeltaFraction ( double  d)
inline

Sets interface support tolerance as a fraction of max. extent.

Definition at line 402 of file SPARSdb.h.

◆ setMaxFailures()

void ompl::geometric::SPARSdb::setMaxFailures ( unsigned int  m)
inline

Sets the maximum failures until termination.

Definition at line 410 of file SPARSdb.h.

◆ setNearestNeighbors()

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

Set a different nearest neighbors datastructure.

Definition at line 481 of file SPARSdb.h.

◆ setPlannerData()

void ompl::geometric::SPARSdb::setPlannerData ( const base::PlannerData data)

Set the sparse graph from file.

Parameters
apre-built graph

Definition at line 1770 of file SPARSdb.cpp.

◆ setProblemDefinition()

void ompl::geometric::SPARSdb::setProblemDefinition ( const base::ProblemDefinitionPtr &  pdef)
override

Definition at line 151 of file SPARSdb.cpp.

◆ setSparseDeltaFraction()

void ompl::geometric::SPARSdb::setSparseDeltaFraction ( double  D)
inline

Sets vertex visibility range as a fraction of max. extent.

Definition at line 394 of file SPARSdb.h.

◆ setStretchFactor()

void ompl::geometric::SPARSdb::setStretchFactor ( double  t)
inline

Sets the stretch factor.

Definition at line 388 of file SPARSdb.h.

◆ setup()

void ompl::geometric::SPARSdb::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 134 of file SPARSdb.cpp.

◆ solve()

ompl::base::PlannerStatus ompl::geometric::SPARSdb::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. Start and goal states from the currently specified ProblemDefinition are cached. This means that between calls to solve(), input states are only added, not removed. When using PRM as a multi-query planner, the input states should be however cleared, without clearing the roadmap itself. This can be done using the clearQuery() function.

Implements ompl::base::Planner.

Definition at line 1059 of file SPARSdb.cpp.

◆ updatePairPoints()

void ompl::geometric::SPARSdb::updatePairPoints ( Vertex  rep,
const base::State q,
Vertex  r,
const base::State s 
)
protected

High-level method which updates pair point information for repV_ with neighbor r.

Definition at line 1489 of file SPARSdb.cpp.

Member Data Documentation

◆ addedSolution_

bool ompl::geometric::SPARSdb::addedSolution_ {false}
protected

A flag indicating that a solution has been added during solve()

Definition at line 764 of file SPARSdb.h.

◆ colorProperty_

boost::property_map<Graph,vertex_color_t>::type ompl::geometric::SPARSdb::colorProperty_
protected

Access to the colors for the vertices.

Definition at line 752 of file SPARSdb.h.

◆ consecutiveFailures_

unsigned int ompl::geometric::SPARSdb::consecutiveFailures_ {0u}
protected

A counter for the number of consecutive failed iterations of the algorithm.

Definition at line 767 of file SPARSdb.h.

◆ denseDelta_

double ompl::geometric::SPARSdb::denseDelta_ {0.}
protected

Maximum range for allowing two samples to support an interface.

Definition at line 776 of file SPARSdb.h.

◆ denseDeltaFraction_

double ompl::geometric::SPARSdb::denseDeltaFraction_ {.001}
protected

Maximum range for allowing two samples to support an interface as a fraction of maximum extent.

Definition at line 728 of file SPARSdb.h.

◆ disjointSets_

boost::disjoint_sets<boost::property_map<Graph, boost::vertex_rank_t>::type, boost::property_map<Graph, boost::vertex_predecessor_t>::type> ompl::geometric::SPARSdb::disjointSets_
protected

Data structure that maintains the connected components.

Definition at line 759 of file SPARSdb.h.

◆ edgeCollisionStateProperty_

EdgeCollisionStateMap ompl::geometric::SPARSdb::edgeCollisionStateProperty_
protected

Access to the collision checking state of each Edge.

Definition at line 746 of file SPARSdb.h.

◆ edgeWeightProperty_

boost::property_map<Graph,boost::edge_weight_t>::type ompl::geometric::SPARSdb::edgeWeightProperty_
protected

Access to the weights of each Edge.

Definition at line 743 of file SPARSdb.h.

◆ g_

Graph ompl::geometric::SPARSdb::g_
protected

Connectivity graph.

Definition at line 709 of file SPARSdb.h.

◆ goalM_

std::vector<Vertex> ompl::geometric::SPARSdb::goalM_
protected

Array of goal milestones.

Definition at line 715 of file SPARSdb.h.

◆ goalVertexCandidateNeighbors_

std::vector<Vertex> ompl::geometric::SPARSdb::goalVertexCandidateNeighbors_
protected

Definition at line 780 of file SPARSdb.h.

◆ interfaceDataProperty_

boost::property_map<Graph,vertex_interface_data_t>::type ompl::geometric::SPARSdb::interfaceDataProperty_
protected

Access to the interface pair information for the vertices.

Definition at line 755 of file SPARSdb.h.

◆ iterations_

long unsigned int ompl::geometric::SPARSdb::iterations_ {0ul}
protected

A counter for the number of iterations of the algorithm.

Definition at line 770 of file SPARSdb.h.

◆ maxFailures_

unsigned int ompl::geometric::SPARSdb::maxFailures_ {5000u}
protected

The number of consecutive failures to add to the graph before termination.

Definition at line 731 of file SPARSdb.h.

◆ nearSamplePoints_

unsigned int ompl::geometric::SPARSdb::nearSamplePoints_
protected

Number of sample points to use when trying to detect interfaces.

Definition at line 737 of file SPARSdb.h.

◆ nn_

std::shared_ptr<NearestNeighbors<Vertex> > ompl::geometric::SPARSdb::nn_
protected

Nearest neighbors data structure.

Definition at line 706 of file SPARSdb.h.

◆ numPathInsertionFailures_

unsigned int ompl::geometric::SPARSdb::numPathInsertionFailures_ {0u}
protected

Track how many solutions fail to have connectivity at end.

Definition at line 734 of file SPARSdb.h.

◆ psimp_

PathSimplifierPtr ompl::geometric::SPARSdb::psimp_
protected

A path simplifier used to simplify dense paths added to the graph.

Definition at line 740 of file SPARSdb.h.

◆ queryVertex_

Vertex ompl::geometric::SPARSdb::queryVertex_
protected

Vertex for performing nearest neighbor queries.

Definition at line 718 of file SPARSdb.h.

◆ rng_

RNG ompl::geometric::SPARSdb::rng_
protected

Random number generator.

Definition at line 761 of file SPARSdb.h.

◆ sampler_

base::ValidStateSamplerPtr ompl::geometric::SPARSdb::sampler_
protected

Sampler user for generating valid samples in the state space.

Definition at line 703 of file SPARSdb.h.

◆ sparseDelta_

double ompl::geometric::SPARSdb::sparseDelta_ {0.}
protected

Maximum visibility range for nodes in the graph.

Definition at line 773 of file SPARSdb.h.

◆ sparseDeltaFraction_

double ompl::geometric::SPARSdb::sparseDeltaFraction_ {.25}
protected

Maximum visibility range for nodes in the graph as a fraction of maximum extent.

Definition at line 724 of file SPARSdb.h.

◆ startM_

std::vector<Vertex> ompl::geometric::SPARSdb::startM_
protected

Array of start milestones.

Definition at line 712 of file SPARSdb.h.

◆ startVertexCandidateNeighbors_

std::vector<Vertex> ompl::geometric::SPARSdb::startVertexCandidateNeighbors_
protected

Used by getSimilarPaths.

Definition at line 779 of file SPARSdb.h.

◆ stateProperty_

boost::property_map<Graph,vertex_state_t>::type ompl::geometric::SPARSdb::stateProperty_
protected

Access to the internal base::state at each Vertex.

Definition at line 749 of file SPARSdb.h.

◆ stretchFactor_

double ompl::geometric::SPARSdb::stretchFactor_ {3.}
protected

Stretch Factor as per graph spanner literature (multiplicative bound on path quality)

Definition at line 721 of file SPARSdb.h.

◆ verbose_

bool ompl::geometric::SPARSdb::verbose_ {false}
protected

Option to enable debugging output.

Definition at line 783 of file SPARSdb.h.


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