KrisLibrary  1.0.0
OptimalMotionPlanner.h
1 #ifndef OPTIMAL_MOTION_PLANNER_H
2 #define OPTIMAL_MOTION_PLANNER_H
3 
4 #include "MotionPlanner.h"
5 #include <KrisLibrary/graph/ShortestPaths.h>
6 
17 {
18  public:
19  PRMStarPlanner(CSpace* space);
21  void Init(const Config& start,const Config& goal);
23  void SetMaxCost(Real cmax);
25  virtual void Cleanup();
27  void PlanMore();
29  void KNN(const Config& x,int k,vector<int>& nn);
31  void Neighbors(const Config& x,Real r,vector<int>& neighbors);
33  bool HasPath() const;
35  bool GetPath(MilestonePath& path);
37  bool GetPath(int a,int b,vector<int>& nodes,MilestonePath& path);
41  Real OptimizePath(int a,const vector<int>& goals,ObjectiveFunctionalBase* cost,MilestonePath& path);
43  bool CheckPath(int a,int b);
45  virtual int AddMilestone(const Config& x);
47  virtual void ConnectEdge(int i,int j,const EdgePlannerPtr& e);
49  void ConnectEdgeLazy(int i,int j,const EdgePlannerPtr& e);
50 
51  //configuration variables
53  bool lazy;
55  bool rrg;
75 
76  int start,goal;
78  ShortestPathProblem spp,sppGoal,sppLB,sppLBGoal;
79  Roadmap LBroadmap;
80 
81  //statistics
82  int numPlanSteps;
83  Real tCheck, tKnn, tConnect, tLazy, tLazyCheck, tShortestPaths;
84  int numEdgeChecks;
85  int numEdgePrechecks;
86 };
87 
88 
89 #endif
virtual void Cleanup()
Erases all internal data structures.
Definition: OptimalMotionPlanner.cpp:125
Real suboptimalityFactor
For suboptimal planning (like LBT-RRT*), default 0.
Definition: OptimalMotionPlanner.h:74
bool lazy
Set lazy to true if you wish to do lazy planning (default false)
Definition: OptimalMotionPlanner.h:53
Real connectionThreshold
Definition: OptimalMotionPlanner.h:70
Vector Config
an alias for Vector
Definition: RobotKinematics3D.h:14
Motion planning configuration space base class. The configuration space implements an interpolation s...
Definition: CSpace.h:39
Real connectRadiusConstant
Constant term gamma in the above expression. Default 1.
Definition: OptimalMotionPlanner.h:63
A sequence of locally planned paths between milestones.
Definition: planning/Path.h:18
void ConnectEdgeLazy(int i, int j, const EdgePlannerPtr &e)
Helper: add an unchecked edge, and update data structures.
Definition: OptimalMotionPlanner.cpp:538
Real lazyCheckThreshold
If lazy planning, check all edges with length greater than this threshold.
Definition: OptimalMotionPlanner.h:72
void Neighbors(const Config &x, Real r, vector< int > &neighbors)
Helper: perform neighbor query limited by radius r.
Definition: OptimalMotionPlanner.cpp:555
bool GetPath(MilestonePath &path)
Helper: get path from start to goal.
Definition: OptimalMotionPlanner.cpp:630
virtual int AddMilestone(const Config &x)
Helper: add a milestone and update data structures.
Definition: OptimalMotionPlanner.cpp:488
Real connectNeighborsConstant
Definition: OptimalMotionPlanner.h:67
bool HasPath() const
Helper: returns true if there exists a feasible path from start to goal.
Definition: OptimalMotionPlanner.cpp:636
A base roadmap planner class.
Definition: MotionPlanner.h:24
void KNN(const Config &x, int k, vector< int > &nn)
Helper: perform K-nearest neighbor query.
Definition: OptimalMotionPlanner.cpp:588
bool rrg
Set rrg to true if you wish to use the RRG* algorithm rather than PRM*.
Definition: OptimalMotionPlanner.h:55
Implements the asymptotically optimal kinematic motion planners PRM*, RRT* / RRG*, Lazy-PRM*, and Lazy-RRG*. Also allows the asymptotically sub-optimal method LBT-RRG*.
Definition: OptimalMotionPlanner.h:16
Real OptimizePath(ObjectiveFunctionalBase *cost, MilestonePath &path)
Helper: get path from start to goal that optimizes some cost function.
Definition: OptimalMotionPlanner.cpp:697
void Init(const Config &start, const Config &goal)
Initialize with a start and goal configuration.
Definition: OptimalMotionPlanner.cpp:138
void SetMaxCost(Real cmax)
Define a maximum path length. Must be called after Init.
Definition: OptimalMotionPlanner.cpp:160
bool CheckPath(int a, int b)
Helper: check feasibility of path from milestone a to b for lazy planning.
Definition: OptimalMotionPlanner.cpp:808
void PlanMore()
Perform one planning step.
Definition: OptimalMotionPlanner.cpp:168
virtual void ConnectEdge(int i, int j, const EdgePlannerPtr &e)
Helper: add a (feasible) edge, and update data structures.
Definition: OptimalMotionPlanner.cpp:516
A base class for objective functionals of the form J[x,u] = sum_0^N-1 L(xi,ui) dt + Phi(xN) ...
Definition: Objective.h:18
bool connectByRadius
Definition: OptimalMotionPlanner.h:61
bool bidirectional
Set this to true for bidirectional planning.
Definition: OptimalMotionPlanner.h:57