Esempio n. 1
0
    def __init__(self, space, type=None, **options):
        """Initializes a plan with a given CSpace and a given type.
        Optionally, planner options can be set via keyword arguments.
        
        Valid values for type are:

            * 'prm': the Probabilistic Roadmap algorithm
            * 'rrt': the Rapidly Exploring Random Trees algorithm
            * 'sbl': the Single-Query Bidirectional Lazy planner
            * 'sblprt': the probabilistic roadmap of trees (PRT) algorithm with SBL as the inter-root planner.
            * 'rrt*': the RRT* algorithm for optimal motion planning 
            * 'prm*': the PRM* algorithm for optimal motion planning
            * 'lazyprm*': the Lazy-PRM* algorithm for optimal motion planning
            * 'lazyrrg*': the Lazy-RRG* algorithm for optimal motion planning
            * 'fmm': the fast marching method algorithm for resolution-complete optimal motion planning
            * 'fmm*': an anytime fast marching method algorithm for optimal motion planning

        (this list may be out-of-date; the most current documentation
        is listed in src/motionplanning.h)
        """
        if space.cspace is None:
            space.setup()
        if type != None:
            motionplanning.setPlanType(type)
        if len(options) > 0:
            MotionPlan.setOptions(**options)
        self.space = space
        self.planOptions = motionplanning.getPlanJSONString()
        self.planner = motionplanning.PlannerInterface(space.cspace)
        self.edgeCost = None
        self.terminalCost = None
Esempio n. 2
0
 def __init__(self,space,type=None,**options):
     """Initializes a plan with a given CSpace and a given type.
     Optionally, planner options can be set via keyword arguments.
     
     Valid values for type are:
         - prm: the Probabilistic Roadmap algorithm
         - rrt: the Rapidly Exploring Random Trees algorithm
         - sbl: the Single-Query Bidirectional Lazy planner
         - sblprt: the probabilistic roadmap of trees (PRT) algorithm with SBL as the inter-root planner.
         - rrt*: the RRT* algorithm for optimal motion planning 
         - prm*: the PRM* algorithm for optimal motion planning
         - lazyprm*: the Lazy-PRM* algorithm for optimal motion planning
         - lazyrrg*: the Lazy-RRG* algorithm for optimal motion planning
         - fmm: the fast marching method algorithm for resolution-complete optimal motion planning
         - fmm*: an anytime fast marching method algorithm for optimal motion planning
     (this list may be out-of-date; the most current documentation
     is listed in src/motionplanning.h)
     """
     if space.cspace == None:
         space.setup()
     if type != None:
         motionplanning.setPlanType(type)
     if len(options) > 0:
         MotionPlan.setOptions(**options)
     self.planner = motionplanning.PlannerInterface(space.cspace)
Esempio n. 3
0
 def __init__(self, space, type=None):
     """Initializes a plan with a given CSpace and a given type.
     Type can be 'prm', 'rrt', 'sbl'.
     """
     if space.cspace == None:
         space.setup()
     if type != None:
         motionplanning.setPlanType(type)
     self.planner = motionplanning.PlannerInterface(space.cspace)
Esempio n. 4
0
    def setOptions(**opts):
        """Sets a numeric or string-valued setting for the next constructed
        planner.  Arguments are specified by key-value pair.
        
        Valid keys are:

            * "knn": k value for the k-nearest neighbor connection strategy
              (used in PRM)
            * "connectionThreshold": a milestone connection threshold
            * "perturbationRadius": (for RRT and SBL)
            * "bidirectional": 1 if bidirectional planning is requested (used
              in RRT)
            * "grid": 1 if a point selection grid should be used (used in SBL)
            * "gridResolution": resolution for the grid, if the grid should
              be used (used in SBL with grid, FMM, FMM*)
            * "suboptimalityFactor": allowable suboptimality (used in RRT*,
              lazy PRM*, lazy RRG*)
            * "randomizeFrequency": a grid randomization frequency (for SBL)
            * "shortcut": nonzero if you wish to perform shortcutting to
              improve a path after a first plan is found.
            * "restart": nonzero if you wish to restart the planner to
              get progressively better paths with the remaining time.
            * "pointLocation": a string designating a point location data
              structure. "kdtree" is supported, optionally followed by a
              weight vector (used in PRM, RRT, RRT*, PRM*, LazyPRM*, LazyRRG*)
            * "restartTermCond": used if the "restart" setting is true.
              This is a JSON string defining the termination condition
              (default value: "{foundSolution:1;maxIters:1000}")

        (this list may be out-of-date; the most current documentation
        is listed in Klampt/Python/klampt/src/motionplanning.h)

        An exception may be thrown if an invalid setting is chosen.
        """
        for (a, b) in opts.items():
            if a == 'type':
                motionplanning.setPlanType(str(b))
            elif isinstance(b, str):
                motionplanning.setPlanSetting(a, b)
            else:
                motionplanning.setPlanSetting(a, float(b))
Esempio n. 5
0
    def setOptions(**opts):
        """Sets a numeric or string-valued setting for the next constructed
        planner.  Arguments are specified by key-value pair.
        
        Valid keys are:

            * "knn": k value for the k-nearest neighbor connection strategy
              (used in PRM)
            * "connectionThreshold": a milestone connection threshold
            * "perturbationRadius": (for RRT and SBL)
            * "bidirectional": 1 if bidirectional planning is requested (used
              in RRT)
            * "grid": 1 if a point selection grid should be used (used in SBL)
            * "gridResolution": resolution for the grid, if the grid should
              be used (used in SBL with grid, FMM, FMM*)
            * "suboptimalityFactor": allowable suboptimality (used in RRT*,
              lazy PRM*, lazy RRG*)
            * "randomizeFrequency": a grid randomization frequency (for SBL)
            * "shortcut": nonzero if you wish to perform shortcutting to
              improve a path after a first plan is found.
            * "restart": nonzero if you wish to restart the planner to
              get progressively better paths with the remaining time.
            * "pointLocation": a string designating a point location data
              structure. "kdtree" is supported, optionally followed by a
              weight vector (used in PRM, RRT*, PRM*, LazyPRM*, LazyRRG*)
            * "restartTermCond": used if the "restart" setting is true.
              This is a JSON string defining the termination condition
              (default value: "{foundSolution:1;maxIters:1000}")

        (this list may be out-of-date; the most current documentation
        is listed in Klampt/Python/klampt/src/motionplanning.h)

        An exception may be thrown if an invalid setting is chosen.
        """
        for (a,b) in opts.items():
            if a=='type':
                motionplanning.setPlanType(str(b))
            elif isinstance(b,str):
                motionplanning.setPlanSetting(a,b)
            else:
                motionplanning.setPlanSetting(a,float(b))
Esempio n. 6
0
 def __init__(self, space, type=None):
     """Initializes a plan with a given CSpace and a given type.
     
     Valid values for type are:
         - prm: the Probabilistic Roadmap algorithm
         - rrt: the Rapidly Exploring Random Trees algorithm
         - sbl: the Single-Query Bidirectional Lazy planner
         - sblprt: the probabilistic roadmap of trees (PRT) algorithm with SBL as the inter-root planner.
         - rrt*: the RRT* algorithm for optimal motion planning 
         - prm*: the PRM* algorithm for optimal motion planning
         - lazyprm*: the Lazy-PRM* algorithm for optimal motion planning
         - lazyrrg*: the Lazy-RRG* algorithm for optimal motion planning
         - fmm: the fast marching method algorithm for resolution-complete optimal motion planning
         - fmm*: an anytime fast marching method algorithm for optimal motion planning
     (this list may be out-of-date; the most current documentation
     is listed in motionplanning.h)
     """
     if space.cspace == None:
         space.setup()
     if type != None:
         motionplanning.setPlanType(type)
     self.planner = motionplanning.PlannerInterface(space.cspace)
Esempio n. 7
0
 def setOptions(**opts):
     for (a, b) in opts.items():
         if a == "type":
             motionplanning.setPlanType(str(b))
         else:
             motionplanning.setPlanSetting(a, float(b))