hpp-core: hpp::core::Roadmap Class Reference

hpp-core 9.0.2 Implement basic classes for canonical path planning for kinematic chains.

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
hpp::core::Roadmap Class Reference
Roadmap

`#include <hpp/core/roadmap.hh>`

## Public Member Functions
virtual void | clear ()
| Clear the roadmap by deleting nodes and edges.
NodePtr_t | addNode (ConfigurationIn_t config)
NodePtr_t | nearestNode (ConfigurationIn_t configuration, value_type &minDistance, bool reverse=false)
NodePtr_t | nearestNode (ConfigurationIn_t configuration, const ConnectedComponentPtr_t &connectedComponent, value_type &minDistance, bool reverse=false)
Nodes_t | nearestNodes (ConfigurationIn_t configuration, size_type k)
Nodes_t | nearestNodes (ConfigurationIn_t configuration, const ConnectedComponentPtr_t &connectedComponent, size_type k)
NodeVector_t | nodesWithinBall (ConfigurationIn_t configuration, const ConnectedComponentPtr_t &connectedComponent, value_type maxDistance)
NodePtr_t | addNodeAndEdges (const NodePtr_t from, ConfigurationIn_t to, const PathPtr_t path)
NodePtr_t | addNodeAndEdge (const NodePtr_t from, ConfigurationIn_t to, const PathPtr_t path)
NodePtr_t | addNodeAndEdge (ConfigurationIn_t from, const NodePtr_t to, const PathPtr_t path)
EdgePtr_t | addEdge (const NodePtr_t &n1, const NodePtr_t &n2, const PathPtr_t &path)
| Add an edge between two nodes.
void | addEdges (const NodePtr_t from, const NodePtr_t &to, const PathPtr_t &path)
void | merge (const RoadmapPtr_t &other)
| Add the nodes and edges of a roadmap into this one.
void | insertPathVector (const PathVectorPtr_t &path, bool backAndForth)
NodePtr_t | addGoalNode (ConfigurationIn_t config)
void | resetGoalNodes ()
void | initNode (ConfigurationIn_t config)
virtual | ~Roadmap ()
bool | pathExists () const
| Check that a path exists between the initial node and one goal node.
const Nodes_t & | nodes () const
const Edges_t & | edges () const
NodePtr_t | initNode () const
const NodeVector_t & | goalNodes () const
const ConnectedComponents_t & | connectedComponents () const
| Get list of connected component of the roadmap.
NearestNeighborPtr_t | nearestNeighbor ()
| Get nearestNeighbor object.
void | nearestNeighbor (NearestNeighborPtr_t nearestNeighbor)
| Set new NearestNeighbor (roadmap must be empty)
std::ostream & | print (std::ostream &os) const
Distance used for nearest neighbor search
Get distance function
const DistancePtr_t & | distance () const
const path::CostPtr_t | cost () const
| Get cost used to search for optimal path.
void | cost (const path::CostPtr_t &cost)
| Set cost used to search for optimal path.

## Static Public Member Functions
static RoadmapPtr_t | create (const DistancePtr_t &distance, const DevicePtr_t &robot)
| Return shared pointer to new instance.

## Protected Member Functions
| Roadmap (const DistancePtr_t &distance, const DevicePtr_t &robot)
| Roadmap ()
void | addConnectedComponent (const NodePtr_t &node)
virtual void | push_node (const NodePtr_t &n)
virtual void | impl_addEdge (const EdgePtr_t &e)
virtual NodePtr_t | createNode (ConfigurationIn_t configuration) const
void | init (RoadmapWkPtr_t weak)
| Store weak pointer to itself.

## 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() [1/2]

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

Constructor

Parameters

  distance | distance function for nearest neighbor computations

## ◆ Roadmap() [2/2]

hpp::core::Roadmap::Roadmap | ( |  | ) |
| inlineprotected

## Member Function Documentation

## ◆ addConnectedComponent()

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

Add a new connected component in the roadmap.

Parameters

  node | node pointing to the connected component.

Note
  The node is added in the connected component.

## ◆ addEdge()

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

Add an edge between two nodes.

## ◆ 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

  from | first node
  to | second node
  path | path going from `from` to `to`. the reverse edge is added with the reverse path.

## ◆ addGoalNode()

NodePtr_t hpp::core::Roadmap::addGoalNode | ( | ConfigurationIn_t | config | ) |

Add a goal configuration

Parameters

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

## ◆ addNode()

NodePtr_t hpp::core::Roadmap::addNode | ( | ConfigurationIn_t | config | ) |

Add a node with given configuration

Parameters

  config | configuration

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.

## ◆ addNodeAndEdge() [1/2]

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

Add a node and one edge

Parameters

  from | configuration from which the edge starts,
  to | node to which the edge stops
  path | path 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`.

## ◆ addNodeAndEdge() [2/2]

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

Add a node and one edge

Parameters

  from | node from which the edge starts,
  to | configuration to which the edge stops
  path | path 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`.

## ◆ addNodeAndEdges()

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

Add a node and two edges

Parameters

  from | node from which the edge starts,
  to | configuration to which the edge stops
  path | path 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.

## ◆ cost() [1/2]

const path::CostPtr_t hpp::core::Roadmap::cost | ( |  | ) | const

Get cost used to search for optimal path.

## ◆ cost() [2/2]

void hpp::core::Roadmap::cost | ( | const path::CostPtr_t & | cost | ) |

Set cost used to search for optimal path.

## ◆ 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 | ( | ConfigurationIn_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

## ◆ impl_addEdge()

virtual void hpp::core::Roadmap::impl_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.
  }
  hpp::core::Edge
  Definition edge.hh:46

## ◆ init()

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

Store weak pointer to itself.

## ◆ initNode() [1/2]

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

## ◆ initNode() [2/2]

void hpp::core::Roadmap::initNode | ( | ConfigurationIn_t | config | ) |
| inline

## ◆ insertPathVector()

void hpp::core::Roadmap::insertPathVector | ( | const PathVectorPtr_t & | path,
|  | bool | backAndForth
| ) |  |

Add a PathVector instance in the roadmap Waypoints are inserted as nodes, each elementary path is inserted as an edge

Parameters

  backAndForth | whether to insert the reverse path as well.

## ◆ merge()

void hpp::core::Roadmap::merge | ( | const RoadmapPtr_t & | other | ) |

Add the nodes and edges of a roadmap into this one.

## ◆ 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/2]

NodePtr_t hpp::core::Roadmap::nearestNode | ( | ConfigurationIn_t | configuration,
|  | const ConnectedComponentPtr_t & | connectedComponent,
|  | value_type & | minDistance,
|  | bool | reverse = `false`
| ) |  |

Get nearest node to a configuration in a connected component.

Parameters

  configuration | configuration
  connectedComponent | the connected component
  reverse | if true, compute distance from given configuration to nodes in roadmap, if false from nodes in roadmap to given configuration

Return values

  distance | to the nearest node.

## ◆ nearestNode() [2/2]

NodePtr_t hpp::core::Roadmap::nearestNode | ( | ConfigurationIn_t | configuration,
|  | value_type & | minDistance,
|  | bool | reverse = `false`
| ) |  |

Get nearest node to a configuration in the roadmap.

Parameters

  configuration | configuration
  reverse | if true, compute distance from given configuration to nodes in roadmap, if false from nodes in roadmap to given configuration

Return values

  distance | to the nearest node.

## ◆ nearestNodes() [1/2]

Nodes_t hpp::core::Roadmap::nearestNodes | ( | ConfigurationIn_t | configuration,
|  | const ConnectedComponentPtr_t & | connectedComponent,
|  | size_type | k
| ) |  |

Get nearest node to a configuration in a connected component.

Parameters

  configuration | configuration
  connectedComponent | the connected component
  k | number of nearest nodes to return if false from nodes in roadmap to given configuration

Returns
  k nearest nodes in the connected component

## ◆ nearestNodes() [2/2]

Nodes_t hpp::core::Roadmap::nearestNodes | ( | ConfigurationIn_t | configuration,
|  | size_type | k
| ) |  |

Get nearest node to a configuration in the roadmap.

Parameters

  configuration | configuration
  k | number of nearest nodes to return if false from nodes in roadmap to given configuration

Returns
  k nearest nodes

## ◆ nodes()

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

## ◆ nodesWithinBall()

NodeVector_t hpp::core::Roadmap::nodesWithinBall | ( | ConfigurationIn_t | configuration,
|  | const ConnectedComponentPtr_t & | connectedComponent,
|  | value_type | maxDistance
| ) |  |

Neighbor search.

Returns
  all the nodes closer than `maxDistance` to `configuration` within `connectedComponent`.

## ◆ 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"

## ◆ resetGoalNodes()

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

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

- include/hpp/core/roadmap.hh