fix sphere sdf parsing
This commit is contained in:
@@ -346,6 +346,18 @@ bool UrdfParser::parseGeometry(UrdfGeometry& geom, XMLElement* g, ErrorLogger* l
|
|||||||
if (type_name == "sphere")
|
if (type_name == "sphere")
|
||||||
{
|
{
|
||||||
geom.m_type = URDF_GEOM_SPHERE;
|
geom.m_type = URDF_GEOM_SPHERE;
|
||||||
|
if (m_parseSDF)
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
if (!shape->Attribute("radius"))
|
if (!shape->Attribute("radius"))
|
||||||
{
|
{
|
||||||
logger->reportError("Sphere shape must have a radius attribute");
|
logger->reportError("Sphere shape must have a radius attribute");
|
||||||
@@ -356,6 +368,7 @@ bool UrdfParser::parseGeometry(UrdfGeometry& geom, XMLElement* g, ErrorLogger* l
|
|||||||
geom.m_sphereRadius = m_urdfScaling * urdfLexicalCast<double>(shape->Attribute("radius"));
|
geom.m_sphereRadius = m_urdfScaling * urdfLexicalCast<double>(shape->Attribute("radius"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (type_name == "box")
|
else if (type_name == "box")
|
||||||
{
|
{
|
||||||
geom.m_type = URDF_GEOM_BOX;
|
geom.m_type = URDF_GEOM_BOX;
|
||||||
|
|||||||
Reference in New Issue
Block a user