Add XML compiler/saveinertial flag. Fixes #2405

PiperOrigin-RevId: 743607654
Change-Id: I1f2e61be89b79c1995e079f36aa285096f9fb441
This commit is contained in:
Yuval Tassa
2025-04-03 10:11:35 -07:00
committed by Copybara-Service
parent 8941f56e86
commit f96f3e1c22
11 changed files with 47 additions and 10 deletions
+2 -1
View File
@@ -1632,7 +1632,8 @@ void mjXWriter::Body(XMLElement* elem, mjCBody* body, mjCFrame* frame, string_vi
WriteVector(elem, "user", body->get_userdata());
// write inertial
if (body->explicitinertial && model->compiler.inertiafromgeom != mjINERTIAFROMGEOM_TRUE) {
if (model->compiler.saveinertial ||
(body->explicitinertial && model->compiler.inertiafromgeom != mjINERTIAFROMGEOM_TRUE)) {
XMLElement* inertial = InsertEnd(elem, "inertial");
WriteAttr(inertial, "pos", 3, body->ipos);
WriteAttr(inertial, "quat", 4, body->iquat, unitq);