hpp::core::Roadmap Class Reference

Roadmap built by random path planning methods Nodes are configurations, paths are collision-free paths. More...

#include <hpp/core/roadmap.hh>

Public Member Functions

virtual void clear ()
 Clear the roadmap by deleting nodes and edges. More...
 
NodePtr_t addNode (const ConfigurationPtr_t &config)
 Add a node with given configuration. More...
 
NodePtr_t addNode (const Configuration_t &config)
 
NodePtr_t nearestNode (const Configuration_t &configuration, value_type &minDistance, bool reverse=false)
 Get nearest node to a configuration in the roadmap. More...
 
NodePtr_t nearestNode (const ConfigurationPtr_t &configuration, value_type &minDistance, bool reverse=false)
 
NodePtr_t nearestNode (const Configuration_t &configuration, const ConnectedComponentPtr_t &connectedComponent, value_type &minDistance, bool reverse=false)
 Get nearest node to a configuration in a connected component. More...
 
NodePtr_t nearestNode (const ConfigurationPtr_t &configuration, const ConnectedComponentPtr_t &connectedComponent, value_type &minDistance, bool reverse=false)
 
Nodes_t nearestNodes (const Configuration_t &configuration, size_type k)
 Get nearest node to a configuration in the roadmap. More...
 
Nodes_t nearestNodes (const ConfigurationPtr_t &configuration, size_type k)
 
Nodes_t nearestNodes (const Configuration_t &configuration, const ConnectedComponentPtr_t &connectedComponent, size_type k)
 Get nearest node to a configuration in a connected component. More...
 
Nodes_t nearestNodes (const ConfigurationPtr_t &configuration, const ConnectedComponentPtr_t &connectedComponent, size_type k)
 
NodePtr_t addNodeAndEdges (const NodePtr_t from, const ConfigurationPtr_t &to, const PathPtr_t path)
 Add a node and two edges. More...
 
NodePtr_t addNodeAndEdge (const NodePtr_t from, const ConfigurationPtr_t &to, const PathPtr_t path)
 Add a node and one edge. More...
 
NodePtr_t addNodeAndEdge (const ConfigurationPtr_t &from, const NodePtr_t to, const PathPtr_t path)
 Add a node and one edge. More...
 
EdgePtr_t addEdge (const NodePtr_t &n1, const NodePtr_t &n2, const PathPtr_t &path)
 Add an edge between two nodes. More...
 
void addEdges (const NodePtr_t from, const NodePtr_t &to, const PathPtr_t &path)
 Add two edges between two nodes. More...
 
NodePtr_t addGoalNode (const ConfigurationPtr_t &config)
 Add a goal configuration. More...
 
void resetGoalNodes ()
 
void initNode (const ConfigurationPtr_t &config)
 
virtual ~Roadmap ()
 
bool pathExists () const
 Check that a path exists between the initial node and one goal node. More...
 
const Nodes_tnodes () const
 
const Edges_tedges () const
 
NodePtr_t initNode () const
 
const NodeVector_tgoalNodes () const
 
const ConnectedComponents_tconnectedComponents () const
 Get list of connected component of the roadmap. More...
 
NearestNeighborPtr_t nearestNeighbor ()
 Get nearestNeighbor object. More...
 
void nearestNeighbor (NearestNeighborPtr_t nearestNeighbor)
 Set new NearestNeighbor (roadmap must be empty) More...
 
std::ostream & print (std::ostream &os) const
 Print roadmap in a stream. More...
 
Distance used for nearest neighbor search

Get distance function

const DistancePtr_tdistance () const
 

Static Public Member Functions

static RoadmapPtr_t create (const DistancePtr_t &distance, const DevicePtr_t &robot)
 Return shared pointer to new instance. More...
 

Protected Member Functions

 Roadmap (const DistancePtr_t &distance, const DevicePtr_t &robot)
 Constructor. More...
 
void addConnectedComponent (const NodePtr_t &node)
 Add a new connected component in the roadmap. More...
 
virtual void push_node (const NodePtr_t &n)
 Give child class the opportunity to get the event "A node has been added to the roadmap". More...
 
virtual void addEdge (const EdgePtr_t &e)
 Give child class the opportunity to get the event "An edge has been added to the roadmap". More...
 
virtual NodePtr_t createNode (const ConfigurationPtr_t &configuration) const
 Node factory Reimplement the function if you want to create an instance of a child class of Node. More...
 
void init (RoadmapWkPtr_t weak)
 Store weak pointer to itself. More...
 

Detailed Description

Roadmap built by random path planning methods Nodes are configurations, paths are collision-free paths.

Constructor & Destructor Documentation

◆ ~Roadmap()

virtual hpp::core::Roadmap::~Roadmap ( )
virtual

◆ Roadmap()

hpp::core::Roadmap::Roadmap ( const DistancePtr_t distance,
const DevicePtr_t robot 
)
protected

Constructor.

Parameters
distancedistance function for nearest neighbor computations

Member Function Documentation

◆ addConnectedComponent()

void hpp::core::Roadmap::addConnectedComponent ( const NodePtr_t node)
protected

Add a new connected component in the roadmap.

Parameters
nodenode pointing to the connected component.
Note
The node is added in the connected component.

◆ addEdge() [1/2]

EdgePtr_t hpp::core::Roadmap::addEdge ( const NodePtr_t n1,
const NodePtr_t n2,
const PathPtr_t path 
)

Add an edge between two nodes.

◆ addEdge() [2/2]

virtual void hpp::core::Roadmap::addEdge ( const EdgePtr_t e)
protectedvirtual

Give child class the opportunity to get the event "An edge has been added to the roadmap".

Note
you must always call the parent implementation first
void YourRoadmap::push_edge(const EdgePtr_t e) {
Roadmap::push_edge(e);
// Your code here.
}

◆ addEdges()

void hpp::core::Roadmap::addEdges ( const NodePtr_t  from,
const NodePtr_t to,
const PathPtr_t path 
)

Add two edges between two nodes.

Parameters
fromfirst node
tosecond node
pathpath going from from to to. the reverse edge is added with the reverse path.

◆ addGoalNode()

NodePtr_t hpp::core::Roadmap::addGoalNode ( const ConfigurationPtr_t config)

Add a goal configuration.

Parameters
configconfiguration If configuration is already in the roadmap, tag corresponding node as goal node. Otherwise create a new node.

◆ addNode() [1/2]

NodePtr_t hpp::core::Roadmap::addNode ( const ConfigurationPtr_t config)

Add a node with given configuration.

Parameters
configconfiguration

If configuration is alread in the roadmap, return the node containing the configuration. Otherwise, create a new node and a new connected component with this node.

◆ addNode() [2/2]

NodePtr_t hpp::core::Roadmap::addNode ( const Configuration_t config)
inline

◆ addNodeAndEdge() [1/2]

NodePtr_t hpp::core::Roadmap::addNodeAndEdge ( const NodePtr_t  from,
const ConfigurationPtr_t to,
const PathPtr_t  path 
)

Add a node and one edge.

Parameters
fromnode from which the edge starts,
toconfiguration to which the edge stops
pathpath between both configurations
Returns
node containing configuration to. Add the oriented edge (from -> to)
Note
this function simplifies the management of connected components since it adds the new node in the connected component of from.

◆ addNodeAndEdge() [2/2]

NodePtr_t hpp::core::Roadmap::addNodeAndEdge ( const ConfigurationPtr_t from,
const NodePtr_t  to,
const PathPtr_t  path 
)

Add a node and one edge.

Parameters
fromconfiguration from which the edge starts,
tonode to which the edge stops
pathpath between both configurations
Returns
node containing configuration from. Add the oriented edge (from -> to)
Note
this function simplifies the management of connected components since it adds the new node in the connected component of to.

◆ addNodeAndEdges()

NodePtr_t hpp::core::Roadmap::addNodeAndEdges ( const NodePtr_t  from,
const ConfigurationPtr_t to,
const PathPtr_t  path 
)

Add a node and two edges.

Parameters
fromnode from which the edge starts,
toconfiguration to which the edge stops
pathpath between both configurations
Returns
node containing configuration to. Add the symmetric edge with reverse path.
Note
this function simplifies the management of connected components since it adds the new node in the connected component of from.

◆ clear()

virtual void hpp::core::Roadmap::clear ( )
virtual

Clear the roadmap by deleting nodes and edges.

◆ connectedComponents()

const ConnectedComponents_t& hpp::core::Roadmap::connectedComponents ( ) const

Get list of connected component of the roadmap.

◆ create()

static RoadmapPtr_t hpp::core::Roadmap::create ( const DistancePtr_t distance,
const DevicePtr_t robot 
)
static

Return shared pointer to new instance.

◆ createNode()

virtual NodePtr_t hpp::core::Roadmap::createNode ( const ConfigurationPtr_t configuration) const
protectedvirtual

Node factory Reimplement the function if you want to create an instance of a child class of Node.

◆ distance()

const DistancePtr_t& hpp::core::Roadmap::distance ( ) const

◆ edges()

const Edges_t& hpp::core::Roadmap::edges ( ) const
inline

◆ goalNodes()

const NodeVector_t& hpp::core::Roadmap::goalNodes ( ) const
inline

◆ init()

void hpp::core::Roadmap::init ( RoadmapWkPtr_t  weak)
protected

Store weak pointer to itself.

◆ initNode() [1/2]

void hpp::core::Roadmap::initNode ( const ConfigurationPtr_t config)
inline

◆ initNode() [2/2]

NodePtr_t hpp::core::Roadmap::initNode ( ) const
inline

◆ nearestNeighbor() [1/2]

NearestNeighborPtr_t hpp::core::Roadmap::nearestNeighbor ( )

Get nearestNeighbor object.

◆ nearestNeighbor() [2/2]

void hpp::core::Roadmap::nearestNeighbor ( NearestNeighborPtr_t  nearestNeighbor)

Set new NearestNeighbor (roadmap must be empty)

◆ nearestNode() [1/4]

NodePtr_t hpp::core::Roadmap::nearestNode ( const Configuration_t configuration,
value_type minDistance,
bool  reverse = false 
)

Get nearest node to a configuration in the roadmap.

Parameters
configurationconfiguration
reverseif true, compute distance from given configuration to nodes in roadmap, if false from nodes in roadmap to given configuration
Return values
distanceto the nearest node.

◆ nearestNode() [2/4]

NodePtr_t hpp::core::Roadmap::nearestNode ( const ConfigurationPtr_t configuration,
value_type minDistance,
bool  reverse = false 
)
inline

◆ nearestNode() [3/4]

NodePtr_t hpp::core::Roadmap::nearestNode ( const Configuration_t configuration,
const ConnectedComponentPtr_t connectedComponent,
value_type minDistance,
bool  reverse = false 
)

Get nearest node to a configuration in a connected component.

Parameters
configurationconfiguration
connectedComponentthe connected component
reverseif true, compute distance from given configuration to nodes in roadmap, if false from nodes in roadmap to given configuration
Return values
distanceto the nearest node.

◆ nearestNode() [4/4]

NodePtr_t hpp::core::Roadmap::nearestNode ( const ConfigurationPtr_t configuration,
const ConnectedComponentPtr_t connectedComponent,
value_type minDistance,
bool  reverse = false 
)
inline

◆ nearestNodes() [1/4]

Nodes_t hpp::core::Roadmap::nearestNodes ( const Configuration_t configuration,
size_type  k 
)

Get nearest node to a configuration in the roadmap.

Parameters
configurationconfiguration
knumber of nearest nodes to return if false from nodes in roadmap to given configuration
Returns
k nearest nodes

◆ nearestNodes() [2/4]

Nodes_t hpp::core::Roadmap::nearestNodes ( const ConfigurationPtr_t configuration,
size_type  k 
)
inline

◆ nearestNodes() [3/4]

Nodes_t hpp::core::Roadmap::nearestNodes ( const Configuration_t configuration,
const ConnectedComponentPtr_t connectedComponent,
size_type  k 
)

Get nearest node to a configuration in a connected component.

Parameters
configurationconfiguration
connectedComponentthe connected component
knumber of nearest nodes to return if false from nodes in roadmap to given configuration
Returns
k nearest nodes in the connected component

◆ nearestNodes() [4/4]

Nodes_t hpp::core::Roadmap::nearestNodes ( const ConfigurationPtr_t configuration,
const ConnectedComponentPtr_t connectedComponent,
size_type  k 
)
inline

◆ nodes()

const Nodes_t& hpp::core::Roadmap::nodes ( ) const
inline

◆ pathExists()

bool hpp::core::Roadmap::pathExists ( ) const

Check that a path exists between the initial node and one goal node.

◆ print()

std::ostream& hpp::core::Roadmap::print ( std::ostream &  os) const

Print roadmap in a stream.

◆ push_node()

virtual void hpp::core::Roadmap::push_node ( const NodePtr_t n)
inlineprotectedvirtual

Give child class the opportunity to get the event "A node has been added to the roadmap".

References hpp::core::operator<<().

◆ resetGoalNodes()

void hpp::core::Roadmap::resetGoalNodes ( )
inline