mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-14 05:40:05 +00:00
fix sphere sdf parsing
This commit is contained in:
parent
84870739af
commit
707bac9c3d
@ -346,14 +346,27 @@ bool UrdfParser::parseGeometry(UrdfGeometry& geom, XMLElement* g, ErrorLogger* l
|
||||
if (type_name == "sphere")
|
||||
{
|
||||
geom.m_type = URDF_GEOM_SPHERE;
|
||||
if (!shape->Attribute("radius"))
|
||||
if (m_parseSDF)
|
||||
{
|
||||
logger->reportError("Sphere shape must have a radius attribute");
|
||||
return false;
|
||||
XMLElement* size = shape->FirstChildElement("radius");
|
||||
if (0 == size)
|
||||
{
|
||||
logger->reportError("sphere requires a radius child element");
|
||||
return false;
|
||||
}
|
||||
geom.m_sphereRadius = urdfLexicalCast<double>(size->GetText());
|
||||
}
|
||||
else
|
||||
{
|
||||
geom.m_sphereRadius = m_urdfScaling * urdfLexicalCast<double>(shape->Attribute("radius"));
|
||||
if (!shape->Attribute("radius"))
|
||||
{
|
||||
logger->reportError("Sphere shape must have a radius attribute");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
geom.m_sphereRadius = m_urdfScaling * urdfLexicalCast<double>(shape->Attribute("radius"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type_name == "box")
|
||||
|
Loading…
Reference in New Issue
Block a user