Fix damper kv inheritance from default classes in XML native reader

Ensured dampers correctly read inherited values from gainprm[2].

PiperOrigin-RevId: 945086959
Change-Id: I10900f3ad057036115da88ad6d649d3d058e7373
This commit is contained in:
Google DeepMind
2026-07-09 06:43:38 -07:00
committed by Copybara-Service
parent ac29b596fb
commit faf0dabc32
2 changed files with 25 additions and 1 deletions
+2 -1
View File
@@ -2561,7 +2561,8 @@ void mjXReader::OneActuator(XMLElement* elem, mjsActuator* actuator) {
// damper
else if (type == "damper") {
double kv = 0;
bool inherited = (actuator->gaintype == mjGAIN_AFFINE);
double kv = inherited ? -actuator->gainprm[2] : 0;
ReadAttr(elem, "kv", 1, &kv, text);
err = mjs_setToDamper(actuator, kv);
}