00001 00019 #ifndef URDF2GRASPIT_URDF2GRASPITBASE_H 00020 #define URDF2GRASPIT_URDF2GRASPITBASE_H 00021 // Copyright Jennifer Buehler 00022 00023 //----------------------------------------------------- 00024 #include <urdf/model.h> 00025 00026 #include <iostream> 00027 #include <string> 00028 #include <map> 00029 #include <vector> 00030 00031 #include <Eigen/Core> 00032 #include <Eigen/Geometry> 00033 00034 #include <urdf2inventor/Urdf2Inventor.h> 00035 #include <urdf2graspit/DHParam.h> 00036 #include <urdf2graspit/OutputStructure.h> 00037 00038 // epsilon value to use when comparing whether two axes are the same 00039 // (difference of angle between axes) 00040 #define U2G_EPSILON 1e-07 00041 00042 namespace urdf2graspit 00043 { 00044 00051 class Urdf2GraspItBase: public urdf2inventor::Urdf2Inventor 00052 { 00053 public: 00054 typedef urdf2inventor::Urdf2Inventor::UrdfTraverserPtr UrdfTraverserPtr; 00055 00056 explicit Urdf2GraspItBase(UrdfTraverserPtr& traverser, 00057 float _scaleFactor = 1000): 00058 urdf2inventor::Urdf2Inventor(traverser, _scaleFactor), 00059 outStructure("iv") 00060 { 00061 } 00062 00063 ~Urdf2GraspItBase() 00064 { 00065 } 00066 00072 bool prepareModelForDenavitHartenberg(const std::string& fromLink); 00073 00074 void initOutStructure(const std::string& robotName) 00075 { 00076 outStructure.setRobotName(robotName); 00077 } 00078 00079 OutputStructure getOutStructure() const 00080 { 00081 return outStructure; 00082 } 00083 00084 protected: 00092 bool isDHReady(const std::string& fromLink) const; 00093 00094 // starts URDF viewer to visualize modified URDF, can be used for testing 00095 void testVisualizeURDF(const std::string& fromLink); 00096 00097 private: 00098 00099 OutputStructure outStructure; 00100 00105 std::string dhReadyFrom; 00106 }; 00107 00108 } // namespace urdf2graspit 00109 #endif // URDF2GRASPIT_URDF2GRASPITBASE_H