RobWorkProject
24.12.4-
|
The PathLengthOptimizer implements the 3 different path length optimizers presented in [1]. More...
#include <PathLengthOptimizer.hpp>
Public Types | |
typedef rw::core::Ptr< PathLengthOptimizer > | Ptr |
smart pointer type to this class | |
typedef rw::core::Ptr< const PathLengthOptimizer > | CPtr |
smart pointer type to this const class | |
typedef std::list< rw::math::Q > | QList |
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::core::PropertyMap & | getPropertyMap () |
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. | |
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.
PathLengthOptimizer | ( | const rw::pathplanning::PlannerConstraint & | constraint, |
rw::math::QMetric::CPtr | metric | ||
) |
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.
constraint | [in] Verification of edges and configurations. |
metric | [in] Distance metric for edge lengths |
rw::core::PropertyMap& getPropertyMap | ( | ) |
Returns the propertymap.
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.
path | [inout] Path to optimize |
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.
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 |
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.
path | [in] Path to optimize |
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.
path | [inout] Path to optimize |
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.
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 |