Make URDF parser stricter about required attributes.
Following the spec at http://wiki.ros.org/urdf/XML PiperOrigin-RevId: 470192022 Change-Id: I4699b6f87fff5706b3ba5f33bb8242bb2ad33478
This commit is contained in:
committed by
Copybara-Service
parent
9d9493153c
commit
6b6fff69ba
+3
-3
@@ -255,7 +255,7 @@ void mjXURDF::Body(XMLElement* body_elem) {
|
||||
if ((temp = FindSubElem(elem, "material"))) {
|
||||
// if color specified - use directly
|
||||
if ((temp1 = FindSubElem(temp, "color"))) {
|
||||
ReadAttr(temp1, "rgba", 4, rgba, text);
|
||||
ReadAttr(temp1, "rgba", 4, rgba, text, /*required=*/true);
|
||||
}
|
||||
|
||||
// otherwise use material table
|
||||
@@ -332,7 +332,7 @@ void mjXURDF::Joint(XMLElement* joint_elem) {
|
||||
double axis[3] = {1, 0, 0};
|
||||
Origin(joint_elem, pbody->pos, pbody->quat);
|
||||
if ((elem = FindSubElem(joint_elem, "axis"))) {
|
||||
ReadAttr(elem, "xyz", 3, axis, text);
|
||||
ReadAttr(elem, "xyz", 3, axis, text, /*required=*/true);
|
||||
}
|
||||
|
||||
// create joint (unless fixed)
|
||||
@@ -626,7 +626,7 @@ void mjXURDF::MakeMaterials(XMLElement* elem) {
|
||||
if (FindName(name, urMat) < 0) {
|
||||
// add rgba value if available
|
||||
if ((color = FindSubElem(elem, "color"))) {
|
||||
ReadAttr(color, "rgba", 4, rgba.val, text);
|
||||
ReadAttr(color, "rgba", 4, rgba.val, text, /*required=*/true);
|
||||
AddName(name, urMat);
|
||||
urRGBA.push_back(rgba);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user