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_GEOMPQP_H 00020 #define MSL_GEOMPQP_H 00021 00022 #include <list> 00023 #include <vector> 00024 00025 #include "../../configs/configPQP.h" 00026 00027 #include <cstdlib> 00028 #include <cstdio> 00029 00030 #include <string.h> 00031 00032 #include "defs.h" 00033 #include "geom.h" 00034 #include "point.h" // This includes the MSLPolygon class 00035 #include "triangle.h" 00036 00037 // OK, this is bad. The maximum number should be dynamic, but PQP 00038 // really seems to want a static matrix. 00039 #define MAXBODIES 100 00040 00042 00043 class GeomPQP: public Geom { 00044 protected: 00045 PQP_REAL RR[3][3],RO[3][3]; 00046 PQP_REAL TR[3],TO[3]; 00047 public: 00048 list<MSLTriangle> Obst; 00049 list<MSLTriangle> Robot; 00050 PQP_Model Ro, Ob; 00051 GeomPQP(string path); 00052 virtual ~GeomPQP() {}; 00053 virtual void LoadEnvironment(string path); 00054 virtual void LoadRobot(string path); 00055 virtual bool CollisionFree(const MSLVector &q){return true;} 00056 virtual double DistanceComp(const MSLVector &q){return 10000.0;} 00057 }; 00058 00060 00061 class GeomPQP2D: public GeomPQP { 00062 public: 00063 list<MSLPolygon> ObstPolygons; 00064 list<MSLPolygon> RobotPolygons; 00065 GeomPQP2D(string path); 00066 virtual ~GeomPQP2D() {}; 00067 virtual void LoadEnvironment(string path); 00068 virtual void LoadRobot(string path); 00069 }; 00070 00071 00073 00074 class GeomPQP2DRigid: public GeomPQP2D { 00075 public: 00076 GeomPQP2DRigid(string path); 00077 virtual ~GeomPQP2DRigid() {}; 00078 virtual bool CollisionFree(const MSLVector &q); // Input is configuration 00079 virtual double DistanceComp(const MSLVector &q); // Distance in world 00080 virtual MSLVector ConfigurationDifference(const MSLVector &q1, 00081 const MSLVector &q2); 00082 void SetTransformation(const MSLVector &q); // Input is configuration 00083 }; 00084 00085 00087 class GeomPQP2DRigidMulti: public GeomPQP2DRigid { 00088 private: 00089 vector<list<MSLTriangle> > Robot; 00090 vector<PQP_Model> Ro; 00091 list<MSLVector> CollisionPairs; // Index pairs to check for collision 00092 PQP_REAL TR[MAXBODIES][3]; // Robot translation 00093 PQP_REAL RR[MAXBODIES][3][3]; // Robot rotation 00094 public: 00095 bool SelfCollisionCheck; 00096 GeomPQP2DRigidMulti(string path); 00097 virtual ~GeomPQP2DRigidMulti() {}; 00098 virtual bool CollisionFree(const MSLVector &q); // Input is configuration 00099 virtual double DistanceComp(const MSLVector &q); // Distance in world 00100 virtual void LoadRobot(string path); // Load multiple robots 00101 void SetTransformation(const MSLVector &q); // Input is configuration 00102 }; 00103 00104 00106 class GeomPQP3DRigid: public GeomPQP { 00107 public: 00108 GeomPQP3DRigid(string path); 00109 virtual ~GeomPQP3DRigid() {}; 00110 virtual bool CollisionFree(const MSLVector &q); // Input is configuration 00111 virtual double DistanceComp(const MSLVector &q); // Distance in world 00112 virtual MSLVector ConfigurationDifference(const MSLVector &q1, 00113 const MSLVector &q2); 00114 void SetTransformation(const MSLVector &q); // Input is configuration 00115 }; 00116 00117 00119 class GeomPQP3DRigidMulti: public GeomPQP3DRigid { 00120 private: 00121 vector<list<MSLTriangle> > Robot; 00122 vector<PQP_Model> Ro; 00123 list<MSLVector> CollisionPairs; // Index pairs to check for collision 00124 PQP_REAL TR[MAXBODIES][3]; // Robot translation 00125 PQP_REAL RR[MAXBODIES][3][3]; // Robot rotation 00126 public: 00127 bool SelfCollisionCheck; 00128 GeomPQP3DRigidMulti(string path); 00129 virtual ~GeomPQP3DRigidMulti() {}; 00130 virtual bool CollisionFree(const MSLVector &q); // Input is configuration 00131 virtual double DistanceComp(const MSLVector &q); // Distance in world 00132 virtual void LoadRobot(string path); // Load multiple robots 00133 void SetTransformation(const MSLVector &q); // Input is configuration 00134 }; 00135 00136 #endif 00137 00138 00139