Perform autolimit check on actuators
This commit is contained in:
@@ -77,12 +77,17 @@ 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] is not XmlElement
|
||||||
|
compilerElement || compilerElement.GetBoolAttribute("autolimits", 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