22 while(getline(stream, word,
' '))
39 tinyxml2::XMLDocument doc;
40 doc.LoadFile(filename.
c_str());
45 << doc.ErrorStr() <<
" at line " << doc.ErrorLineNum() <<
std::endl;
50 const tinyxml2::XMLElement* model_xml = doc.FirstChildElement(
"model");
53 s_error <<
"Could not find 'model' element" <<
std::endl;
59 const tinyxml2::XMLElement* shape_xml = model_xml->FirstChildElement();
65 const tinyxml2::XMLElement* xyz_xml = shape_xml->FirstChildElement(
"xyz");
72 const tinyxml2::XMLElement* rpy_xml = shape_xml->FirstChildElement(
"rpy");
76 if (fabs(rpy[0]) > 0.0001 || fabs(rpy[1]) > 0.0001 || fabs(rpy[2]) > 0.0001)
79 rot.
setRPY(rpy[0], rpy[1], rpy[2]);
85 const tinyxml2::XMLElement* size_xml = shape_xml->FirstChildElement(
"size");
90 if (shape_type ==
"box") {
91 const tinyxml2::XMLElement* min_xml = shape_xml->FirstChildElement(
"min");
92 const tinyxml2::XMLElement* max_xml = shape_xml->FirstChildElement(
"max");
94 if (min_xml && max_xml)
99 if (min.size() == 3 && max.size() == 3)
105 else if (!size.empty())
108 shape->addShape(
geo::Box(-v_size / 2, v_size / 2), pose);
112 s_error <<
"In definition '" << filename <<
"': shape '" << shape_type <<
"' has no size property" <<
std::endl;
116 s_error <<
"In definition '" << filename <<
"': Unknown shape type: '" << shape_type <<
"'" <<
std::endl;
119 shape_xml = shape_xml->NextSiblingElement();