Merge pull request #1330 from Balint-H:fix/unity-joint-limits
PiperOrigin-RevId: 598603093 Change-Id: I441631e33e812988694f8eed48c719c6bab86148
This commit is contained in:
@@ -164,7 +164,15 @@ namespace Mujoco {
|
|||||||
RefFriction.FromMjcf(mjcf, "solreffriction");
|
RefFriction.FromMjcf(mjcf, "solreffriction");
|
||||||
ImpFriction.FromMjcf(mjcf, "solimpfriction");
|
ImpFriction.FromMjcf(mjcf, "solimpfriction");
|
||||||
FrictionLoss = mjcf.GetFloatAttribute("frictionloss", 0.0f);
|
FrictionLoss = mjcf.GetFloatAttribute("frictionloss", 0.0f);
|
||||||
Limited = mjcf.GetBoolAttribute("limited", false);
|
|
||||||
|
bool defaultLimited = false;
|
||||||
|
if ((mjcf.OwnerDocument.GetElementsByTagName("compiler") [0]["compiler"])
|
||||||
|
?.GetBoolAttribute("autolimits", true) ??
|
||||||
|
true) {
|
||||||
|
defaultLimited = mjcf.HasAttribute("range");
|
||||||
|
}
|
||||||
|
|
||||||
|
Limited = mjcf.GetBoolAttribute("limited", defaultLimited);
|
||||||
Margin = mjcf.GetFloatAttribute("margin", defaultValue: 0.0f);
|
Margin = mjcf.GetFloatAttribute("margin", defaultValue: 0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,12 +77,18 @@ public class MjActuator : MjComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void FromMjcf(XmlElement mjcf) {
|
public void FromMjcf(XmlElement mjcf) {
|
||||||
CtrlLimited = mjcf.GetBoolAttribute("ctrllimited", defaultValue: false);
|
|
||||||
ForceLimited = mjcf.GetBoolAttribute("forcelimited", defaultValue: false);
|
|
||||||
CtrlRange = mjcf.GetVector2Attribute("ctrlrange", defaultValue: Vector2.zero);
|
CtrlRange = mjcf.GetVector2Attribute("ctrlrange", defaultValue: Vector2.zero);
|
||||||
ForceRange = mjcf.GetVector2Attribute("forcerange", defaultValue: Vector2.zero);
|
ForceRange = mjcf.GetVector2Attribute("forcerange", defaultValue: Vector2.zero);
|
||||||
LengthRange = mjcf.GetVector2Attribute("lengthrange", defaultValue: Vector2.zero);
|
LengthRange = mjcf.GetVector2Attribute("lengthrange", defaultValue: Vector2.zero);
|
||||||
Gear = mjcf.GetFloatArrayAttribute("gear", defaultValue: new float[] { 1.0f }).ToList();
|
Gear = mjcf.GetFloatArrayAttribute("gear", defaultValue: new float[] { 1.0f }).ToList();
|
||||||
|
|
||||||
|
bool autolimits = (mjcf.OwnerDocument.GetElementsByTagName("compiler")[0]["compiler"])
|
||||||
|
?.GetBoolAttribute("autolimits", true) ??
|
||||||
|
true;
|
||||||
|
CtrlLimited = mjcf.GetBoolAttribute("ctrllimited",
|
||||||
|
defaultValue: autolimits ? CtrlRange != Vector2.zero : false);
|
||||||
|
ForceLimited = mjcf.GetBoolAttribute("forcelimited",
|
||||||
|
defaultValue: autolimits ? ForceRange != Vector2.zero : false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user