| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #ifndef THIRD_PARTY_MUJOCO_SRC_XML_XML_URDF_ |
| #define THIRD_PARTY_MUJOCO_SRC_XML_XML_URDF_ |
|
|
| #include <map> |
| #include <string> |
| #include <unordered_set> |
| #include <vector> |
|
|
| #include <mujoco/mjmodel.h> |
| #include <mujoco/mjspec.h> |
| #include "xml/xml_base.h" |
| #include "tinyxml2.h" |
|
|
| |
| typedef struct _mjRGBA { |
| float val[4]; |
| } mjRGBA; |
|
|
| |
| class mjXURDF : public mjXBase { |
| public: |
| mjXURDF(); |
| virtual ~mjXURDF(); |
|
|
| |
| void Parse( |
| tinyxml2::XMLElement* root, |
| const std::string& prefix, |
| double* pos, |
| double* quat, |
| bool static_body); |
| void Parse(tinyxml2::XMLElement* root, const mjVFS* vfs = nullptr); |
|
|
| private: |
| std::string GetPrefixedName(const std::string& name); |
| int FindName(std::string name, std::vector<std::string>& list); |
| void AddName(std::string name, std::vector<std::string>& list); |
| void AddBody(std::string name); |
| void AddToTree(int n); |
| void Body(tinyxml2::XMLElement* body_elem); |
| void Joint(tinyxml2::XMLElement* joint_elem); |
| mjsGeom* Geom(tinyxml2::XMLElement* geom_elem, |
| mjsBody* pbody, bool collision); |
| void Origin(tinyxml2::XMLElement* origin_elem, double* pos, double* quat); |
|
|
| void MakeMaterials(tinyxml2::XMLElement* elem); |
| void Clear(void); |
|
|
| |
| std::vector<std::string> urName; |
| std::vector<int> urParent; |
| std::vector<std::vector<int> > urChildren; |
| std::vector<std::string> urMat; |
| std::vector<mjRGBA> urRGBA; |
| std::unordered_set<std::string> urGeomNames; |
| std::map<std::string, std::vector<mjsMesh*>> meshes; |
|
|
| std::string urPrefix; |
| }; |
|
|
| #endif |
|
|