Parasol Planning Library (PPL)
DistanceMetricMethod Class Referenceabstract

#include <DistanceMetricMethod.h>

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

Public Types

Motion Planning Types
typedef MPBaseObject::RoadmapType RoadmapType
 
typedef RoadmapType::VID VID
 
typedef MPBaseObject::GroupCfgType GroupCfgType
 
typedef GroupCfgType::Formation Formation
 
- 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
 DistanceMetricMethod ()=default
 
 DistanceMetricMethod (XMLNode &_node)
 
virtual ~DistanceMetricMethod ()=default
 
Distance Interface
virtual double Distance (const Cfg &_c1, const Cfg &_c2)=0
 
virtual double Distance (const GroupCfgType &_c1, const GroupCfgType &_c2)
 
double EdgeWeight (const RoadmapType *const _r, const typename RoadmapType::CEI &_edge) noexcept
 
double EdgeWeight (const RoadmapType *const _r, const VID _source, const VID _target) noexcept
 
Configuration Scaling

These functions rescale a configuration vector based on this distance metric.

virtual void ScaleCfg (double _length, Cfg &_c, const Cfg &_o)
 
void ScaleCfg (double _length, Cfg &_c)
 
virtual void ScaleCfg (double _length, GroupCfgType &_c, const GroupCfgType &_o)
 
void ScaleCfg (double _length, GroupCfgType &_c)
 
- Public Member Functions inherited from MPBaseObject
 MPBaseObject (const std::string &_label="", const std::string &_name="", bool _debug=false)
 
 MPBaseObject (XMLNode &_node)
 
virtual ~MPBaseObject ()
 
virtual void Print (std::ostream &_os) const
 
virtual void Initialize ()
 
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...
 

Additional Inherited Members

- Protected Member Functions inherited from MPBaseObject
void SetName (const std::string &_s)
 
const std::string & GetBaseFilename () const
 
- Protected Attributes inherited from MPBaseObject
bool m_debug
 Print debug info? More...
 

Detailed Description

Base algorithm abstraction for DistanceMetrics.

DistanceMetricMethod has two important methods: Distance and ScaleCfg.

Distance takes as input two configurations $c_1$ and $c_2$ and returns the computed transition distance between them. @usage

auto dm = this->GetDistanceMetric(m_dmLabel);
Cfg c1, c2;
double dist = dm->Distance(c1, c2);
Definition: Cfg.h:38

ScaleCfg is purposed to scale a $d$-dimensional ray in @cspace to a certain magnitude based upon a general @dm. @usage

auto dm = this->GetDistanceMetric(m_dmLabel);
CfgType ray, origin;
double length;
dm->ScaleCfg(length, ray, origin);
Examples
DistanceMetric_UseCase.cpp.

Member Typedef Documentation

◆ Formation

◆ GroupCfgType

◆ RoadmapType

◆ VID

Constructor & Destructor Documentation

◆ DistanceMetricMethod() [1/2]

DistanceMetricMethod::DistanceMetricMethod ( )
default

◆ DistanceMetricMethod() [2/2]

DistanceMetricMethod::DistanceMetricMethod ( XMLNode _node)

◆ ~DistanceMetricMethod()

virtual DistanceMetricMethod::~DistanceMetricMethod ( )
virtualdefault

Member Function Documentation

◆ Distance() [1/2]

virtual double DistanceMetricMethod::Distance ( const Cfg _c1,
const Cfg _c2 
)
pure virtual

Compute a distance between two configurations.

Parameters
_c1The first configuration.
_c2The second configuration.
Returns
The computed distance between _c1 and _c2.

Implemented in WorkspaceTranslationDistance, WeightedEuclideanDistance, TopologicalDistance, ScaledEuclideanDistance, MinkowskiDistance, LPSweptDistance, BinaryLPSweptDistance, and RMSDDistance.

Examples
DistanceMetric_UseCase.cpp.

◆ Distance() [2/2]

double DistanceMetricMethod::Distance ( const GroupCfgType _c1,
const GroupCfgType _c2 
)
virtual

This version is for group configurations. The default implementation returns the summed individual distances. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ EdgeWeight() [1/2]

double DistanceMetricMethod::EdgeWeight ( const RoadmapType *const  _r,
const typename RoadmapType::CEI _edge 
)
noexcept

Compute the weight of an existing roadmap edge according to this metric.

Parameters
_rThe containing roadmap.
_edgeThe edge iterator.
Returns
The total edge weight computed through each intermediate of the edge.
Todo:
We need to make this work for group roadmaps. Probably it needs to take the roadmap as a templated parameter and not be virtual (there is really only one way to do this).

◆ EdgeWeight() [2/2]

double DistanceMetricMethod::EdgeWeight ( const RoadmapType *const  _r,
const VID  _source,
const VID  _target 
)
noexcept

Compute the weight of an existing roadmap edge according to this metric.

Parameters
_rThe containing roadmap.
_sourceThe source vertex descriptor.
_targetThe target vertex descriptor.
Returns
The total edge weight computed through each intermediate of the edge (_source, _target) in _r.
Exceptions
Ifthe edge (_source, _target) does not exist in _r.

◆ ScaleCfg() [1/4]

void DistanceMetricMethod::ScaleCfg ( double  _length,
Cfg _c 
)

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

◆ ScaleCfg() [2/4]

void DistanceMetricMethod::ScaleCfg ( double  _length,
Cfg _c,
const Cfg _o 
)
virtual

Scale a directional configuration to a certain magnitude.

Parameters
_lengthDesired magnitude.
_cConfiguration to be scaled.
_oOrigin of scaling.
Todo:
This is a very expensive way to scale a configuration. We should probably remove it and require derived classes to implement a more efficient function (this is the best we can do for a base class that does not know anything about the properties of the metric space).

Reimplemented in RMSDDistance, and MinkowskiDistance.

Examples
DistanceMetric_UseCase.cpp.

◆ ScaleCfg() [3/4]

void DistanceMetricMethod::ScaleCfg ( double  _length,
GroupCfgType _c 
)

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

◆ ScaleCfg() [4/4]

void DistanceMetricMethod::ScaleCfg ( double  _length,
GroupCfgType _c,
const GroupCfgType _o 
)
virtual

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


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