Parasol Planning Library (PPL)
ConnectorMethod Class Reference

#include <ConnectorMethod.h>

Inheritance diagram for ConnectorMethod:
Inheritance graph
[legend]
Collaboration diagram for ConnectorMethod:
Collaboration graph
[legend]

Public Types

Motion Planning Types
typedef MPBaseObject::GroupCfgType GroupCfgType
 
typedef MPBaseObject::RoadmapType RoadmapType
 
typedef MPBaseObject::GroupRoadmapType GroupRoadmapType
 
typedef RoadmapType::VID VID
 
typedef RoadmapType::VertexSet VertexSet
 
Local Types
typedef std::pair< VID, VIDConnectionAttempt
 
typedef std::unordered_set< ConnectionAttemptConnectionAttempts
 
typedef std::unordered_map< void *, ConnectionAttemptsConnectionAttemptsCache
 
template<typename AbstractRoadmapType >
using OutputIterator = std::back_insert_iterator< std::vector< typename AbstractRoadmapType::VP > >
 
- Public Types inherited from MPBaseObject
typedef DefaultWeight< CfgWeightType
 
typedef GenericStateGraph< Cfg, WeightTypeRoadmapType
 
typedef GroupCfg< RoadmapTypeGroupCfgType
 
typedef GroupLocalPlan< RoadmapTypeGroupWeightType
 
typedef GroupRoadmap< GroupCfgType, GroupWeightTypeGroupRoadmapType
 

Public Member Functions

Construction
 ConnectorMethod ()
 
 ConnectorMethod (XMLNode &_node)
 
virtual ~ConnectorMethod ()=default
 
MPBaseObject Overrides
virtual void Print (std::ostream &_os) const override
 
virtual void Initialize () override
 
Connection Interface
template<typename AbstractRoadmapType >
void Connect (AbstractRoadmapType *const _r, const VertexSet *const _targetSet=nullptr, OutputIterator< AbstractRoadmapType > *const _collision=nullptr)
 
template<typename AbstractRoadmapType >
void Connect (AbstractRoadmapType *const _r, const VID _source, const VertexSet *const _targetSet=nullptr, OutputIterator< AbstractRoadmapType > *const _collision=nullptr)
 
template<typename AbstractRoadmapType , typename InputIterator >
void Connect (AbstractRoadmapType *const _r, InputIterator _sourceBegin, InputIterator _sourceEnd, const VertexSet *const _targetSet=nullptr, OutputIterator< AbstractRoadmapType > *const _collision=nullptr)
 
bool IsRewiring () const noexcept
 
- Public Member Functions inherited from MPBaseObject
 MPBaseObject (const std::string &_label="", const std::string &_name="", bool _debug=false)
 
 MPBaseObject (XMLNode &_node)
 
virtual ~MPBaseObject ()
 
const std::string & GetName () const
 Get the class name for this object. More...
 
const std::string & GetLabel () const
 Get the unique label for this object. More...
 
std::string GetNameAndLabel () const
 Get the unique string identifier for this object "m_name::m_label". More...
 
void SetLabel (const std::string &)
 Set the unique label for this object. More...
 
void SetMPLibrary (MPLibrary *) noexcept
 Set the owning MPLibrary. More...
 
MPLibraryGetMPLibrary () const noexcept
 Get the owning MPLibrary. More...
 
bool IsRunning () const noexcept
 Check the library's running flag. More...
 
MPProblemGetMPProblem () const noexcept
 Get the library's current MPProblem. More...
 
EnvironmentGetEnvironment () const noexcept
 Get the current environment. More...
 
MPTaskGetTask () const noexcept
 Get the current task. More...
 
GroupTaskGetGroupTask () const noexcept
 Get the current group task. More...
 
MPSolutionTypeGetMPSolution () const noexcept
 
RoadmapTypeGetRoadmap (Robot *const _r=nullptr) const noexcept
 Get the current free-space roadmap. More...
 
GroupRoadmapTypeGetGroupRoadmap (RobotGroup *const _g=nullptr) const noexcept
 Get the current free-space group roadmap. More...
 
RoadmapTypeGetBlockRoadmap (Robot *const _r=nullptr) const noexcept
 Get the current obstacle-space roadmap. More...
 
PathGetPath (Robot *const _r=nullptr) const noexcept
 
GroupPathGetGroupPath (RobotGroup *const _g=nullptr) const noexcept
 Get the current best group path. More...
 
StatClassGetStatClass () const noexcept
 Get the current StatClass. More...
 
LocalObstacleMapGetLocalObstacleMap () const noexcept
 Get the local obstacle map. More...
 

Protected Member Functions

Connection Helpers
virtual void ConnectImpl (RoadmapType *const _r, const VID _source, const VertexSet *const _targetSet=nullptr, OutputIterator< RoadmapType > *const _collision=nullptr)
 
virtual void ConnectImpl (GroupRoadmapType *const _r, const VID _source, const VertexSet *const _targetSet=nullptr, OutputIterator< GroupRoadmapType > *const _collision=nullptr)
 
template<typename AbstractRoadmapType >
void ConnectNeighbors (AbstractRoadmapType *const _r, const VID _source, const std::vector< Neighbor > &_neighbors, OutputIterator< AbstractRoadmapType > *const _collision=nullptr, const bool _earlyQuit=false)
 
bool ConnectNodes (RoadmapType *const _r, const VID _source, const VID _target, OutputIterator< RoadmapType > *const _collision=nullptr)
 
bool ConnectNodes (GroupRoadmapType *const _r, const VID _source, const VID _target, OutputIterator< GroupRoadmapType > *const _collision=nullptr)
 
template<typename AbstractRoadmapType >
bool DoNotCheck (AbstractRoadmapType *const _r, const VID _source, const VID _target) const
 
Connection Caching
void CacheFailedConnection (void *const _map, const VID _source, const VID _target) noexcept
 
bool IsCached (void *const _map, const VID _source, const VID _target) const noexcept
 
void ClearConnectionAttempts ()
 Clear the attempts cache. More...
 
- Protected Member Functions inherited from MPBaseObject
void SetName (const std::string &_s)
 
const std::string & GetBaseFilename () const
 

Protected Attributes

Internal State
ConnectionAttemptsCache m_attemptsCache
 All failed connection attempts. More...
 
std::string m_lpLabel
 Local Planner. More...
 
bool m_skipIfSameCC {true}
 Skip connections within the same CC? More...
 
size_t m_maxFailures {0}
 Maximum allowed failures per use. More...
 
size_t m_failures {0}
 Failures in this use. More...
 
bool m_oneWay {false}
 Create one-way edges or two-way? More...
 
bool m_rewiring {false}
 Does this connector delete edges? More...
 
bool m_selfEdges {false}
 Indicates if roadmap vertices should have self-edges. More...
 
std::vector< Neighborm_neighborBuffer
 
- Protected Attributes inherited from MPBaseObject
bool m_debug
 Print debug info? More...
 

Detailed Description

Base algorithm abstraction for Connectors. Connectors attempt to connect a set of 'source' roadmap vertices to each of a second 'target' set of vertices. Successes generate new edges in the roadmap.

Examples
Connectors_UseCase.cpp.

Member Typedef Documentation

◆ ConnectionAttempt

◆ ConnectionAttempts

◆ ConnectionAttemptsCache

◆ GroupCfgType

◆ GroupRoadmapType

◆ OutputIterator

template<typename AbstractRoadmapType >
using ConnectorMethod::OutputIterator = std::back_insert_iterator< std::vector< typename AbstractRoadmapType::VP > >

◆ RoadmapType

◆ VertexSet

◆ VID

Constructor & Destructor Documentation

◆ ConnectorMethod() [1/2]

ConnectorMethod::ConnectorMethod ( )

◆ ConnectorMethod() [2/2]

ConnectorMethod::ConnectorMethod ( XMLNode _node)

◆ ~ConnectorMethod()

virtual ConnectorMethod::~ConnectorMethod ( )
virtualdefault

Member Function Documentation

◆ CacheFailedConnection()

void ConnectorMethod::CacheFailedConnection ( void *const  _map,
const VID  _source,
const VID  _target 
)
protectednoexcept

Add a failed connection attempt to the cache.

Parameters
_mapThe map pointer (either individual or group roadmap).
_sourceThe source VID.
_targetThe target VID.

◆ ClearConnectionAttempts()

void ConnectorMethod::ClearConnectionAttempts ( )
protected

Clear the attempts cache.

◆ Connect() [1/3]

template<typename AbstractRoadmapType >
void ConnectorMethod::Connect ( AbstractRoadmapType *const  _r,
const VertexSet *const  _targetSet = nullptr,
OutputIterator< AbstractRoadmapType > *const  _collision = nullptr 
)

Generate edges using all vertices in the roadmap as the source.

Parameters
_rThe roadmap to connect.
_targetSetThe set of target vertices, or null for the full roadmap.
_collisionAn optional output iterator for collisions.
Examples
Connectors_UseCase.cpp.

◆ Connect() [2/3]

template<typename AbstractRoadmapType >
void ConnectorMethod::Connect ( AbstractRoadmapType *const  _r,
const VID  _source,
const VertexSet *const  _targetSet = nullptr,
OutputIterator< AbstractRoadmapType > *const  _collision = nullptr 
)

Generate edges using a single vertex as the source.

Parameters
_rThe roadmap to connect.
_sourceThe source vertex.
_targetSetThe set of target vertices, or null for the full roadmap.
_collisionAn optional output iterator for collisions.

◆ Connect() [3/3]

template<typename AbstractRoadmapType , typename InputIterator >
void ConnectorMethod::Connect ( AbstractRoadmapType *const  _r,
InputIterator  _sourceBegin,
InputIterator  _sourceEnd,
const VertexSet *const  _targetSet = nullptr,
OutputIterator< AbstractRoadmapType > *const  _collision = nullptr 
)

Generate edges using a range of VIDs as the source.

Template Parameters
InputIteratorEither a roadmap iterator or any iterator that dereferences to a VID.
Parameters
_rThe roadmap to connect.
_sourceBeginThe beginning of the VID range.
_sourceEndThe end of the VID range.
_targetSetThe set of target vertices, or null for the full roadmap.
_collisionAn optional output iterator for collisions.

◆ ConnectImpl() [1/2]

void ConnectorMethod::ConnectImpl ( GroupRoadmapType *const  _r,
const VID  _source,
const VertexSet *const  _targetSet = nullptr,
OutputIterator< GroupRoadmapType > *const  _collision = nullptr 
)
protectedvirtual

Reimplemented in RewireConnector, and NeighborhoodConnector.

◆ ConnectImpl() [2/2]

void ConnectorMethod::ConnectImpl ( RoadmapType *const  _r,
const VID  _source,
const VertexSet *const  _targetSet = nullptr,
OutputIterator< RoadmapType > *const  _collision = nullptr 
)
protectedvirtual

Connect a source node to some subset of a target set. Derived classes specify how this will happen.

Parameters
_rThe owning roadmap.
_sourceThe source node to connect.
_targetSetThe candidate target nodes, or null for the whole roadmap.
_collisionAn optional output iterator for collisions.

Reimplemented in RewireConnector, and NeighborhoodConnector.

◆ ConnectNeighbors()

template<typename AbstractRoadmapType >
void ConnectorMethod::ConnectNeighbors ( AbstractRoadmapType *const  _r,
const VID  _source,
const std::vector< Neighbor > &  _neighbors,
OutputIterator< AbstractRoadmapType > *const  _collision = nullptr,
const bool  _earlyQuit = false 
)
protected

Try to connect a given configuration to a set of nearest neighbors.

Parameters
_rThe roadmap.
_sourceThe configuration.
_neighborsThe set of neighbors to try.
_collisionOutput for invalid configurations.
_earlyQuitQuit after the first successful connection?

◆ ConnectNodes() [1/2]

bool ConnectorMethod::ConnectNodes ( GroupRoadmapType *const  _r,
const VID  _source,
const VID  _target,
OutputIterator< GroupRoadmapType > *const  _collision = nullptr 
)
protected

Attempt a connection between two group configurations.

Parameters
_rThe group roadmap.
_sourceThe source configuration's VID.
_targetThe target configuration's VID.
_collisionOutput for invalid configurations.
Returns
True if the connection succeeded.

◆ ConnectNodes() [2/2]

bool ConnectorMethod::ConnectNodes ( RoadmapType *const  _r,
const VID  _source,
const VID  _target,
OutputIterator< RoadmapType > *const  _collision = nullptr 
)
protected

Attempt a connection between two individual configurations.

Parameters
_rThe roadmap.
_sourceThe source configuration's VID.
_targetThe target configuration's VID.
_collisionOutput for invalid configurations.
Returns
True if the connection succeeded.

◆ DoNotCheck()

template<typename AbstractRoadmapType >
bool ConnectorMethod::DoNotCheck ( AbstractRoadmapType *const  _r,
const VID  _source,
const VID  _target 
) const
protected

Check whether a connection should be attempted.

Parameters
_rThe roadmap.
_sourceThe source vertex.
_targetThe target vertex.
Returns
True if the connection should not be attempted.

◆ Initialize()

void ConnectorMethod::Initialize ( )
overridevirtual

Initialize this object for the current MPProblem. This should reset any internal state of the algorithms so that they are ready for execution. It is also the place to initialize any state that depends on the current problem.

Warning
This member will be called for every compiled algorithm in the planning library - even those that will not be used. If an algorithm needs to do expenisve setup, then this method should only set a flag that tells it to do so on first use. The only exceptions are the MPStrategies, which will only have their initialize called on first use.

Reimplemented from MPBaseObject.

◆ IsCached()

bool ConnectorMethod::IsCached ( void *const  _map,
const VID  _source,
const VID  _target 
) const
protectednoexcept

Check if attempt is in the failure cache.

Parameters
_mapThe map pointer (either individual or group roadmap).
_sourceThe source VID.
_targetThe target VID.
Returns
True if the attempt to connect _source to _target has already failed.

◆ IsRewiring()

bool ConnectorMethod::IsRewiring ( ) const
noexcept

Check whether this is a rewiring connector (which may delete edges).

Returns
True if this is a rewiring connector.

◆ Print()

void ConnectorMethod::Print ( std::ostream &  _os) const
overridevirtual

Print internal state of this object.

Parameters
_osThe std::ostream to print to.

Reimplemented from MPBaseObject.

Reimplemented in NeighborhoodConnector, and CCsConnector.

Field Documentation

◆ m_attemptsCache

ConnectionAttemptsCache ConnectorMethod::m_attemptsCache
protected

All failed connection attempts.

◆ m_failures

size_t ConnectorMethod::m_failures {0}
protected

Failures in this use.

◆ m_lpLabel

std::string ConnectorMethod::m_lpLabel
protected

Local Planner.

◆ m_maxFailures

size_t ConnectorMethod::m_maxFailures {0}
protected

Maximum allowed failures per use.

◆ m_neighborBuffer

std::vector<Neighbor> ConnectorMethod::m_neighborBuffer
protected

This is a performance optimization which makes a big impact. The neighbor set can be as large as the roadmap, so it is important to avoid re-allocating it on every call to ConnectImpl.

◆ m_oneWay

bool ConnectorMethod::m_oneWay {false}
protected

Create one-way edges or two-way?

◆ m_rewiring

bool ConnectorMethod::m_rewiring {false}
protected

Does this connector delete edges?

◆ m_selfEdges

bool ConnectorMethod::m_selfEdges {false}
protected

Indicates if roadmap vertices should have self-edges.

◆ m_skipIfSameCC

bool ConnectorMethod::m_skipIfSameCC {true}
protected

Skip connections within the same CC?


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