00001 //---------------------------------------------------------------------- 00002 // The Motion Strategy Library (MSL) 00003 //---------------------------------------------------------------------- 00004 // 00005 // Copyright (c) 1998-2000 Iowa State University and Steve LaValle. 00006 // All Rights Reserved. 00007 // 00008 // Permission to use, copy, and distribute this software and its 00009 // documentation is hereby granted free of charge, provided that 00010 // (1) it is not a component of a commercial product, and 00011 // (2) this notice appears in all copies of the software and 00012 // related documentation. 00013 // 00014 // Iowa State University and the author make no representations 00015 // about the suitability or fitness of this software for any purpose. 00016 // It is provided "as is" without express or implied warranty. 00017 //---------------------------------------------------------------------- 00018 00019 #ifndef MSL_PLANNER_H 00020 #define MSL_PLANNER_H 00021 00022 #include <list.h> 00023 #include <fstream.h> 00024 00025 #include "solver.h" 00026 #include "random.h" 00027 #include "graph.h" 00028 #include "tree.h" 00029 #include "vector.h" 00030 00031 00033 class Planner: public Solver { 00034 protected: 00035 MSLRandomSource R; 00036 00038 MSLVector RandomState(); 00039 00041 MSLVector NormalState(MSLVector mean, double sd); 00042 00043 public: 00045 double CumulativePlanningTime; 00046 00048 double CumulativeConstructTime; 00049 00051 list<MSLVector> Path; 00052 00054 list<MSLVector> Policy; 00055 00057 MSLVector GapState; 00058 00061 bool Holonomic; 00062 00064 MSLVector GapError; 00065 00068 MSLTree *T; 00069 00071 MSLTree *T2; 00072 00075 MSLGraph *Roadmap; 00076 00078 list<double> TimeList; 00079 00081 list<MSLVector> StateList; 00082 00084 list<MSLVector> InputList; 00085 00087 int NumNodes; 00088 00090 double PlannerDeltaT; 00091 00093 Planner(Problem *problem); 00094 00095 ~Planner(); 00096 00098 void Reset(); 00099 00101 virtual void Construct() = 0; 00102 00104 virtual bool Plan() = 0; 00105 00107 virtual void WriteGraphs(ofstream &fout) = 0; 00108 00110 virtual void ReadGraphs(ifstream &fin) = 0; 00111 00113 bool GapSatisfied(const MSLVector &x1, const MSLVector &x2); 00114 }; 00115 00116 00117 class IncrementalPlanner: public Planner { 00118 public: 00120 IncrementalPlanner(Problem *problem); 00121 00122 ~IncrementalPlanner() {}; 00123 00125 virtual void Construct(); 00126 00128 void RecordSolution(const list<MSLNode*> &glist, 00129 const list<MSLNode*> &g2list); 00130 00131 void RecordSolution(const list<MSLNode*> &glist); 00132 00134 virtual void WriteGraphs(ofstream &fout); 00135 00137 virtual void ReadGraphs(ifstream &fin); 00138 }; 00139 00140 00141 class RoadmapPlanner: public Planner { 00142 public: 00144 RoadmapPlanner(Problem *problem); 00145 00146 ~RoadmapPlanner() {}; 00147 00149 virtual void WriteGraphs(ofstream &fout); 00150 00152 virtual void ReadGraphs(ifstream &fin); 00153 }; 00154 00155 00156 #endif 00157 00158 00159