00001 //---------------------------------------------------------------------- 00002 // The Motion Strategy Library (MSL) 00003 //---------------------------------------------------------------------- 00004 // 00005 // Copyright (c) University of Illinois and Steven M. 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 // The University of Illinois 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_FDP_H 00020 #define MSL_FDP_H 00021 00022 #include <queue> 00023 #include <vector> 00024 using namespace std; 00025 00026 00027 #include "marray.h" 00028 #include "planner.h" 00029 #include "tree.h" 00030 #include "vector.h" 00031 #include "defs.h" 00032 #include "mslio.h" 00033 00034 #define UNVISITED 0 00035 #define VISITED 1 // Visited by the first tree, G 00036 #define COLLISION 2 00037 #define VISITED2 3 // Visited by the second tree, G2 00038 #define GOAL 4 // Lies in goal region (not used in base class) 00039 00040 00062 00063 00064 00065 class FDP: public IncrementalPlanner { 00066 protected: 00067 00069 priority_queue<MSLNode*,vector<MSLNode*>,MSLNodeGreater> Q; 00070 00072 MultiArray<int> *Grid; 00073 00075 vector<int> GridDimensions; 00076 00078 int GridDefaultResolution; 00079 00081 MSLVector Quantization; 00082 00083 virtual double SearchCost(double initcost, 00084 MSLNode* &n, 00085 MSLNode* &nn); 00086 00087 virtual vector<int> StateToIndices(const MSLVector &x); 00088 00089 virtual MSLVector IndicesToState(const vector<int> &indices); 00090 00091 public: 00092 00094 FDP(Problem *problem); 00095 00097 ~FDP() {}; 00098 00100 int SatisfiedCount; 00101 00103 virtual void Reset(); 00104 00106 virtual bool Plan(); 00107 00108 }; 00109 00110 00111 00113 class FDPStar: public FDP { 00114 protected: 00115 virtual double SearchCost(double initcost, 00116 MSLNode* &n, 00117 MSLNode* &nn); 00118 public: 00119 FDPStar(Problem *p); 00120 }; 00121 00122 00124 class FDPBestFirst: public FDP { 00125 protected: 00126 virtual double SearchCost(double initcost, 00127 MSLNode* &n, 00128 MSLNode* &nn); 00129 public: 00130 FDPBestFirst(Problem *p); 00131 }; 00132 00133 00135 class FDPBi: public FDP { 00136 protected: 00137 00139 priority_queue<MSLNode*,vector<MSLNode*>,MSLNodeGreater> Q2; 00140 00142 void RecoverSolution(MSLNode* &n1, MSLNode* &n2); 00143 00144 public: 00145 00147 FDPBi(Problem *problem); 00148 00150 ~FDPBi() {}; 00151 00153 virtual void Reset(); 00154 00156 virtual bool Plan(); 00157 }; 00158 00159 00160 #endif 00161 00162