From a276c49c3066dffdd2a7eae8a5c1c64ca5199191 Mon Sep 17 00:00:00 2001 From: Yuval Tassa Date: Mon, 14 Aug 2023 07:18:03 -0700 Subject: [PATCH] Rename ``actuatorforcerange`` and ``actuatorforcelimited``, to ``actuatorfrcrange`` and ``actuatorfrclimited``, respectively. PiperOrigin-RevId: 556780590 Change-Id: Ide12cf390920f9efe6f79cc9f864a480ce5f256d --- doc/XMLreference.rst | 18 +++++++++--------- doc/XMLschema.rst | 8 ++++---- doc/changelog.rst | 5 ++++- doc/modeling.rst | 2 +- model/car/car.xml | 2 +- src/xml/xml_native_reader.cc | 12 ++++++------ src/xml/xml_native_writer.cc | 4 ++-- .../testdata/actuation/joint_force_clamp.xml | 2 +- test/engine/testdata/actuation/refsite.xml | 2 +- 9 files changed, 29 insertions(+), 26 deletions(-) diff --git a/doc/XMLreference.rst b/doc/XMLreference.rst index 0d6f49b4..d37c1dc8 100644 --- a/doc/XMLreference.rst +++ b/doc/XMLreference.rst @@ -2339,14 +2339,14 @@ unit quaternions. attribute is "auto", and :at:`autolimits` is set in :ref:`compiler `, joint limits will be enabled if range is defined. -.. _body-joint-actuatorforcelimited: +.. _body-joint-actuatorfrclimited: -:at:`actuatorforcelimited`: :at-val:`[false, true, auto], "auto"` +:at:`actuatorfrclimited`: :at-val:`[false, true, auto], "auto"` This attribute specifies whether actuator forces acting on the joint should be clamped. See :ref:`CForceRange` for details. It is available only for scalar joints (hinge and slider) and ignored for ball and free joints. |br| This - attribute interacts with the actuatorforcerange attribute below. If this attribute is "false", actuator force + attribute interacts with the actuatorfrcrange attribute below. If this attribute is "false", actuator force clamping is disabled. If it is "true", actuator force clamping is enabled. If this attribute is "auto", and - :at:`autolimits` is set in :ref:`compiler `, actuator force clamping will be enabled if actuatorforcerange + :at:`autolimits` is set in :ref:`compiler `, actuator force clamping will be enabled if actuatorfrcrange is defined. .. _body-joint-solreflimit: @@ -2380,12 +2380,12 @@ unit quaternions. |br| Setting this attribute without specifying :at:`limited` is an error, unless :at:`autolimits` is set in :ref:`compiler `. -.. _body-joint-actuatorforcerange: +.. _body-joint-actuatorfrcrange: -:at:`actuatorforcerange`: :at-val:`real(2), "0 0"` +:at:`actuatorfrcrange`: :at-val:`real(2), "0 0"` Range for clamping total actuator forces acting on this joint. See :ref:`CForceRange` for details. It is available only for scalar joints (hinge and slider) and ignored for ball and free joints. |br| The compiler expects the first - value to be smaller than the second value. |br| Setting this attribute without specifying :at:`actuatorforcelimited` + value to be smaller than the second value. |br| Setting this attribute without specifying :at:`actuatorfrclimited` is an error, unless :at:`compiler-autolimits` is set. .. _body-joint-margin: @@ -6417,7 +6417,7 @@ if omitted. .. _default-joint-limited: -.. _default-joint-actuatorforcelimited: +.. _default-joint-actuatorfrclimited: .. _default-joint-solreflimit: @@ -6431,7 +6431,7 @@ if omitted. .. _default-joint-range: -.. _default-joint-actuatorforcerange: +.. _default-joint-actuatorfrcrange: .. _default-joint-margin: diff --git a/doc/XMLschema.rst b/doc/XMLschema.rst index 90756f6c..bb6463cf 100644 --- a/doc/XMLschema.rst +++ b/doc/XMLschema.rst @@ -274,9 +274,9 @@ | | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ | | | | | :ref:`pos` | :ref:`axis` | :ref:`springdamper` | :ref:`limited` | | | | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ | -| | | | :ref:`actuatorforcelimited` | :ref:`solreflimit` | :ref:`solimplimit` | :ref:`solreffriction` | | +| | | | :ref:`actuatorfrclimited` | :ref:`solreflimit` | :ref:`solimplimit` | :ref:`solreffriction` | | | | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ | -| | | | :ref:`solimpfriction` | :ref:`stiffness` | :ref:`range` | :ref:`actuatorforcerange` | | +| | | | :ref:`solimpfriction` | :ref:`stiffness` | :ref:`range` | :ref:`actuatorfrcrange` | | | | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ | | | | | :ref:`margin` | :ref:`ref` | :ref:`springref` | :ref:`armature` | | | | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ | @@ -1138,11 +1138,11 @@ | | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ | | | | | :ref:`type` | :ref:`group` | :ref:`pos` | :ref:`axis` | | | | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ | -| | | | :ref:`springdamper` | :ref:`limited` | :ref:`actuatorforcelimited` | :ref:`solreflimit` | | +| | | | :ref:`springdamper` | :ref:`limited` | :ref:`actuatorfrclimited` | :ref:`solreflimit` | | | | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ | | | | | :ref:`solimplimit` | :ref:`solreffriction` | :ref:`solimpfriction` | :ref:`stiffness` | | | | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ | -| | | | :ref:`range` | :ref:`actuatorforcerange` | :ref:`margin` | :ref:`ref` | | +| | | | :ref:`range` | :ref:`actuatorfrcrange` | :ref:`margin` | :ref:`ref` | | | | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ | | | | | :ref:`springref` | :ref:`armature` | :ref:`damping` | :ref:`frictionloss` | | | | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ | diff --git a/doc/changelog.rst b/doc/changelog.rst index d24d1c4e..20086c60 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -12,6 +12,9 @@ General the exact formula rather than with Euler integration. #. Added an actuator attribute, :ref:`actearly`, which uses semi-implicit integration for actuator forces: using the next step's actuator state to compute the current actuator forces at the current timestep. +#. Renamed ``actuatorforcerange`` and ``actuatorforcelimited``, introduced in the previous version to + :ref:`actuatorfrcrange` and + :ref:`actuatorfrclimited`, respectively. Python bindings ^^^^^^^^^^^^^^^ @@ -26,7 +29,7 @@ General ^^^^^^^ 1. Added primitive collider for sphere-cylinder contacts, previously this pair used the generic convex-convex collider. -#. Added :ref:`joint-actuatorforcerange` for clamping total actuator force at joints and +#. Added :ref:`joint-actuatorforcerange` for clamping total actuator force at joints and :ref:`sensor-jointactuatorfrc` for measuring total actuation force applied at a joint. The most important use case for joint-level actuator force clamping is to ensure that :ref:`Cartesian actuator` forces are realizable by individual motors at the joints. diff --git a/doc/modeling.rst b/doc/modeling.rst index b9beb38d..9de80147 100644 --- a/doc/modeling.rst +++ b/doc/modeling.rst @@ -607,7 +607,7 @@ Force clamping at actuator output with :ref:`forcerange`, to keep the forces within bounds. Note that position actuators usually also require control range clamping to avoid hitting joint limits. -Force clamping at joint input with :ref:`joint/actuatorforcerange`: +Force clamping at joint input with :ref:`joint/actuatorfrcrange`: This joint attribute clamps input forces from all actuators acting on the joint, after passing through the :ref:`transmission`. Clamping actuator forces at the joint is equivalent to clamping them at the actuator if the transmission is trivial (there is a one-to-one relationship between the actuator and the joint). diff --git a/model/car/car.xml b/model/car/car.xml index ef17e546..0ab791f0 100644 --- a/model/car/car.xml +++ b/model/car/car.xml @@ -17,7 +17,7 @@ - + diff --git a/src/xml/xml_native_reader.cc b/src/xml/xml_native_reader.cc index c109200b..fe14e862 100644 --- a/src/xml/xml_native_reader.cc +++ b/src/xml/xml_native_reader.cc @@ -140,8 +140,8 @@ static const char* MJCF[nMJCF][mjXATTRNUM] = { {"material", "?", "8", "texture", "emission", "specular", "shininess", "reflectance", "rgba", "texrepeat", "texuniform"}, {"joint", "?", "21", "type", "group", "pos", "axis", "springdamper", - "limited", "actuatorforcelimited", "solreflimit", "solimplimit", - "solreffriction", "solimpfriction", "stiffness", "range", "actuatorforcerange", + "limited", "actuatorfrclimited", "solreflimit", "solimplimit", + "solreffriction", "solimpfriction", "stiffness", "range", "actuatorfrcrange", "margin", "ref", "springref", "armature", "damping", "frictionloss", "user"}, {"geom", "?", "31", "type", "pos", "quat", "contype", "conaffinity", "condim", "group", "priority", "size", "material", "friction", "mass", "density", @@ -239,9 +239,9 @@ static const char* MJCF[nMJCF][mjXATTRNUM] = { {"inertial", "?", "9", "pos", "quat", "mass", "diaginertia", "axisangle", "xyaxes", "zaxis", "euler", "fullinertia"}, {"joint", "*", "23", "name", "class", "type", "group", "pos", "axis", - "springdamper", "limited", "actuatorforcelimited", + "springdamper", "limited", "actuatorfrclimited", "solreflimit", "solimplimit", "solreffriction", "solimpfriction", - "stiffness", "range", "actuatorforcerange", "margin", "ref", "springref", + "stiffness", "range", "actuatorfrcrange", "margin", "ref", "springref", "armature", "damping", "frictionloss", "user"}, {"freejoint", "*", "2", "name", "group"}, {"geom", "*", "33", "name", "class", "type", "contype", "conaffinity", "condim", @@ -1318,7 +1318,7 @@ void mjXReader::OneJoint(XMLElement* elem, mjCJoint* pjoint) { pjoint->type = (mjtJoint)n; } MapValue(elem, "limited", &pjoint->limited, TFAuto_map, 3); - MapValue(elem, "actuatorforcelimited", &pjoint->actfrclimited, TFAuto_map, 3); + MapValue(elem, "actuatorfrclimited", &pjoint->actfrclimited, TFAuto_map, 3); ReadAttrInt(elem, "group", &pjoint->group); ReadAttr(elem, "solreflimit", mjNREF, pjoint->solref_limit, text, false, false); ReadAttr(elem, "solimplimit", mjNIMP, pjoint->solimp_limit, text, false, false); @@ -1329,7 +1329,7 @@ void mjXReader::OneJoint(XMLElement* elem, mjCJoint* pjoint) { ReadAttr(elem, "springdamper", 2, pjoint->springdamper, text); ReadAttr(elem, "stiffness", 1, &pjoint->stiffness, text); ReadAttr(elem, "range", 2, pjoint->range, text); - ReadAttr(elem, "actuatorforcerange", 2, pjoint->actfrcrange, text); + ReadAttr(elem, "actuatorfrcrange", 2, pjoint->actfrcrange, text); ReadAttr(elem, "margin", 1, &pjoint->margin, text); ReadAttr(elem, "ref", 1, &pjoint->ref, text); ReadAttr(elem, "springref", 1, &pjoint->springref, text); diff --git a/src/xml/xml_native_writer.cc b/src/xml/xml_native_writer.cc index cf8edc88..5101d370 100644 --- a/src/xml/xml_native_writer.cc +++ b/src/xml/xml_native_writer.cc @@ -228,7 +228,7 @@ void mjXWriter::OneJoint(XMLElement* elem, mjCJoint* pjoint, mjCDef* def) { bool afrange_defined = pjoint->actfrcrange[0]!=0 || pjoint->actfrcrange[1]!=0; bool aflimited_inferred = def->joint.actfrclimited==2 && pjoint->actfrclimited==afrange_defined; if (writingdefaults || !aflimited_inferred) { - WriteAttrKey(elem, "actutorforcelimited", TFAuto_map, 3, + WriteAttrKey(elem, "actuatorfrclimited", TFAuto_map, 3, pjoint->actfrclimited, def->joint.actfrclimited); } @@ -245,7 +245,7 @@ void mjXWriter::OneJoint(XMLElement* elem, mjCJoint* pjoint, mjCDef* def) { WriteAttr(elem, "solimpfriction", mjNIMP, pjoint->solimp_friction, def->joint.solimp_friction); WriteAttr(elem, "stiffness", 1, &pjoint->stiffness, &def->joint.stiffness); WriteAttr(elem, "range", 2, pjoint->range, def->joint.range); - WriteAttr(elem, "actuatorforcerange", 2, pjoint->actfrcrange, def->joint.actfrcrange); + WriteAttr(elem, "actuatorfrcrange", 2, pjoint->actfrcrange, def->joint.actfrcrange); WriteAttr(elem, "margin", 1, &pjoint->margin, &def->joint.margin); WriteAttr(elem, "armature", 1, &pjoint->armature, &def->joint.armature); WriteAttr(elem, "damping", 1, &pjoint->damping, &def->joint.damping); diff --git a/test/engine/testdata/actuation/joint_force_clamp.xml b/test/engine/testdata/actuation/joint_force_clamp.xml index 469eee63..3f478f9e 100644 --- a/test/engine/testdata/actuation/joint_force_clamp.xml +++ b/test/engine/testdata/actuation/joint_force_clamp.xml @@ -7,7 +7,7 @@ - + diff --git a/test/engine/testdata/actuation/refsite.xml b/test/engine/testdata/actuation/refsite.xml index cdc523dc..e4b0a2fa 100644 --- a/test/engine/testdata/actuation/refsite.xml +++ b/test/engine/testdata/actuation/refsite.xml @@ -29,7 +29,7 @@ commands is achievable by individual joint actuators with the specified torque limits. See https://mujoco.readthedocs.io/en/latest//modeling.html#actuator-force-clamping --> - +