summaryrefslogtreecommitdiff
path: root/examples/Importers
diff options
context:
space:
mode:
authorerwincoumans <erwincoumans@google.com>2020-06-05 10:07:27 -0700
committerGitHub <noreply@github.com>2020-06-05 10:07:27 -0700
commitda50438c3c5c43a235839171e35a1e5044d526fd (patch)
tree45ce4f9ffd0b56d4695f014fecb9df8ca0de1e0a /examples/Importers
parentac3dc0eea5298109c3755c45bc497f06f86111f7 (diff)
parent8c0192d639d4437e9c8c2133800b59ff84d065f9 (diff)
downloadbullet3-da50438c3c5c43a235839171e35a1e5044d526fd.tar.gz
Merge pull request #2826 from xhan0619/grav-factor
Deformable gravity factor
Diffstat (limited to 'examples/Importers')
-rw-r--r--examples/Importers/ImportURDFDemo/UrdfParser.cpp11
-rw-r--r--examples/Importers/ImportURDFDemo/UrdfParser.h3
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("")
{
}
};