00001 00002 // 00003 // Title : ObAvData.h 00004 // Project : 00005 // Created : Tue Mar 18 15:10:24 1997 00006 // Author : Troy Harden 00007 // Platforms : All 00008 // Copyright : Copyright© The University of Texas at Austin, 2002. All rights reserved. 00009 // 00010 // This software and documentation constitute an unpublished work 00011 // and contain valuable trade secrets and proprietary information 00012 // belonging to the University. None of the foregoing material may be 00013 // copied or duplicated or disclosed without the express, written 00014 // permission of University. THE UNIVERSITY EXPRESSLY DISCLAIMS ANY 00015 // AND ALL WARRANTIES CONCERNING THIS SOFTWARE AND DOCUMENTATION, 00016 // INCLUDING ANY WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 00017 // PARTICULAR PURPOSE, AND WARRANTIES OF PERFORMANCE, AND ANY WARRANTY 00018 // THAT MIGHT OTHERWISE ARISE FROM COURSE OF DEALING OR USAGE OF TRADE. 00019 // NO WARRANTY IS EITHER EXPRESS OR IMPLIED WITH RESPECT TO THE USE OF 00020 // THE SOFTWARE OR DOCUMENTATION. Under no circumstances shall the 00021 // University be liable for incidental, special, indirect, direct or 00022 // consequential damages or loss of profits, interruption of business, 00023 // or related expenses which may arise from use of software or documentation, 00024 // including but not limited to those resulting from defects in software 00025 // and/or documentation, or loss or inaccuracy of data of any kind. 00026 // Purpose : Read in obstacle avoidance data 00027 // 00028 //---------------------------------------------------------------------------- 00029 // 00030 // $Revisions$ 00031 // 00032 // $Log: ObAvData.hpp,v $ 00033 // Revision 1.26 2005/06/07 23:08:00 aspencer 00034 // Added a virtual update function to ModelingObject. Made all inheriting, implemented Update functions virtual as well. 00035 // 00036 // Revision 1.25 2005/06/03 18:16:06 aspencer 00037 // Removed the "Ob" designation from all primitive names (BoxOb is now Box, etc). Changed "CylOb" to "Cylisphere". 00038 // 00039 // Revision 1.24 2005/06/01 22:27:30 chetan 00040 // Made changes to copyright headers 00041 // 00042 // Revision 1.23 2005/05/26 21:01:55 aspencer 00043 // Changed "obstacle" to "primitive" in both the obstacle and the skeletalobstacle class. Inserted "modeling object" abstract class, which primitive (was obstacle) now inherits from. Updated the rest of OSCAR to reflect this. 00044 // 00045 // Revision 1.22 2005/04/21 16:27:58 aspencer 00046 // Inserted a new "skeletalobstacle" abstract class which inherits from obstacle. Planes, spheres and cylispheres now all inherit from this new class. 00047 // 00048 // Revision 1.21 2005/03/18 16:36:13 chetan 00049 // Removed pragma directive 00050 // 00051 // Revision 1.20 2005/03/14 22:06:22 aspencer 00052 // Added to namespace OSCAR and removed "RR" from front of class names. 00053 // 00054 // Revision 1.19 2004/09/21 22:19:44 jknoll 00055 // Made changes to documentation 00056 // 00057 // Revision 1.18 2004/08/12 15:53:08 eswint 00058 // - Added comments 00059 // 00060 // Revision 1.17 2004/08/10 16:48:37 aspencer 00061 // Disabled warning 4786 to prevent the deluge of warnings when building the ob avoid library. 00062 // 00063 // Revision 1.16 2004/07/23 22:55:51 eswint 00064 // - Compiled with /W4 warning level 4 00065 // 00066 // Revision 1.15 2004/07/07 18:38:37 aspencer 00067 // Made changes in association with eliminating the individual obstacle types and moving all functionality to "obstacle" 00068 // 00069 // Revision 1.14 2004/06/07 15:35:37 eswint 00070 // - Resolved class names with std:: in headers, using namespace std in source files 00071 // 00072 // Revision 1.13 2004/06/04 21:12:20 eswint 00073 // - Replaced ostream with std::ostream 00074 // 00075 // Revision 1.12 2004/06/04 16:23:28 eswint 00076 // - Removed CommDefs.h from ObAvData.hpp 00077 // 00078 // Revision 1.11 2004/05/28 19:20:21 eswint 00079 // - Added the \ingroup Obstacle Avoidance for Doxygen commenting 00080 // 00081 // Revision 1.10 2004/05/25 16:41:17 eswint 00082 // - Corrected commenting 00083 // 00084 // Revision 1.9 2004/05/24 21:26:41 eswint 00085 // - Updated comments 00086 // 00087 // Revision 1.8 2004/05/20 14:06:42 eswint 00088 // - Put all files in the OSCAR namespace 00089 // 00090 // Revision 1.7 2004/05/11 18:56:39 eswint 00091 // - Using namespace ObstacleAvoidance 00092 // - Removed "RR" from class names 00093 // 00094 // Revision 1.6 2004/05/05 22:02:53 eswint 00095 // - Added ToDo list 00096 // 00097 // Revision 1.5 2004/04/29 20:01:37 eswint 00098 // - Finished new file format reader 00099 // - Added output capability 00100 // - Modified arguments involving pointers to arrays of RRFK objects 00101 // 00102 // Revision 1.4 2004/04/28 21:10:32 eswint 00103 // - changed frames from int** to vector<vector<int> > 00104 // - added ostream capability 00105 // 00106 // Revision 1.3 2004/04/27 21:10:22 eswint 00107 // - changed arrays of pointers to STL vectors 00108 // 00109 // Revision 1.2 2004/04/13 21:29:52 eswint 00110 // - Added/Corrected commenting 00111 // 00112 // Revision 1.1 2004/04/13 18:05:34 eswint 00113 // - Changed file extensions to comply with development guidelines 00114 // 00115 // Revision 1.1 2003/08/18 18:37:22 eswint 00116 // Initial Commit 00117 // 00118 // 00120 00121 #ifndef ObAvData_h 00122 #define ObAvData_h 00123 #include "Sphere.hpp" 00124 #include "Cylisphere.hpp" 00125 #include "Plane.hpp" 00126 #include "Box.hpp" 00127 #include "Node.hpp" 00128 #include "FileData/RobotData.h" 00129 #include "ForwardKinematics/FKPosition.h" 00130 #include "Math/MathUtilities.h" 00131 #include <sstream> 00132 #include <vector> 00133 00134 using std::vector; 00135 using std::stringstream; 00136 00137 namespace OSCAR { 00147 class ObAvData : public RobotData { 00148 public: 00161 ObAvData(const String& filename, OSCARError& err, FKPosition** fkBegin = NULL, 00162 FKPosition** fkEnd = NULL, const String& name=String()); 00163 00164 00170 ObAvData(OSCARError& err, const String& name=String()); 00171 00173 virtual ~ObAvData(); 00174 00181 bool UpdateArm(unsigned int index); 00182 00190 bool UpdateArm(unsigned int index, const Vector& jointPos); 00191 00197 bool UpdateAllArms(); 00198 00206 bool UpdateSphere(unsigned int index, Vector3& pt, double rd); 00207 00216 bool UpdateCylinder(unsigned int index, Vector3& pt1, Vector3& pt2, double rd); 00217 00228 bool UpdatePlane(unsigned int index, Vector3& bs, Vector3& pt1, Vector3& pt2, double th=0.0, bool bounded=false); 00229 00240 bool UpdateBox(unsigned int index, Vector3& basePt, Vector3& pt0, Vector3& pt1, double h); 00241 00249 bool UpdateObstacle (SkeletalPrimitive* obstacle, const vector<Vector3>& pts, 00250 double rd); 00251 00256 const vector<vector<Cylisphere> >& GetArms() const; 00257 00262 const vector<Cylisphere>& GetCy() const; 00263 00268 const vector<Sphere>& GetSp() const; 00269 00279 const vector<Plane>& GetPl() const; 00280 00285 const vector<Box>& GetBox() const; 00286 00296 const vector<int>& GetFrames(unsigned int armIndex) const; 00297 00301 int GetArmNum() const; 00302 00306 int GetCyNum() const; 00307 00311 int GetSpNum() const; 00312 00316 int GetPlNum() const; 00317 00321 int GetBoxNum() const; 00322 00326 int GetTot() const; 00327 00334 bool LoadFile(const String& file, FKPosition** fkBegin = NULL, FKPosition** fkEnd = NULL); 00335 00336 virtual void PrintOn(std::ostream& out) const; 00337 00338 bool AddBox(Box& newbox); 00339 00340 private: 00341 00342 bool loadRev1File(std::ifstream& input_file, FKPosition** fkBegin = NULL, FKPosition** fkEnd = NULL); 00343 bool loadRev2File(std::istringstream& fileStream, std::string& buffer, OSCARError& err); 00347 ObAvData(const ObAvData& dd); 00348 00352 ObAvData& operator=(const ObAvData& dd); 00353 00354 00355 00356 //Old version: stores geometric primitives according to type, stores manipulator arms separately, 00357 // only allows cylispheres to model manipulators, maintains a list of FK objects and frame indicies 00358 // to locate objects in the world reference frame. Non-manipulator objects are static. 00359 vector<FKPosition*> fk;//Pointer to array of forward kinematics pointers. 00360 00361 char mark; 00362 00363 int totCyls; //total # cylispheres in all the arms 00364 00365 vector<vector<int> > frames; //frame-1 as determined from DH parameters for each endpt 00366 //of the cylispheres used to model each given arm. 00367 //i.e. if the point is based from frame 1 this var will 00368 //hold a 0. 00369 00370 vector<vector<Vector3> > offsets; //offsets from the given frame measured in that frame 00371 00372 vector<vector<Cylisphere> > arms; //Arm models for robots in the environment 00373 00374 vector<Cylisphere> cy; //Models for cylispherical obstacles not assoc. with an arm 00375 vector<Sphere> sp; //Models for spherical obstacles in the workspace 00376 vector<Plane> pl; //Models for planar obstacles in the workspace 00377 vector<Box> box; //Models for box obstacles in the workspace 00378 00379 //New version: all obstacles are stored in a tree, arms are accessed through the m.v. arms2 00380 // frames and pointers to fk objects are not stored, instead pointers to the transformation 00381 // matricies are stored in each node of the tree, freeing ObAvData from dependence on FK objects. 00382 // and allowing other objects to be able to supply the transformation matricies, locating 00383 // objects in the world reference frame 00384 00385 vector<Node*> enviornment; //pointers to root nodes for the enviornment 00386 vector<Node*> arms2; //pointers to root nodes for the manipulators 00387 }; 00388 00389 #include "ObAvData.ipp" 00390 std::ostream& operator<<(std::ostream &out, const ObAvData& arg); 00391 00392 } //namespace OSCAR 00393 00394 #endif // ObAvData_h
| RRG Homepage | OSCAR Overview | OSCAR Tutorials | Simulations |