PPL API Reference
Overview Core Algorithm Abstractions Utilities Parallel Methods
Modules Class Hierarchy Classes Functions
Todo List Bug List Dead Code
List of all members | Protected Member Functions | Protected Attributes
ConnectorMethod< MPTraits > Class Template Reference

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
 
Name and Label Accessors
const std::string & GetName () const
 Get the class name for this object.
 
const std::string & GetLabel () const
 Get the unique label for this object.
 
std::string GetNameAndLabel () const
 Get the unique string identifier for this object "m_name::m_label".
 
void SetLabel (const std::string &)
 Set the unique label for this object.
 
MPLibrary Accessors
void SetMPLibrary (MPLibrary *) noexcept
 Set the owning MPLibrary.
 
MPLibraryGetMPLibrary () const noexcept
 Get the owning MPLibrary.
 
bool IsRunning () const noexcept
 Check the library's running flag.
 
DistanceMetricPointer GetDistanceMetric (const std::string &) const noexcept
 Get a distance metric by label from the owning MPLibrary.
 
ValidityCheckerPointer GetValidityChecker (const std::string &) const noexcept
 Get a validity checker by label from the owning MPLibrary.
 
NeighborhoodFinderPointer GetNeighborhoodFinder (const std::string &) const noexcept
 Get a neighborhood finder by label from the owning MPLibrary.
 
SamplerPointer GetSampler (const std::string &) const noexcept
 Get a sampler by label from the owning MPLibrary.
 
LocalPlannerPointer GetLocalPlanner (const std::string &) const noexcept
 Get a local planner by label from the owning MPLibrary.
 
ExtenderPointer GetExtender (const std::string &) const noexcept
 Get an extender by label from the owning MPLibrary.
 
PathModifierPointer GetPathModifier (const std::string &) const noexcept
 Get a path modifier by label from the owning MPLibrary.
 
ConnectorPointer GetConnector (const std::string &) const noexcept
 Get a connector by label from the owning MPLibrary.
 
MetricPointer GetMetric (const std::string &) const noexcept
 Get a metric by label from the owning MPLibrary.
 
MapEvaluatorPointer GetMapEvaluator (const std::string &) const noexcept
 Get a map evaluator by label from the owning MPLibrary.
 
MPStrategyPointer GetMPStrategy (const std::string &) const noexcept
 Get a strategy by label from the owning MPLibrary.
 
MPTraits::MPToolsGetMPTools () const noexcept
 Get the MPTools container from the owning MPLibrary.
 
Problem Accessors
MPProblemGetMPProblem () const noexcept
 Get the library's current MPProblem.
 
EnvironmentGetEnvironment () const noexcept
 Get the current environment.
 
MPTaskGetTask () const noexcept
 Get the current task.
 
GroupTaskGetGroupTask () const noexcept
 Get the current group task.
 
Solution Accessors
MPSolutionGetMPSolution () const noexcept
 
RoadmapTypeGetRoadmap (Robot *const _r=nullptr) const noexcept
 Get the current free-space roadmap.
 
GroupRoadmapTypeGetGroupRoadmap (RobotGroup *const _g=nullptr) const noexcept
 Get the current free-space group roadmap.
 
RoadmapTypeGetBlockRoadmap (Robot *const _r=nullptr) const noexcept
 Get the current obstacle-space roadmap.
 
PathGetPath (Robot *const _r=nullptr) const noexcept
 Get the current best path.
 
GroupPathGetGroupPath (RobotGroup *const _g=nullptr) const noexcept
 Get the current best group path.
 
StatClassGetStatClass () const noexcept
 Get the current StatClass.
 
LocalObstacleMapGetLocalObstacleMap () const noexcept
 Get the local obstacle map.
 
GoalTrackerGetGoalTracker () const noexcept
 Get the goal tracker.
 

Public Types

Motion Planning Types
typedef MPTraits::CfgType CfgType
 
typedef MPTraits::GroupCfgType GroupCfgType
 
typedef MPTraits::RoadmapType RoadmapType
 
typedef MPTraits::GroupRoadmapType GroupRoadmapType
 
typedef RoadmapType::VID VID
 
typedef RoadmapType::VertexSet VertexSet
 
Local Types
typedef std::pair< VID, VID > ConnectionAttempt
 
typedef std::unordered_set< ConnectionAttempt > ConnectionAttempts
 
typedef std::unordered_map< void *, ConnectionAttempts > ConnectionAttemptsCache
 
template<typename AbstractRoadmapType >
using OutputIterator = std::back_insert_iterator< std::vector< typename AbstractRoadmapType::VP > >
 
Local Types
typedef MPTraits::LocalObstacleMap LocalObstacleMap
 
typedef MPTraits::Path Path
 
typedef MPTraits::GroupPathType GroupPath
 
typedef MPTraits::MPLibrary MPLibrary
 
typedef MPTraits::MPSolution MPSolution
 
typedef MPTraits::GoalTracker GoalTracker
 
typedef MPLibrary::SamplerPointer SamplerPointer
 
typedef MPLibrary::LocalPlannerPointer LocalPlannerPointer
 
typedef MPLibrary::ExtenderPointer ExtenderPointer
 
typedef MPLibrary::PathModifierPointer PathModifierPointer
 
typedef MPLibrary::ConnectorPointer ConnectorPointer
 
typedef MPLibrary::MetricPointer MetricPointer
 
typedef MPLibrary::MapEvaluatorPointer MapEvaluatorPointer
 
typedef MPLibrary::MPStrategyPointer MPStrategyPointer
 
typedef MPLibrary::DistanceMetricPointer DistanceMetricPointer
 
typedef MPLibrary::ValidityCheckerPointer ValidityCheckerPointer
 
typedef MPLibrary::NeighborhoodFinderPointer NeighborhoodFinderPointer
 

Protected Member Functions

void SetName (const std::string &_s)
 
const std::string & GetBaseFilename () const
 
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.
 

Protected Attributes

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

Detailed Description

template<typename MPTraits>
class ConnectorMethod< MPTraits >

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.

Member Function Documentation

◆ Print()

template<typename MPTraits >
void ConnectorMethod< MPTraits >::Print ( std::ostream &  _os) const
overridevirtual

Print internal state of this object.

Parameters
_osThe std::ostream to print to.

Reimplemented from MPBaseObject< MPTraits >.

Reimplemented in CCsConnector< MPTraits >, and NeighborhoodConnector< MPTraits >.

◆ Initialize()

template<typename MPTraits >
void ConnectorMethod< MPTraits >::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< MPTraits >.

◆ Connect() [1/3]

template<typename MPTraits >
template<typename AbstractRoadmapType >
void ConnectorMethod< MPTraits >::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.

◆ Connect() [2/3]

template<typename MPTraits >
template<typename AbstractRoadmapType >
void ConnectorMethod< MPTraits >::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 MPTraits >
template<typename AbstractRoadmapType , typename InputIterator >
void ConnectorMethod< MPTraits >::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.

◆ IsRewiring()

template<typename MPTraits >
bool ConnectorMethod< MPTraits >::IsRewiring
noexcept

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

Returns
True if this is a rewiring connector.

◆ ConnectImpl() [1/2]

template<typename MPTraits >
void ConnectorMethod< MPTraits >::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 NeighborhoodConnector< MPTraits >.

◆ ConnectImpl() [2/2]

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented in NeighborhoodConnector< MPTraits >.

◆ ConnectNeighbors()

template<typename MPTraits >
template<typename AbstractRoadmapType >
void ConnectorMethod< MPTraits >::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]

template<typename MPTraits >
bool ConnectorMethod< MPTraits >::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.

◆ ConnectNodes() [2/2]

template<typename MPTraits >
bool ConnectorMethod< MPTraits >::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.

◆ DoNotCheck()

template<typename MPTraits >
template<typename AbstractRoadmapType >
bool ConnectorMethod< MPTraits >::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.

◆ CacheFailedConnection()

template<typename MPTraits >
void ConnectorMethod< MPTraits >::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.

◆ IsCached()

template<typename MPTraits >
bool ConnectorMethod< MPTraits >::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.

◆ SetName()

template<typename MPTraits >
void MPBaseObject< MPTraits >::SetName ( const std::string &  _s)
protectedinherited
Parameters
_sClass name

◆ GetBaseFilename()

template<typename MPTraits >
const std::string & MPBaseObject< MPTraits >::GetBaseFilename ( ) const
protectedinherited
Returns
base file name from MPProblem

Member Data Documentation

◆ m_neighborBuffer

template<typename MPTraits >
std::vector<Neighbor> ConnectorMethod< MPTraits >::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.


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