Allow malformed meshes for visualization purposes. Throw error only if the mesh is required for inertia computation.

PiperOrigin-RevId: 466421062
Change-Id: I947dbc107e481bd8c328b1a6430ab2e88bc82fd6
This commit is contained in:
Alessio Quaglino
2022-08-09 11:40:49 -07:00
committed by Copybara-Service
parent aee73a9023
commit 95d5db3f81
8 changed files with 230 additions and 33 deletions
+1 -1
View File
@@ -2284,7 +2284,7 @@ void mjXReader::Body(XMLElement* section, mjCBody* pbody) {
if (pbody->id==0) {
throw mjXError(elem, "World body cannot have inertia");
}
pbody->explicit_inertial = true;
pbody->explicitinertial = true;
ReadAttr(elem, "pos", 3, pbody->ipos, text, true);
ReadAttr(elem, "quat", 4, pbody->iquat, text);
ReadAttr(elem, "mass", 1, &pbody->mass, text, true);
+1 -1
View File
@@ -1178,7 +1178,7 @@ void mjXWriter::Body(XMLElement* elem, mjCBody* body) {
WriteVector(elem, "user", body->userdata);
// write inertial
if (body->explicit_inertial &&
if (body->explicitinertial &&
model->inertiafromgeom!=mjINERTIAFROMGEOM_TRUE) {
XMLElement* inertial = InsertEnd(elem, "inertial");
WriteAttr(inertial, "pos", 3, body->locipos);
+1 -1
View File
@@ -207,7 +207,7 @@ void mjXURDF::Body(XMLElement* body_elem) {
// inertial element: copy into alternative body frame
if ((elem = FindSubElem(body_elem, "inertial"))) {
pbody->explicit_inertial = true;
pbody->explicitinertial = true;
// origin- relative to joint frame for now
Origin(elem, pbody->ipos, pbody->iquat);