RobWorkProject
Public Types | Public Member Functions | Static Public Attributes | List of all members
PathLengthOptimizer Class Reference

The PathLengthOptimizer implements the 3 different path length optimizers presented in [1]. More...

#include <PathLengthOptimizer.hpp>

Public Types

typedef rw::common::Ptr< PathLengthOptimizerPtr
 smart pointer type to this class
 
typedef rw::common::Ptr< const PathLengthOptimizerCPtr
 smart pointer type to this const class
 
typedef std::list< rw::math::QQList
 A list of configurations.
 

Public Member Functions

 PathLengthOptimizer (const rw::pathplanning::PlannerConstraint &constraint, rw::math::QMetric::CPtr metric)
 Constructor. More...
 
virtual ~PathLengthOptimizer ()
 Destructor.
 
rw::trajectory::QPath pathPruning (const rw::trajectory::QPath &path) const
 Optimizes using path pruning. More...
 
rw::trajectory::QPath shortCut (const rw::trajectory::QPath &path, size_t cnt, double time, double subDivideLength) const
 Optimizes using the shortcut technique. More...
 
rw::trajectory::QPath shortCut (const rw::trajectory::QPath &path) const
 Optimizes using the shortcut technique. More...
 
rw::trajectory::QPath partialShortCut (const rw::trajectory::QPath &path, size_t cnt, double time, double subDivideLength) const
 Optimizes using the partial shortcut technique. More...
 
rw::trajectory::QPath partialShortCut (const rw::trajectory::QPath &path) const
 Optimizes using the partial shortcut technique. More...
 
rw::common::PropertyMapgetPropertyMap ()
 Returns the propertymap. More...
 

Static Public Attributes

static const std::string PROP_LOOPCOUNT
 Property key for the maximal number of loops.
 
static const std::string PROP_MAXTIME
 Property key for max time.
 
static const std::string PROP_SUBDIVLENGTH
 Property key for length of segment in when subdividing.
 

Detailed Description

The PathLengthOptimizer implements the 3 different path length optimizers presented in [1].

[1]: R. Geraerts and M.H. Overmars, Creating High-Quality Paths for Motion Planning, The International Journal of Robotics Research, Vol. 26, No. 8, 845-863 (2007)

The simplest algorithm pathPruning runs through the path an tests if nodes with index i and i+2 can be directly connected. If so it removed node i+1.

The shortCut algorithm works similary except that it takes two random indices i and j and tries to connect those. This algorithm is non-deterministic but more powerful than pathPruning.

The partialShortCut algorithm select two random node indices i and j and a random position in the configuration vector. A shortcut is then only tried between the values corresponding to the random position. This algorithm is generally more powerful than shortCut but may in some cases be more computational expensive.

Constructor & Destructor Documentation

◆ PathLengthOptimizer()

Constructor.

Path optimization is based on a constraint for edges together with a distance metric to measure whether the path modifications decrease the length of the path.

Parameters
constraint[in] Verification of edges and configurations.
metric[in] Distance metric for edge lengths

Member Function Documentation

◆ getPropertyMap()

rw::common::PropertyMap& getPropertyMap ( )

Returns the propertymap.

Returns
Reference to the property map

◆ partialShortCut() [1/2]

rw::trajectory::QPath partialShortCut ( const rw::trajectory::QPath path,
size_t  cnt,
double  time,
double  subDivideLength 
) const

Optimizes using the partial shortcut technique.

The partialShortCut algorithm select two random node indices i and j and a random position in the configuration vector. A shortcut is then only tried between the values corresponding to the random position.

The algorithm will loop until either the specified cnt is of met or the specified time is reached.

Parameters
path[inout] Path to optimize
cnt[in] Max count to use. If cnt=0, only the time limit will be used
time[in] Max time to use (in seconds). If time=0, only the cnt limit will be used
subDivideLength[in] The length into which the path is subdivided

◆ partialShortCut() [2/2]

rw::trajectory::QPath partialShortCut ( const rw::trajectory::QPath path) const

Optimizes using the partial shortcut technique.

Works similar to partialShortCut(const rw::pathplanning::Path&, size_t, double, double) except that parameters are read from the propertymap.

Parameters
path[inout] Path to optimize
Returns
The optimized path

◆ pathPruning()

rw::trajectory::QPath pathPruning ( const rw::trajectory::QPath path) const

Optimizes using path pruning.

pathPruning runs through the path an tests if nodes with index i and i+2 can be directly connected. If so it removes node i+1.

Parameters
path[in] Path to optimize

◆ shortCut() [1/2]

rw::trajectory::QPath shortCut ( const rw::trajectory::QPath path,
size_t  cnt,
double  time,
double  subDivideLength 
) const

Optimizes using the shortcut technique.

The shortCut algorithm works by selecting two random indices i and j and try to connect those.

The algorithm will loop until either the specified cnt is of met or the specified time is reached.

Parameters
path[inout] Path to optimize
cnt[in] Max count to use. If cnt=0, only the time limit will be used
time[in] Max time to use (in seconds). If time=0, only the cnt limit will be used
subDivideLength[in] The length into which the path is subdivided

◆ shortCut() [2/2]

rw::trajectory::QPath shortCut ( const rw::trajectory::QPath path) const

Optimizes using the shortcut technique.

Works similar to shortCut(const rw::pathplanning::Path&, size_t, double, double) except that parameters are read from the propertymap.

Parameters
path[inout] Path to optimize

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