Add body/simple attribute to control simple body optimization.
PiperOrigin-RevId: 942164766 Change-Id: I1e83bb99b6a1955917eb9b2e9bed0dc7b8e6a161
This commit is contained in:
committed by
Copybara-Service
parent
4ecfe5c1f3
commit
5618666a7d
@@ -2152,6 +2152,31 @@ defined. Its body name is automatically defined as "world".
|
||||
|
||||
See :ref:`implementation notes<siSleep>` for more details.
|
||||
|
||||
.. _body-simple:
|
||||
|
||||
:at:`simple`: :at-val:`[false, auto], "auto"`
|
||||
Controls the *simple body* optimization. When a body qualifies as "simple", its inertial matrix block in the mass
|
||||
matrix is diagonal, representing independent translational and rotational degrees of freedom. The optimization
|
||||
omits storing of the zero-valued off-diagonal entries, reducing memory footprint and computation.
|
||||
|
||||
A body qualifies for this optimization if it satisfies all of the following:
|
||||
|
||||
- **Inertial frame alignment**: The body's inertial frame coincides with its body frame.
|
||||
- **Kinematic root**: The body's parent is either the world body or a static body.
|
||||
- **Leaf body**: The body is a leaf node in the kinematic tree (it has no child bodies).
|
||||
- **Origin-centered joints**: All joints belonging to this body must reside at the body's origin.
|
||||
- **Aligned joint axes**: Any hinge or slide joint axes must be aligned with the local coordinate axes, and at most
|
||||
one joint with rotational degrees of freedom (hinge or ball) is permitted.
|
||||
- **No inertia-bearing tendons**: The body must not contain sites or geoms used as wrap objects by any tendon that
|
||||
has non-zero :ref:`armature<tendon-spatial-armature>`.
|
||||
|
||||
Setting this attribute to :at-val:`false` disables the optimization for this body. This is necessary for domain
|
||||
randomization workflows where model parameters (such as joint/inertial offsets or angles) are perturbed dynamically
|
||||
during simulation and updated via :ref:`mj_setConst`. Because a body compiled with the simple optimization active
|
||||
cannot dynamically lose its simple state at runtime (which would require reallocation of sparse matrix structures),
|
||||
any runtime parameter change that violates the simple conditions will trigger a validation error unless
|
||||
``simple="false"`` was explicitly declared in the XML.
|
||||
|
||||
.. _body-user:
|
||||
|
||||
:at:`user`: :at-val:`real(nbody_user), "0 0 ..."`
|
||||
|
||||
@@ -713,6 +713,9 @@
|
||||
.. grid-item::
|
||||
:ref:`sleep<body-sleep>`
|
||||
|
||||
.. grid-item::
|
||||
:ref:`simple<body-simple>`
|
||||
|
||||
.. grid-item::
|
||||
:ref:`user<body-user>`
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ General
|
||||
- :ref:`mj_encode` now supports encoding of MJB and TXT files.
|
||||
- :ref:`mj_setConst` now recomputes the ``mjModel.{body,geom,site}_sameframe`` flags, to account for changes in
|
||||
body/geom/site frames after compilation.
|
||||
- Added :ref:`body/simple<body-simple>` attribute ("false"/"auto") to disable the *simple body* mass matrix
|
||||
optimization. This is useful for domain randomization, where model parameters may change post-compilation.
|
||||
- The :el:`attach` element now supports self-attachment (attaching elements of the current model to itself) by omitting
|
||||
the :at:`model` attribute. It also supports attaching a frame via the new :at:`frame` attribute, which is mutually
|
||||
exclusive with :at:`body`.
|
||||
|
||||
@@ -1661,6 +1661,7 @@ typedef struct mjsBody_ { // body specification
|
||||
mjtByte mocap; // is this a mocap body
|
||||
double gravcomp; // gravity compensation
|
||||
mjtSleepPolicy sleep; // sleep policy
|
||||
mjtByte simple; // simple body optimization (0: false, 1: auto)
|
||||
mjDoubleVec* userdata; // user data
|
||||
mjtByte explicitinertial; // whether to save the body with explicit inertial clause
|
||||
mjsPlugin plugin; // passive force plugin
|
||||
|
||||
Reference in New Issue
Block a user