All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator

Probabilistic RoadMap planner. More...

#include <PRM.h>

Inheritance diagram for ompl::geometric::PRM:

List of all members.

Classes

struct  vertex_state_t
struct  vertex_successful_connection_attempts_t
struct  vertex_total_connection_attempts_t

Public Types

typedef boost::adjacency_list
< boost::vecS, boost::vecS,
boost::undirectedS,
boost::property
< vertex_state_t, base::State
*, boost::property
< vertex_total_connection_attempts_t,
unsigned int, boost::property
< vertex_successful_connection_attempts_t,
unsigned int, boost::property
< boost::vertex_predecessor_t,
unsigned long int,
boost::property
< boost::vertex_rank_t,
unsigned long int >
> > > >, boost::property
< boost::edge_weight_t, double,
boost::property
< boost::edge_index_t,
unsigned int > > > 
Graph
 The underlying roadmap graph.
typedef boost::graph_traits
< Graph >::vertex_descriptor 
Vertex
typedef boost::graph_traits
< Graph >::edge_descriptor 
Edge
typedef boost::shared_ptr
< NearestNeighbors< Vertex > > 
RoadmapNeighbors
typedef boost::function1
< std::vector< Vertex >
&, const Vertex > 
ConnectionStrategy
 A function returning the milestones that should be attempted to connect to.
typedef boost::function2< bool,
const Vertex &, const Vertex & > 
ConnectionFilter
 A function that can reject connections.

Public Member Functions

 PRM (const base::SpaceInformationPtr &si, bool starStrategy=false)
 Constructor.
virtual void setProblemDefinition (const base::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().
void setConnectionStrategy (const ConnectionStrategy &connectionStrategy)
 Set the connection strategy function that specifies the milestones that connection attempts will be make to for a given milestone.
void setMaxNearestNeighbors (unsigned int k)
 Convenience function that sets the connection strategy to the default one with k nearest neighbors.
void setConnectionFilter (const ConnectionFilter &connectionFilter)
 Set the function that can reject a milestone connection.
virtual void getPlannerData (base::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).
virtual void growRoadmap (double growTime)
 If the user desires, the roadmap can be improved for a specified amount of time. The solve() method will also improve the roadmap, as needed.
virtual void expandRoadmap (double expandTime)
 Attempt to connect disjoint components in the roadmap using random bounding motions (the PRM expansion step)
virtual bool solve (const base::PlannerTerminationCondition &ptc)
 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 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). The function terminates if the call to ptc returns true.
virtual void clear (void)
 Clear all internal datastructures. Planner settings are not affected. Subsequent calls to solve() will ignore all previous work.
template<template< typename T > class NN>
void setNearestNeighbors (void)
 Set a different nearest neighbors datastructure.
virtual void setup (void)
 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.
const GraphgetRoadmap (void) const
double distanceFunction (const Vertex a, const Vertex b) const
 Compute distance between two milestones (this is simply distance between the states of the milestones)
unsigned int milestoneCount (void) const
 Compute distance between two milestones (this is simply distance between the states of the milestones)
const RoadmapNeighbors & getNearestNeighbors (void)

Protected Member Functions

void freeMemory (void)
 Free all the memory allocated by the planner.
Vertex addMilestone (base::State *state)
 Construct a milestone for a given state (state) and store it in the nearest neighbors data structure.
void uniteComponents (Vertex m1, Vertex m2)
 Make two milestones (m1 and m2) be part of the same connected component. The component with fewer elements will get the id of the component with more elements.
void growRoadmap (const std::vector< Vertex > &start, const std::vector< Vertex > &goal, const base::PlannerTerminationCondition &ptc, base::State *workState)
 Randomly sample the state space, add and connect milestones in the roadmap. Stop this process when the termination condition ptc returns true or when any of the start milestones are in the same connected component as any of the goal milestones. Use workState as temporary memory.
void expandRoadmap (const std::vector< Vertex > &starts, const std::vector< Vertex > &goals, const base::PlannerTerminationCondition &ptc, std::vector< base::State * > &workStates)
 Attempt to connect disjoint components in the roadmap using random bounding motions (the PRM expansion step)
bool haveSolution (const std::vector< Vertex > &start, const std::vector< Vertex > &goal, std::pair< Vertex, Vertex > *endpoints=NULL)
 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 endpoints is not null, that pair is recorded.
base::PathPtr constructSolution (const Vertex start, const Vertex goal)
 Given two milestones from the same connected component, construct a path connecting them and set it as the solution.

Protected Attributes

bool starStrategy_
 Flag indicating whether the default strategy is the Star trategy or not.
base::ValidStateSamplerPtr sampler_
 Sampler user for generating valid samples in the state space.
base::StateSamplerPtr simpleSampler_
 Sampler user for generating random in the state space.
RoadmapNeighbors nn_
 Nearest neighbors data structure.
Graph g_
 Connectivity graph.
std::vector< Vertex > startM_
 Array of start milestones.
std::vector< Vertex > goalM_
 Array of goal milestones.
base::PathPtr approxsol_
 Storage for approximate solutions.
double approxlen_
 The length of the approximate solution.
boost::property_map< Graph,
vertex_state_t >::type 
stateProperty_
 Access to the internal base::state at each Vertex.
boost::property_map< Graph,
vertex_total_connection_attempts_t >
::type 
totalConnectionAttemptsProperty_
 Access to the number of total connection attempts for a vertex.
boost::property_map< Graph,
vertex_successful_connection_attempts_t >
::type 
successfulConnectionAttemptsProperty_
 Access to the number of successful connection attempts for a vertex.
boost::property_map< Graph,
boost::edge_weight_t >::type 
weightProperty_
 Access to the weights of each Edge.
boost::property_map< Graph,
boost::edge_index_t >::type 
edgeIDProperty_
 Access to the indices of each Edge.
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.
unsigned int maxEdgeID_
 Maximum unique id number used so for for edges.
ConnectionStrategy connectionStrategy_
 Function that returns the milestones to attempt connections with.
ConnectionFilter connectionFilter_
 Function that can reject a milestone connection.
bool userSetConnectionStrategy_
 Flag indicating whether the employed connection strategy was set by the user (or defaults are assumed)
RNG rng_
 Random number generator.

Detailed Description

Probabilistic RoadMap planner.

      @par Short description
      PRM is a planner that constructs a roadmap of milestones
      that approximate the connectivity of the state space. The
      milestones are valid states in the state space. Near-by
      milestones are connected by valid motions. Finding a motion
      plan that connects two given states is reduced to a
      discrete search (this implementation uses A*) in the
      roadmap.

      @par External documentation
      L.E. Kavraki, P.Švestka, J.-C. Latombe, and M.H. Overmars,
      Probabilistic roadmaps for path planning in high-dimensional configuration spaces,
      <em>IEEE Trans. on Robotics and Automation</em>, vol. 12, pp. 566–580, Aug. 1996.
      DOI: <a href="http://dx.doi.org/10.1109/70.508439">10.1109/70.508439</a><br>
      <a href="http://ieeexplore.ieee.org/ielx4/70/11078/00508439.pdf?tp=&arnumber=508439&isnumber=11078">[PDF]</a>
      <a href="http://www.kavrakilab.org/robotics/prm.html">[more]</a>

Definition at line 79 of file PRM.h.


Member Typedef Documentation

typedef boost::function2<bool, const Vertex&, const Vertex&> ompl::geometric::PRM::ConnectionFilter

A function that can reject connections.

This is called after previous connections from the neighbor list have been added to the roadmap.

Definition at line 140 of file PRM.h.

typedef boost::function1<std::vector<Vertex>&, const Vertex> ompl::geometric::PRM::ConnectionStrategy

A function returning the milestones that should be attempted to connect to.

Note:
Can't use the prefered boost::function syntax here because the Python bindings don't like it.

Definition at line 133 of file PRM.h.

typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, boost::property < vertex_state_t, base::State*, boost::property < vertex_total_connection_attempts_t, unsigned int, boost::property < vertex_successful_connection_attempts_t, unsigned int, boost::property < boost::vertex_predecessor_t, unsigned long int, boost::property < boost::vertex_rank_t, unsigned long int > > > > >, boost::property < boost::edge_weight_t, double, boost::property < boost::edge_index_t, unsigned int> > > ompl::geometric::PRM::Graph

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.
Obviously, a ompl::base::State* vertex property is required.
The incremental connected components algorithm requires vertex_predecessor_t and vertex_rank_t properties. If boost::vecS is not used for vertex storage, then there must also be a boost:vertex_index_t property manually added.
Edges should be undirected and have a weight property.

Definition at line 119 of file PRM.h.


Member Function Documentation

void ompl::geometric::PRM::setConnectionFilter ( const ConnectionFilter connectionFilter) [inline]

Set the function that can reject a milestone connection.

The given function is called immediately before a connection
is checked for collision and added to the roadmap. Other neighbors may have already been connected before this function is called. This allows certain heuristics that use the structure of the roadmap (like connected components or useful cycles) to be implemented by changing this function.
Parameters:
connectionFilterA function that takes the new milestone, a neighboring milestone and returns whether a connection should be attempted.

Definition at line 188 of file PRM.h.

void ompl::geometric::PRM::setConnectionStrategy ( const ConnectionStrategy connectionStrategy) [inline]

Set the connection strategy function that specifies the milestones that connection attempts will be make to for a given milestone.

The behavior and performance of PRM can be changed drastically
by varying the number and properties if the milestones that are connected to each other.
Parameters:
pdefA function that takes a milestone as an argument and returns a collection of other milestones to which a connection attempt must be made. The default connection strategy is to connect a milestone's 10 closest neighbors.

Definition at line 165 of file PRM.h.


The documentation for this class was generated from the following files:
  • src/ompl/geometric/planners/prm/PRM.h
  • src/ompl/geometric/planners/prm/src/PRM.cpp