00001 00019 #ifndef URDF2GRASPIT_FILEIO_H 00020 #define URDF2GRASPIT_FILEIO_H 00021 // Copyright Jennifer Buehler 00022 00023 //----------------------------------------------------- 00024 #include <urdf/model.h> 00025 #include <urdf2graspit/ConversionResult.h> 00026 #include <urdf2graspit/OutputStructure.h> 00027 00028 #include <urdf2inventor/FileIO.h> 00029 00030 #include <iostream> 00031 #include <string> 00032 #include <map> 00033 #include <vector> 00034 00035 namespace urdf2graspit 00036 { 00037 00043 class FileIO: public urdf2inventor::FileIO<std::string> 00044 { 00045 private: 00046 typedef urdf2inventor::FileIO<std::string> ParentT; 00047 public: 00048 00049 typedef urdf2graspit::ConversionResult GraspItConversionResultT; 00050 typedef baselib_binding::shared_ptr<GraspItConversionResultT>::type GraspItConversionResultPtr; 00051 00057 explicit FileIO(const std::string& _outputDir, const OutputStructure& _outStructure): 00058 urdf2inventor::FileIO<std::string>(_outputDir), 00059 outStructure(_outStructure) {} 00060 00061 ~FileIO() 00062 { 00063 } 00064 00069 bool writeContacts(const std::string& robotName, const std::string& content, 00070 const std::string& useFilename) const; 00071 00072 protected: 00073 00074 virtual bool initOutputDirImpl(const std::string& robotName) const; 00075 00076 virtual bool writeImpl(const ConversionResultPtr& data) const; 00077 00078 bool writeGraspitMeshFiles(const std::map<std::string, std::string>& meshDescXML) const; 00079 00080 bool writeWorldFileTemplate(const std::string& robotName, 00081 const std::string& content) const; 00082 00083 bool writeEigen(const std::string& robotName, const std::string& content) const; 00084 00085 bool writeRobotXML(const std::string& robotName, const std::string& content) const; 00086 00087 00094 bool initGraspItRobotDir(const std::string& robotName, std::string& robotDir) const; 00095 00096 std::string getRobotDir(const std::string& robotName) const; 00097 00098 OutputStructure outStructure; 00099 }; 00100 } // namespace urdf2graspit 00101 #endif // URDF2GRASPIT_FILEIO_H