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_PROBLEM_H 00020 #define MSL_PROBLEM_H 00021 00022 #include <LEDA/file.h> 00023 #include <LEDA/array.h> 00024 #include <LEDA/list.h> 00025 #include <LEDA/matrix.h> 00026 #include <LEDA/point.h> 00027 #include <LEDA/polygon.h> 00028 #include <LEDA/stream.h> 00029 #include <LEDA/string.h> 00030 #include <LEDA/vector.h> 00031 00032 #include "model.h" 00033 #include "geom.h" 00034 00035 #include <LEDA/REDEFINE_NAMES.h> 00036 00038 00047 class Problem { 00048 protected: 00050 Geom *G; 00052 Model *M; 00053 public: 00055 string FilePath; 00056 00058 int NumBodies; 00059 00061 int StateDim; 00062 00064 int InputDim; 00065 00067 int GeomDim; 00068 00070 vector LowerState; 00071 00073 vector UpperState; 00074 00076 vector InitialState; 00077 00079 vector GoalState; 00080 00083 Problem(Geom *geom, Model *model, string path); 00084 00086 virtual ~Problem() {}; 00087 00089 void SetGeom(Geom *geom); 00090 00092 void SetModel(Model *model); 00093 00095 void ReadInitialState(); 00096 00098 void ReadGoalState(); 00099 00101 virtual list<vector> GetInputs(const vector &x); 00102 00104 virtual list<vector> GetInputs(); 00105 00107 virtual vector Integrate(const vector &x, const vector &u, 00108 const double &deltat); 00109 00111 00115 virtual vector InterpolateState(const vector &x1, const vector &x2, 00116 const double &a); // Depends on topology 00117 00119 virtual double Metric(const vector &x1, const vector &x2); 00120 00122 virtual vector StateToConfiguration(const vector &x); 00123 00125 virtual point StateToLedaPoint(const vector &x); 00126 00130 virtual vector StateDifference(const vector &x1, 00131 const vector &x2); 00132 00135 virtual bool Satisfied(const vector &x); 00136 00138 virtual bool CollisionFree(const vector &q); 00139 00141 virtual double DistanceComp(const vector &q); 00142 00144 virtual list<polygon> EnvironmentToLedaPolygons(); 00145 00147 virtual list<polygon> RobotToLedaPolygons(const vector &q); 00148 00150 vector MaxDeviates; 00151 00155 virtual vector ConfigurationDifference(const vector &q1, 00156 const vector &q2); 00157 }; 00158 00159 #include <LEDA/UNDEFINE_NAMES.h> 00160 00161 #endif