Don't save actdim="{0,1}" for state{less,ful} actuators, respectively.
actdim has a default value of -1 (==unset), which means it currently gets saved for all actuators. After this change, it will only be saved if the value is > 1, errors are thrown for stateful actuators with actdim=0 and stateless actuators with actdim>0. PiperOrigin-RevId: 520627313 Change-Id: Ia498dae5c7314cfaa0995f8077d297c2339a5c35
This commit is contained in:
committed by
Copybara-Service
parent
0becf8fd98
commit
c65e046043
@@ -640,7 +640,13 @@ void mjXWriter::OneActuator(XMLElement* elem, mjCActuator* pact, mjCDef* def) {
|
||||
|
||||
// non-plugins: write actuator parameters
|
||||
else {
|
||||
WriteAttrInt(elem, "actdim", pact->actdim, def->actuator.actdim);
|
||||
// special handling of actdim which has default value of -1
|
||||
if (writingdefaults) {
|
||||
WriteAttrInt(elem, "actdim", pact->actdim, def->actuator.actdim);
|
||||
} else {
|
||||
int default_actdim = pact->dyntype == mjDYN_NONE ? 0 : 1;
|
||||
WriteAttrInt(elem, "actdim", pact->actdim, default_actdim);
|
||||
}
|
||||
WriteAttrKey(elem, "dyntype", dyn_map, dyn_sz, pact->dyntype, def->actuator.dyntype);
|
||||
WriteAttrKey(elem, "gaintype", gain_map, gain_sz, pact->gaintype, def->actuator.gaintype);
|
||||
WriteAttrKey(elem, "biastype", bias_map, bias_sz, pact->biastype, def->actuator.biastype);
|
||||
|
||||
Reference in New Issue
Block a user