diff options
Diffstat (limited to 'examples/Importers')
-rw-r--r-- | examples/Importers/ImportURDFDemo/UrdfParser.cpp | 11 | ||||
-rw-r--r-- | examples/Importers/ImportURDFDemo/UrdfParser.h | 3 |
2 files changed, 13 insertions, 1 deletions
diff --git a/examples/Importers/ImportURDFDemo/UrdfParser.cpp b/examples/Importers/ImportURDFDemo/UrdfParser.cpp index a37e610ed..c898fbb65 100644 --- a/examples/Importers/ImportURDFDemo/UrdfParser.cpp +++ b/examples/Importers/ImportURDFDemo/UrdfParser.cpp @@ -1174,6 +1174,17 @@ bool UrdfParser::parseDeformable(UrdfModel& model, tinyxml2::XMLElement* config, } deformable.m_repulsionStiffness = urdfLexicalCast<double>(repulsion_xml->Attribute("value")); } + + XMLElement* grav_xml = config->FirstChildElement("gravity_factor"); + if (grav_xml) + { + if (!grav_xml->Attribute("value")) + { + logger->reportError("gravity_factor element must have value attribute"); + return false; + } + deformable.m_gravFactor = urdfLexicalCast<double>(grav_xml->Attribute("value")); + } XMLElement* spring_xml = config->FirstChildElement("spring"); if (spring_xml) diff --git a/examples/Importers/ImportURDFDemo/UrdfParser.h b/examples/Importers/ImportURDFDemo/UrdfParser.h index 7cd87c49a..b11578113 100644 --- a/examples/Importers/ImportURDFDemo/UrdfParser.h +++ b/examples/Importers/ImportURDFDemo/UrdfParser.h @@ -228,6 +228,7 @@ struct UrdfDeformable double m_collisionMargin; double m_friction; double m_repulsionStiffness; + double m_gravFactor; SpringCoeffcients m_springCoefficients; LameCoefficients m_corotatedCoefficients; @@ -237,7 +238,7 @@ struct UrdfDeformable std::string m_simFileName; btHashMap<btHashString, std::string> m_userData; - UrdfDeformable() : m_mass(1.), m_collisionMargin(0.02), m_friction(1.), m_repulsionStiffness(0.5), m_visualFileName(""), m_simFileName("") + UrdfDeformable() : m_mass(1.), m_collisionMargin(0.02), m_friction(1.), m_repulsionStiffness(0.5), m_gravFactor(1.), m_visualFileName(""), m_simFileName("") { } }; |