All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
SPARS.h
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2013, Rutgers the State University of New Jersey, New Brunswick
5 * All Rights Reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of Rutgers University nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *********************************************************************/
34 
35 /* Author: Andrew Dobson */
36 
37 #ifndef OMPL_GEOMETRIC_PLANNERS_SPARSE_ROADMAP_SPANNER_
38 #define OMPL_GEOMETRIC_PLANNERS_SPARSE_ROADMAP_SPANNER_
39 
40 #include "ompl/geometric/planners/PlannerIncludes.h"
41 #include "ompl/datastructures/NearestNeighbors.h"
42 #include "ompl/geometric/PathSimplifier.h"
43 #include "ompl/util/Time.h"
44 
45 #include <boost/range/adaptor/map.hpp>
46 #include <boost/unordered_map.hpp>
47 #include <boost/graph/graph_traits.hpp>
48 #include <boost/graph/adjacency_list.hpp>
49 #include <boost/pending/disjoint_sets.hpp>
50 #include <boost/function.hpp>
51 #include <boost/thread.hpp>
52 #include <iostream>
53 #include <fstream>
54 #include <utility>
55 #include <vector>
56 #include <deque>
57 #include <map>
58 #include <set>
59 
60 namespace ompl
61 {
62 
63  namespace geometric
64  {
65 
80  class SPARS : public base::Planner
81  {
82  public:
84  enum GuardType
85  {
86  START,
87  GOAL,
88  COVERAGE,
89  CONNECTIVITY,
90  INTERFACE,
91  QUALITY,
92  };
93 
94  struct vertex_state_t {
95  typedef boost::vertex_property_tag kind;
96  };
97 
99  typedef boost::vertex_property_tag kind;
100  };
101 
102  struct vertex_color_t {
103  typedef boost::vertex_property_tag kind;
104  };
105 
106  struct vertex_list_t {
107  typedef boost::vertex_property_tag kind;
108  };
109 
111  typedef boost::vertex_property_tag kind;
112  };
113 
115  typedef unsigned long int VertexIndexType;
116 
118  typedef boost::unordered_map<VertexIndexType, std::set<VertexIndexType>, boost::hash<VertexIndexType> > InterfaceHash;
119 
121  typedef std::deque<base::State*> DensePath;
122 
123  // The InterfaceHash structure is wrapped inside of this struct due to a compilation error on
124  // GCC 4.6 with Boost 1.48. An implicit assignment operator overload does not compile with these
125  // components, so an explicit overload is given here.
126  // Remove this struct when the minimum Boost requirement is > v1.48.
128  {
129  InterfaceHashStruct& operator=(const InterfaceHashStruct &rhs) { interfaceHash = rhs.interfaceHash; return *this; }
130  InterfaceHash interfaceHash;
131  };
132 
145  typedef boost::adjacency_list <
146  boost::vecS, boost::vecS, boost::undirectedS,
147  boost::property < vertex_state_t, base::State*,
148  boost::property < boost::vertex_predecessor_t, VertexIndexType,
149  boost::property < boost::vertex_rank_t, VertexIndexType,
150  boost::property < vertex_color_t, GuardType,
151  boost::property < vertex_list_t, std::set<VertexIndexType>,
152  boost::property < vertex_interface_list_t, InterfaceHashStruct > > > > > >,
153  boost::property < boost::edge_weight_t, double >
155 
157  typedef boost::graph_traits<SpannerGraph>::vertex_descriptor SparseVertex;
158 
160  typedef boost::graph_traits<SpannerGraph>::edge_descriptor SparseEdge;
161 
163  typedef boost::shared_ptr< NearestNeighbors<SparseVertex> > SparseNeighbors;
164 
180  typedef boost::adjacency_list <
181  boost::vecS, boost::vecS, boost::undirectedS,
182  boost::property < vertex_state_t, base::State*,
183  boost::property < boost::vertex_predecessor_t, VertexIndexType,
184  boost::property < boost::vertex_rank_t, VertexIndexType,
185  boost::property < vertex_representative_t, SparseVertex > > > >,
186  boost::property < boost::edge_weight_t, double >
188 
190  typedef boost::graph_traits<DenseGraph>::vertex_descriptor DenseVertex;
191 
193  typedef boost::graph_traits<DenseGraph>::edge_descriptor DenseEdge;
194 
196  typedef boost::shared_ptr< NearestNeighbors<DenseVertex> > DenseNeighbors;
197 
199  SPARS(const base::SpaceInformationPtr &si);
201  virtual ~SPARS(void);
202 
203  virtual void setProblemDefinition(const base::ProblemDefinitionPtr &pdef);
204 
205  virtual void getPlannerData(base::PlannerData &data) const;
206 
209 
212  void constructRoadmap(const base::PlannerTerminationCondition &ptc, bool stopOnMaxFail);
213 
227 
232  void clearQuery(void);
233 
234  virtual void clear(void);
235 
241  template<template<typename T> class NN>
242  void setDenseNeighbors(void)
243  {
244  nn_.reset(new NN<DenseVertex>());
245  connectionStrategy_.clear();
246  if (isSetup())
247  setup();
248  }
249 
254  template<template<typename T> class NN>
256  {
257  snn_.reset(new NN<SparseVertex>());
258  if (isSetup())
259  setup();
260  }
261 
266  void setMaxFailures(unsigned int m)
267  {
268  maxFailures_ = m;
269  }
270 
274  void setDenseDeltaFraction(double d)
275  {
277  if (denseDelta_ > 0.0) // setup was previously called
278  denseDelta_ = d * si_->getMaximumExtent();
279  }
280 
285  void setSparseDeltaFraction(double d)
286  {
288  if (sparseDelta_ > 0.0) // setup was previously called
289  sparseDelta_ = d * si_->getMaximumExtent();
290  }
291 
295  void setStretchFactor(double t)
296  {
297  stretchFactor_ = t;
298  }
299 
301  unsigned getMaxFailures(void) const
302  {
303  return maxFailures_;
304  }
305 
307  double getDenseDeltaFraction(void) const
308  {
309  return denseDeltaFraction_;
310  }
311 
313  double getSparseDeltaFraction(void) const
314  {
315  return sparseDeltaFraction_;
316  }
317 
319  double getStretchFactor(void) const
320  {
321  return stretchFactor_;
322  }
323 
324  virtual void setup(void);
325 
328  const DenseGraph& getDenseGraph(void) const
329  {
330  return g_;
331  }
332 
335  const SpannerGraph& getRoadmap(void) const
336  {
337  return s_;
338  }
339 
341  unsigned int milestoneCount(void) const
342  {
343  return boost::num_vertices(g_);
344  }
345 
347  unsigned int guardCount(void) const
348  {
349  return boost::num_vertices(s_);
350  }
351 
353  long unsigned int getIterations(void) const
354  {
355  return iterations_;
356  }
357 
359  double averageValence(void) const;
360 
361  protected:
362 
365 
368 
371 
374 
377 
380 
383 
385  bool checkAddCoverage(const base::State* lastState, const std::vector<SparseVertex> &neigh);
386 
388  bool checkAddConnectivity(const base::State* lastState, const std::vector<SparseVertex> &neigh);
389 
391  bool checkAddInterface(const std::vector<DenseVertex>& graphNeighborhood, const std::vector<DenseVertex>& visibleNeighborhood, DenseVertex q);
392 
394  bool checkAddPath( DenseVertex q, const std::vector<DenseVertex>& neigh );
395 
398 
400  bool addPathToSpanner(const DensePath& p, SparseVertex vp, SparseVertex vpp);
401 
404 
407 
409  void addToRepresentatives( DenseVertex q, SparseVertex rep, const std::set<SparseVertex>& oreps );
410 
413 
415  void computeVPP(DenseVertex v, DenseVertex vp, std::vector<SparseVertex> &VPPs);
416 
418  void computeX(DenseVertex v, DenseVertex vp, DenseVertex vpp, std::vector<SparseVertex> &Xs);
419 
421  void resetFailures(void);
422 
425 
427  bool haveSolution(const std::vector<DenseVertex> &start, const std::vector<DenseVertex> &goal, base::PathPtr &solution);
428 
430  bool reachedTerminationCriterion(void) const;
431 
433  bool reachedFailureLimit(void) const;
434 
436  base::PathPtr constructSolution(const SparseVertex start, const SparseVertex goal) const;
437 
439  void computeDensePath(const DenseVertex start, const DenseVertex goal, DensePath &path) const;
440 
442  void freeMemory(void);
443 
445  void getSparseNeighbors(base::State* inState, std::vector< SparseVertex > &graphNeighborhood);
446 
448  void filterVisibleNeighbors(base::State* inState, const std::vector<SparseVertex> &graphNeighborhood, std::vector<SparseVertex> &visibleNeighborhood) const;
449 
451  void getInterfaceNeighborRepresentatives(DenseVertex q, std::set<SparseVertex> &interfaceRepresentatives);
452 
454  void getInterfaceNeighborhood(DenseVertex q, std::vector<DenseVertex> &interfaceNeighborhood);
455 
457  double distanceFunction(const DenseVertex a, const DenseVertex b) const
458  {
459  return si_->distance(stateProperty_[a], stateProperty_[b]);
460  }
461 
463  double sparseDistanceFunction( const SparseVertex a, const SparseVertex b ) const
464  {
465  return si_->distance( sparseStateProperty_[a], sparseStateProperty_[b] );
466  }
467 
470 
473 
476 
479 
482 
485 
487  std::vector<SparseVertex> startM_;
488 
490  std::vector<SparseVertex> goalM_;
491 
494 
497 
500 
502  boost::property_map<DenseGraph, vertex_state_t>::type stateProperty_;
503 
505  boost::property_map<SpannerGraph, vertex_state_t>::type sparseStateProperty_;
506 
508  boost::property_map<SpannerGraph, vertex_color_t>::type sparseColorProperty_;
509 
511  boost::property_map<DenseGraph, vertex_representative_t>::type representativesProperty_;
512 
514  boost::property_map<SpannerGraph, vertex_list_t>::type nonInterfaceListsProperty_;
515 
517  boost::property_map<SpannerGraph, vertex_interface_list_t>::type interfaceListsProperty_;
518 
521 
523  boost::property_map<DenseGraph, boost::edge_weight_t>::type weightProperty_;
524 
526  boost::disjoint_sets<
527  boost::property_map<SpannerGraph, boost::vertex_rank_t>::type,
528  boost::property_map<SpannerGraph, boost::vertex_predecessor_t>::type >
530 
532  boost::function<std::vector<DenseVertex>&(const DenseVertex)> connectionStrategy_;
533 
535  unsigned int consecutiveFailures_;
536 
538  long unsigned int iterations_;
539 
542 
544  unsigned int maxFailures_;
545 
548 
551 
554 
556  double denseDelta_;
557 
559  double sparseDelta_;
560 
563 
565  mutable boost::mutex graphMutex_;
566 
567  };
568 
569  }
570 }
571 
572 #endif
double stretchFactor_
The stretch factor in terms of graph spanners for SPARS to check against.
Definition: SPARS.h:541
virtual void setup(void)
Perform extra configuration steps, if needed. This call will also issue a call to ompl::base::SpaceIn...
Definition: SPARS.cpp:93
Object containing planner generated vertex and edge data. It is assumed that all vertices are unique...
Definition: PlannerData.h:164
double getDenseDeltaFraction(void) const
Retrieve the dense graph interface support delta fraction.
Definition: SPARS.h:307
base::StateSamplerPtr simpleSampler_
Sampler user for generating random in the state space.
Definition: SPARS.h:472
unsigned long int VertexIndexType
The type used internally for representing vertex IDs.
Definition: SPARS.h:115
SPARS(const base::SpaceInformationPtr &si)
Constructor.
Definition: SPARS.cpp:53
base::ValidStateSamplerPtr sampler_
Sampler user for generating valid samples in the state space.
Definition: SPARS.h:469
boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, boost::property< vertex_state_t, base::State *, boost::property< boost::vertex_predecessor_t, VertexIndexType, boost::property< boost::vertex_rank_t, VertexIndexType, boost::property< vertex_representative_t, SparseVertex > > > >, boost::property< boost::edge_weight_t, double > > DenseGraph
The underlying roadmap graph.
Definition: SPARS.h:187
A boost shared pointer wrapper for ompl::base::ProblemDefinition.
PathSimplifierPtr psimp_
A path simplifier used to simplify dense paths added to S.
Definition: SPARS.h:520
RNG rng_
Random number generator.
Definition: SPARS.h:562
A boost shared pointer wrapper for ompl::base::ValidStateSampler.
long unsigned int iterations_
A counter for the number of iterations of the algorithm.
Definition: SPARS.h:538
void freeMemory(void)
Free all the memory allocated by the planner.
Definition: SPARS.cpp:142
boost::property_map< SpannerGraph, vertex_interface_list_t >::type interfaceListsProperty_
Access to the interface-supporting vertice hashes of the sparse nodes.
Definition: SPARS.h:517
DenseVertex getInterfaceNeighbor(DenseVertex q, SparseVertex rep)
Get the first neighbor of q who has representative rep and is within denseDelta_. ...
Definition: SPARS.cpp:688
A boost shared pointer wrapper for ompl::base::StateSampler.
double denseDeltaFraction_
SPARS parameter for dense graph connection distance as a fraction of max. extent. ...
Definition: SPARS.h:550
virtual base::PlannerStatus solve(const base::PlannerTerminationCondition &ptc)
Function that can solve the motion planning problem. This function can be called multiple times on th...
Definition: SPARS.cpp:255
void setDenseDeltaFraction(double d)
Set the delta fraction for interface detection. If two nodes in the dense graph are more than a delta...
Definition: SPARS.h:274
double sparseDelta_
SPARS parameter for Sparse Roadmap connection distance.
Definition: SPARS.h:559
unsigned getMaxFailures(void) const
Retrieve the maximum consecutive failure limit.
Definition: SPARS.h:301
virtual void getPlannerData(base::PlannerData &data) const
Get information about the current run of the motion planner. Repeated calls to this function will upd...
Definition: SPARS.cpp:942
boost::function< std::vector< DenseVertex > &(const DenseVertex)> connectionStrategy_
Function that returns the milestones to attempt connections with.
Definition: SPARS.h:532
double distanceFunction(const DenseVertex a, const DenseVertex b) const
Compute distance between two milestones (this is simply distance between the states of the milestones...
Definition: SPARS.h:457
Encapsulate a termination condition for a motion planner. Planners will call operator() to decide whe...
bool checkAddPath(DenseVertex q, const std::vector< DenseVertex > &neigh)
Checks for adding an entire dense path to the Sparse Roadmap.
Definition: SPARS.cpp:551
boost::graph_traits< SpannerGraph >::edge_descriptor SparseEdge
An edge in the sparse roadmap that is constructed.
Definition: SPARS.h:160
virtual void clear(void)
Clear all internal datastructures. Planner settings are not affected. Subsequent calls to solve() wil...
Definition: SPARS.cpp:127
void removeFromRepresentatives(DenseVertex q, SparseVertex rep)
Removes the node from its representative's lists.
Definition: SPARS.cpp:815
void getInterfaceNeighborRepresentatives(DenseVertex q, std::set< SparseVertex > &interfaceRepresentatives)
Gets the representatives of all interfaces that q supports.
Definition: SPARS.cpp:846
bool isSetup(void) const
Check if setup() was called for this planner.
Definition: Planner.cpp:107
SparseNeighbors snn_
Nearest Neighbors structure for the sparse roadmap.
Definition: SPARS.h:478
void clearQuery(void)
Clear the query previously loaded from the ProblemDefinition. Subsequent calls to solve() will reuse ...
Definition: SPARS.cpp:120
void constructRoadmap(const base::PlannerTerminationCondition &ptc)
While the termination condition permits, construct the spanner graph.
Definition: SPARS.cpp:342
bool reachedTerminationCriterion(void) const
Returns true if we have reached the iteration failures limit, maxFailures_ or if a solution was added...
Definition: SPARS.cpp:228
const DenseGraph & getDenseGraph(void) const
Retrieve the underlying dense graph structure. This is built as a PRM* and asymptotically approximate...
Definition: SPARS.h:328
void computeVPP(DenseVertex v, DenseVertex vp, std::vector< SparseVertex > &VPPs)
Computes all nodes which qualify as a candidate v" for v and vp.
Definition: SPARS.cpp:828
unsigned int maxFailures_
The maximum number of failures before terminating the algorithm.
Definition: SPARS.h:544
boost::property_map< SpannerGraph, vertex_list_t >::type nonInterfaceListsProperty_
Access to all non-interface supporting vertices of the sparse nodes.
Definition: SPARS.h:514
bool checkAddCoverage(const base::State *lastState, const std::vector< SparseVertex > &neigh)
Checks the latest dense sample for the coverage property, and adds appropriately. ...
Definition: SPARS.cpp:474
const SpannerGraph & getRoadmap(void) const
Retrieve the sparse roadmap structure. This is the structure which answers given queries, and has the desired property of asymptotic near-optimality.
Definition: SPARS.h:335
void setMaxFailures(unsigned int m)
Set the maximum consecutive failures to augment the spanner before termination. In general...
Definition: SPARS.h:266
void calculateRepresentative(DenseVertex q)
Calculates the representative for a dense sample.
Definition: SPARS.cpp:773
void updateRepresentatives(SparseVertex v)
Automatically updates the representatives of all dense samplse within sparseDelta_ of v...
Definition: SPARS.cpp:738
void setStretchFactor(double t)
Set the roadmap spanner stretch factor. This value represents a multiplicative upper bound on path qu...
Definition: SPARS.h:295
void addToRepresentatives(DenseVertex q, SparseVertex rep, const std::set< SparseVertex > &oreps)
Adds a dense sample to the appropriate lists of its representative.
Definition: SPARS.cpp:790
boost::mutex graphMutex_
Mutex to guard access to the graphs.
Definition: SPARS.h:565
DenseVertex addMilestone(base::State *state)
Construct a milestone for a given state (state) and store it in the nearest neighbors data structure...
Definition: SPARS.cpp:400
std::vector< SparseVertex > goalM_
Array of goal guards.
Definition: SPARS.h:490
Random number generation. An instance of this class cannot be used by multiple threads at once (membe...
Definition: RandomNumbers.h:54
void getInterfaceNeighborhood(DenseVertex q, std::vector< DenseVertex > &interfaceNeighborhood)
Gets the neighbors of q who help it support an interface.
Definition: SPARS.cpp:866
boost::graph_traits< SpannerGraph >::vertex_descriptor SparseVertex
A vertex in the sparse roadmap that is constructed.
Definition: SPARS.h:157
boost::disjoint_sets< boost::property_map< SpannerGraph, boost::vertex_rank_t >::type, boost::property_map< SpannerGraph, boost::vertex_predecessor_t >::type > sparseDJSets_
Data structure that maintains the connected components of S.
Definition: SPARS.h:529
boost::property_map< DenseGraph, vertex_state_t >::type stateProperty_
Access to the internal base::state at each DenseVertex.
Definition: SPARS.h:502
boost::graph_traits< DenseGraph >::edge_descriptor DenseEdge
An edge in DenseGraph.
Definition: SPARS.h:193
boost::property_map< SpannerGraph, vertex_state_t >::type sparseStateProperty_
Access to the internal base::State for each SparseVertex of S.
Definition: SPARS.h:505
Base class for a planner.
Definition: Planner.h:227
boost::shared_ptr< NearestNeighbors< DenseVertex > > DenseNeighbors
Nearest neighbor structure which works over the DenseGraph.
Definition: SPARS.h:196
void checkQueryStateInitialization(void)
Check that the query vertex is initialized (used for internal nearest neighbor searches) ...
Definition: SPARS.cpp:238
void connectDensePoints(DenseVertex v, DenseVertex vp)
Connects points in the dense graph.
Definition: SPARS.cpp:466
boost::graph_traits< DenseGraph >::vertex_descriptor DenseVertex
A vertex in DenseGraph.
Definition: SPARS.h:190
double sparseDeltaFraction_
SPARS parameter for Sparse Roadmap connection distance as a fraction of max. extent.
Definition: SPARS.h:553
void computeDensePath(const DenseVertex start, const DenseVertex goal, DensePath &path) const
Constructs the dense path between the start and goal vertices (if connected)
Definition: SPARS.cpp:915
boost::unordered_map< VertexIndexType, std::set< VertexIndexType >, boost::hash< VertexIndexType > > InterfaceHash
Hash for storing interface information.
Definition: SPARS.h:118
void filterVisibleNeighbors(base::State *inState, const std::vector< SparseVertex > &graphNeighborhood, std::vector< SparseVertex > &visibleNeighborhood) const
Get the visible neighbors.
Definition: SPARS.cpp:678
SPArse Roadmap Spanner technique.
Definition: SPARS.h:80
long unsigned int getIterations(void) const
Get the number of iterations the algorithm performed.
Definition: SPARS.h:353
boost::property_map< SpannerGraph, vertex_color_t >::type sparseColorProperty_
Access to draw colors for the SparseVertexs of S, to indicate addition type.
Definition: SPARS.h:508
double getStretchFactor(void) const
Retrieve the spanner's set stretch factor.
Definition: SPARS.h:319
void computeX(DenseVertex v, DenseVertex vp, DenseVertex vpp, std::vector< SparseVertex > &Xs)
Computes all nodes which qualify as a candidate x for v, v', and v".
Definition: SPARS.cpp:836
bool haveSolution(const std::vector< DenseVertex > &start, const std::vector< DenseVertex > &goal, base::PathPtr &solution)
Check if there exists a solution, i.e., there exists a pair of milestones such that the first is in s...
Definition: SPARS.cpp:205
A class to store the exit status of Planner::solve()
Definition: PlannerStatus.h:48
bool reachedFailureLimit(void) const
Returns true if we have reached the iteration failures limit, maxFailures_.
Definition: SPARS.cpp:233
A boost shared pointer wrapper for ompl::base::SpaceInformation.
base::PathPtr constructSolution(const SparseVertex start, const SparseVertex goal) const
Given two milestones from the same connected component, construct a path connecting them and set it a...
Definition: SPARS.cpp:883
Definition of an abstract state.
Definition: State.h:50
boost::shared_ptr< NearestNeighbors< SparseVertex > > SparseNeighbors
Nearest neighbor structure which works over the SpannerGraph.
Definition: SPARS.h:163
boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, 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_list_t, std::set< VertexIndexType >, boost::property< vertex_interface_list_t, InterfaceHashStruct > > > > > >, boost::property< boost::edge_weight_t, double > > SpannerGraph
The constructed roadmap spanner.
Definition: SPARS.h:154
DenseVertex sparseQueryVertex_
DenseVertex for performing nearest neighbor queries on the SPARSE roadmap.
Definition: SPARS.h:493
A boost shared pointer wrapper for ompl::geometric::PathSimplifier.
unsigned int consecutiveFailures_
A counter for the number of consecutive failed iterations of the algorithm.
Definition: SPARS.h:535
virtual void setProblemDefinition(const base::ProblemDefinitionPtr &pdef)
Set the problem definition for the planner. The problem needs to be set before calling solve()...
Definition: SPARS.cpp:109
DenseVertex queryVertex_
Vertex for performing nearest neighbor queries on the DENSE graph.
Definition: SPARS.h:496
bool checkAddInterface(const std::vector< DenseVertex > &graphNeighborhood, const std::vector< DenseVertex > &visibleNeighborhood, DenseVertex q)
Checks the latest dense sample for bridging an edge-less interface.
Definition: SPARS.cpp:519
SpannerGraph s_
The sparse roadmap, S.
Definition: SPARS.h:484
double denseDelta_
SPARS parameter for dense graph connection distance.
Definition: SPARS.h:556
void checkForSolution(const base::PlannerTerminationCondition &ptc, base::PathPtr &solution)
Definition: SPARS.cpp:181
bool addedSolution_
A flag indicating that a solution has been added during solve()
Definition: SPARS.h:547
bool checkAddConnectivity(const base::State *lastState, const std::vector< SparseVertex > &neigh)
Checks the latest dense sample for connectivity, and adds appropriately.
Definition: SPARS.cpp:487
unsigned int milestoneCount(void) const
Returns the number of milestones added to D.
Definition: SPARS.h:341
void connectSparsePoints(SparseVertex v, SparseVertex vp)
Convenience function for creating an edge in the Spanner Roadmap.
Definition: SPARS.cpp:457
void setDenseNeighbors(void)
Set a different nearest neighbors datastructure for the roadmap graph. This nearest neighbor structur...
Definition: SPARS.h:242
void resetFailures(void)
A reset function for resetting the failures count.
Definition: SPARS.cpp:115
void getSparseNeighbors(base::State *inState, std::vector< SparseVertex > &graphNeighborhood)
Get all nodes in the sparse graph which are within sparseDelta_ of the given state.
Definition: SPARS.cpp:668
void setSparseNeighbors(void)
Set a different nearest neighbors datastructure for the spanner graph. This structure is stores only ...
Definition: SPARS.h:255
std::vector< SparseVertex > startM_
Array of start guards.
Definition: SPARS.h:487
Definition of a geometric path.
Definition: PathGeometric.h:55
double averageValence(void) const
Returns the average valence of the spanner graph.
Definition: SPARS.cpp:659
double getSparseDeltaFraction(void) const
Retrieve the sparse graph visibility range delta fraction.
Definition: SPARS.h:313
boost::property_map< DenseGraph, boost::edge_weight_t >::type weightProperty_
Access to the weights of each DenseEdge.
Definition: SPARS.h:523
SparseVertex addGuard(base::State *state, GuardType type)
Construct a node with the given state (state) for the spanner and store it in the nn structure...
Definition: SPARS.cpp:440
SpaceInformationPtr si_
The space information for which planning is done.
Definition: Planner.h:392
double sparseDistanceFunction(const SparseVertex a, const SparseVertex b) const
Compute distance between two nodes in the sparse roadmap spanner.
Definition: SPARS.h:463
PathGeometric geomPath_
Geometric Path variable used for smoothing out paths.
Definition: SPARS.h:499
bool addPathToSpanner(const DensePath &p, SparseVertex vp, SparseVertex vpp)
Method for actually adding a dense path to the Roadmap Spanner, S.
Definition: SPARS.cpp:697
boost::property_map< DenseGraph, vertex_representative_t >::type representativesProperty_
Access to the representatives of the Dense vertices.
Definition: SPARS.h:511
unsigned int guardCount(void) const
Returns the number of guards added to S.
Definition: SPARS.h:347
std::deque< base::State * > DensePath
Internal representation of a dense path.
Definition: SPARS.h:121
GuardType
Enumeration which specifies the reason a guard is added to the spanner.
Definition: SPARS.h:84
DenseGraph g_
The dense graph, D.
Definition: SPARS.h:481
void setSparseDeltaFraction(double d)
Set the delta fraction for connection distance on the sparse spanner. This value represents the visib...
Definition: SPARS.h:285
DenseVertex addSample(base::State *workState, const base::PlannerTerminationCondition &ptc)
Attempt to add a single sample to the roadmap.
Definition: SPARS.cpp:160
bool sameComponent(SparseVertex m1, SparseVertex m2)
Check that two vertices are in the same connected component.
Definition: SPARS.cpp:250
DenseNeighbors nn_
Nearest neighbors data structure.
Definition: SPARS.h:475
A boost shared pointer wrapper for ompl::base::Path.
virtual ~SPARS(void)
Destructor.
Definition: SPARS.cpp:88