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
+6 -3
View File
@@ -97,10 +97,10 @@ static void UpdateString(string& psuffix, int count, int i) {
const char* MJCF[nMJCF][mjXATTRNUM] = {
{"mujoco", "!", "1", "model"},
{"<"},
{"compiler", "*", "19", "autolimits", "boundmass", "boundinertia", "settotalmass",
{"compiler", "*", "20", "autolimits", "boundmass", "boundinertia", "settotalmass",
"balanceinertia", "strippath", "coordinate", "angle", "fitaabb", "eulerseq",
"meshdir", "texturedir", "discardvisual", "usethread",
"fusestatic", "inertiafromgeom", "inertiagrouprange", "assetdir", "alignfree"},
"meshdir", "texturedir", "discardvisual", "usethread", "fusestatic", "inertiafromgeom",
"inertiagrouprange", "saveinertial", "assetdir", "alignfree"},
{"<"},
{"lengthrange", "?", "10", "mode", "useexisting", "uselimit",
"accel", "maxforce", "timeconst", "timestep",
@@ -1015,6 +1015,9 @@ void mjXReader::Compiler(XMLElement* section, mjSpec* spec) {
if (MapValue(section, "alignfree", &n, bool_map, 2)) {
spec->compiler.alignfree = (n == 1);
}
if (MapValue(section, "saveinertial", &n, bool_map, 2)) {
spec->compiler.saveinertial = (n == 1);
}
// lengthrange subelement
XMLElement* elem = FindSubElem(section, "lengthrange");