RobWorkProject
24.12.4-
|
The ClearanceOptimizer implements the C-Retraction algorithms from [1]. More...
#include <ClearanceOptimizer.hpp>
Public Types | |
typedef rw::core::Ptr< ClearanceOptimizer > | Ptr |
smart pointer type to this class | |
typedef rw::core::Ptr< const ClearanceOptimizer > | CPtr |
smart pointer type to this const class | |
Public Member Functions | |
ClearanceOptimizer ()=delete | |
Deleted default constructor. More... | |
ClearanceOptimizer (const rw::core::Ptr< const rw::models::Device > &device, const rw::kinematics::State &state, const rw::math::QMetric::CPtr &metric, const rw::core::Ptr< const ClearanceCalculator > &clearanceCalculator) | |
Constructs clearance optimizer. More... | |
~ClearanceOptimizer () | |
Destructor. | |
rw::trajectory::QPath | optimize (const rw::trajectory::QPath &path, double stepsize, size_t maxcount, double maxtime) |
Runs optimization algorithm. More... | |
rw::trajectory::QPath | optimize (const rw::trajectory::QPath &path) |
Runs optimization algorithm. More... | |
rw::core::PropertyMap & | getPropertyMap () |
Returns the PropertyMap associated with the optimizer. More... | |
const rw::core::Ptr< const ClearanceCalculator > & | getClearanceCalculator () const |
Returns the ClearanceCalculator associated with the optimizer. More... | |
void | setMinimumClearance (const double dist) |
Sets the minimum clearance optimized for. Points on the path with clearance greater than _minClearance are not optimized further. Class default value is 0.1 meters. Value must be equal to or greater than zero. More... | |
double | getMinimumClearance () const |
Returns the minimum clearance optimized for. More... | |
void | setStateConstraint (const rw::core::Ptr< const rw::pathplanning::StateConstraint > &stateConstraint) |
Set a state constraint in the clearance optimizer. More... | |
void | setQConstraint (const rw::core::Ptr< const rw::pathplanning::QConstraint > &qConstraint) |
Set a configuration constraint in the clearance optimizer. More... | |
Static Public Attributes | |
static const std::string | PROP_LOOPCOUNT |
Property key for the maximal number of loops. Set LOOPCOUNT=0 to deactivate it. | |
static const std::string | PROP_MAXTIME |
Property key for max time. Set MAXTIME=0 to deactivate it. | |
static const std::string | PROP_STEPSIZE |
Property key for step size. | |
The ClearanceOptimizer implements the C-Retraction algorithms from [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 algorithms work by first subdividing the path, to give a dense and even distribution of nodes along the path. Nodes are then tried moved in a random direction to improve the clearance. After having iterated through the entire path some nodes will be moved, thus a validation step is used to insert extra nodes where the density is not high enough. This is then followed by a method for removing undesired branches.
|
delete |
Deleted default constructor.
ClearanceOptimizer | ( | const rw::core::Ptr< const rw::models::Device > & | device, |
const rw::kinematics::State & | state, | ||
const rw::math::QMetric::CPtr & | metric, | ||
const rw::core::Ptr< const ClearanceCalculator > & | clearanceCalculator | ||
) |
Constructs clearance optimizer.
The clearance optimizer currently assumes the configuration space of the device is rectangular.
device | [in] Device to plan for |
state | [in] State containing position of all other devices and how frames are assembled. |
metric | [in] Metric to use for computing distance betweem configurations |
clearanceCalculator | [in] Calculator for calculating the clearance |
const rw::core::Ptr<const ClearanceCalculator>& getClearanceCalculator | ( | ) | const |
Returns the ClearanceCalculator associated with the optimizer.
double getMinimumClearance | ( | ) | const |
Returns the minimum clearance optimized for.
rw::core::PropertyMap& getPropertyMap | ( | ) |
Returns the PropertyMap associated with the optimizer.
The PropertyMap defines the following parameters used by the optimizer:
Property Name | Type | Default value |
---|---|---|
ClearanceOptimizer::PROP_LOOPCOUNT | int | 20 |
ClearanceOptimizer::PROP_MAXTIME | double | 200 |
ClearanceOptimizer::PROP_STEPSIZE | double | 0.1 |
rw::trajectory::QPath optimize | ( | const rw::trajectory::QPath & | path | ) |
Runs optimization algorithm.
Runs the optimization algorithm using the parameters specified in the property map
path | [in] Path to optimize |
rw::trajectory::QPath optimize | ( | const rw::trajectory::QPath & | path, |
double | stepsize, | ||
size_t | maxcount, | ||
double | maxtime | ||
) |
Runs optimization algorithm.
Calling this method runs the path optimization algorithm. This call blocks until the optimized path is ready. This may take quite a while, depending on the maxcount specified and the amount of geometry in the scene.
path | [in] Path to optimize |
stepsize | [in] Maximum size between configurations in the dense path |
maxcount | [in] Number of time to attempt optimizing the path using the random direction. If maxcount=0 only the maxtime will be used. |
maxtime | [in] The maximal time allowed to optimize. If maxtime<=0 only the maxcount will be used |
void setMinimumClearance | ( | const double | dist | ) |
Sets the minimum clearance optimized for. Points on the path with clearance greater than _minClearance are not optimized further. Class default value is 0.1 meters. Value must be equal to or greater than zero.
dist | [in] Minimum clearance. |
void setQConstraint | ( | const rw::core::Ptr< const rw::pathplanning::QConstraint > & | qConstraint | ) |
Set a configuration constraint in the clearance optimizer.
The optimizer will not generate a path with configurations that is in collision according to the constraint.
qConstraint | [in] the constraint. |
void setStateConstraint | ( | const rw::core::Ptr< const rw::pathplanning::StateConstraint > & | stateConstraint | ) |
Set a state constraint in the clearance optimizer.
The optimizer will not generate a path with configurations that is in collision according to the state constraint.
stateConstraint | [in] the constraint. |