Class ClearanceOptimizer


  • public class ClearanceOptimizer
    extends java.lang.Object
    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.
    • Constructor Detail

      • ClearanceOptimizer

        public ClearanceOptimizer​(long cPtr,
                                  boolean cMemoryOwn)
      • ClearanceOptimizer

        public ClearanceOptimizer​(DeviceCPtr device,
                                  State state,
                                  MetricQCPtr metric,
                                  ClearanceCalculatorCPtr clearanceCalculator)
        Constructs clearance optimizer

        The clearance optimizer currently assumes the configuration space of the device is
        rectangular.

        Parameters:
        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
    • Method Detail

      • delete

        public void delete()
      • optimize

        public SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t optimize​(SWIGTYPE_p_rw__trajectory__PathT_rw__math__Q_t path,
                                                                       double stepsize,
                                                                       long 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.

        Parameters:
        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
        Returns:
        The optimized path with node no further than stepsize apart
      • getPROP_LOOPCOUNT

        public static java.lang.String getPROP_LOOPCOUNT()
        Property key for the maximal number of loops. Set LOOPCOUNT=0 to deactivate it
      • getPROP_MAXTIME

        public static java.lang.String getPROP_MAXTIME()
        Property key for max time. Set MAXTIME=0 to deactivate it
      • getPROP_STEPSIZE

        public static java.lang.String getPROP_STEPSIZE()
        Property key for step size
      • getPropertyMap

        public 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

        Returns:
        The PropertyMap
      • getClearanceCalculator

        public ClearanceCalculatorCPtr getClearanceCalculator()
        Returns the ClearanceCalculator associated with the optimizer.

        Returns:
        Const reference to the ClearanceCalculator.
      • setMinimumClearance

        public void setMinimumClearance​(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.

        Parameters:
        dist - [in] Minimum clearance.
      • getMinimumClearance

        public double getMinimumClearance()
        Returns the minimum clearance optimized for.
        Returns:
        The minimum clearance.
      • setStateConstraint

        public void setStateConstraint​(StateConstraintCPtr 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.

        Parameters:
        stateConstraint - [in] the constraint.
      • setQConstraint

        public void setQConstraint​(QConstraintCPtr 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.

        Parameters:
        qConstraint - [in] the constraint.