parse plane geom for URDF files (not just SDF)

This commit is contained in:
erwincoumans 2018-01-13 13:41:46 -08:00
parent 1b569c0701
commit e961800278

View File

@ -493,30 +493,43 @@ bool UrdfParser::parseGeometry(UrdfGeometry& geom, TiXmlElement* g, ErrorLogger*
} }
else else
{ {
if (this->m_parseSDF) if (type_name == "plane")
{ {
if (type_name == "plane") geom.m_type = URDF_GEOM_PLANE;
{ if (this->m_parseSDF)
geom.m_type = URDF_GEOM_PLANE; {
TiXmlElement *n = shape->FirstChildElement("normal");
TiXmlElement *n = shape->FirstChildElement("normal"); TiXmlElement *s = shape->FirstChildElement("size");
TiXmlElement *s = shape->FirstChildElement("size");
if ((0==n)||(0==s)) if ((0==n)||(0==s))
{ {
logger->reportError("Plane shape must have both normal and size attributes"); logger->reportError("Plane shape must have both normal and size attributes");
return false; return false;
} }
parseVector3(geom.m_planeNormal,n->GetText(),logger); parseVector3(geom.m_planeNormal,n->GetText(),logger);
} } else
} else {
{ if (!shape->Attribute("normal"))
logger->reportError("Unknown geometry type:"); {
logger->reportError(type_name.c_str()); logger->reportError("plane requires a normal attribute");
return false; return false;
} } else
} {
parseVector3(geom.m_planeNormal,shape->Attribute("normal"),logger);
}
}
}
else
{
logger->reportError("Unknown geometry type:");
logger->reportError(type_name.c_str());
return false;
}
}
return true; return true;
} }