Skip to content

Commit

Permalink
add a check, error meesage, and correction for 0 scale in box shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
aclegg3 authored and jturner65 committed Sep 18, 2024
1 parent 3bb430f commit ba164f0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/esp/metadata/URDFParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,16 @@ bool Parser::parseGeometry(Geometry& geom, const XMLElement* g) {
return false;
} else {
parseVector3(geom.m_boxSize, shape->Attribute("size"));
if (geom.m_boxSize.min() == 0) {
ESP_ERROR() << "Collision box primitive with 0 scale detected "
<< geom.m_boxSize
<< ". Replacing zeros with 0.001 and continuing.";
for (int i = 0; i < 3; ++i) {
if (geom.m_boxSize[i] == 0) {
geom.m_boxSize[i] = 0.001;
}
}
}
}
} else if (type_name == "cylinder") {
geom.m_type = GEOM_CYLINDER;
Expand Down

0 comments on commit ba164f0

Please sign in to comment.