Move mesh inertia specification from global <compiler> to <asset/mesh>.
Three options: - Convex: Use convex hull - Exact: Use exact geometry (requires watertight mesh) - Legacy: Legacy approximation (deprecated) Fixes #2152 PiperOrigin-RevId: 688949900 Change-Id: I4537f343db917195c6fd58d517b189d5ee3be1cd
This commit is contained in:
committed by
Copybara-Service
parent
0c97dcf1fd
commit
b598d79b3f
+20
-6
@@ -815,12 +815,6 @@ has any effect. The settings here are global and apply to the entire model.
|
||||
to the mass. This results in equivalent inertia boxes which extend far beyond the geometric boundaries of the model.
|
||||
Note that the built-in OpenGL visualizer can render equivalent inertia boxes.
|
||||
|
||||
.. _compiler-exactmeshinertia:
|
||||
|
||||
:at:`exactmeshinertia`: :at-val:`[false, true], "false"`
|
||||
If this attribute is set to false, computes mesh inertia with the legacy algorithm, which is exact only for convex
|
||||
meshes. If set to true, it is exact for any closed mesh geometry.
|
||||
|
||||
.. _compiler-alignfree:
|
||||
|
||||
:at:`alignfree`: :at-val:`[false, true], "false"`
|
||||
@@ -1249,6 +1243,24 @@ The full list of processing steps applied by the compiler to each mesh is as fol
|
||||
This attribute specifies the scaling that will be applied to the vertex data along each coordinate axis. Negative
|
||||
values are allowed, resulting in flipping the mesh along the corresponding axis.
|
||||
|
||||
.. _asset-mesh-inertia:
|
||||
|
||||
:at:`inertia`: :at-val:`[convex, exact, legacy], "legacy"`
|
||||
This attribute controls how the mesh is used when mass and inertia are
|
||||
:ref:`inferred from geometry<_compiler-inertiafromgeom>`. The current default value :at-val:`legacy` will be changed
|
||||
to :at-val:`convex` in a future release.
|
||||
|
||||
:at-val:`convex`
|
||||
Use the mesh's convex hull to compute volume and inertia.
|
||||
|
||||
:at-val:`exact`
|
||||
Use an exact algorithm to compute volume and inertia. This algorithm requires a well-oriented, watertight mesh and
|
||||
will error otherwise.
|
||||
|
||||
:at-val:`legacy`
|
||||
Use the legacy algorithm, which is similar to :at-val:`convex`, but leads to volume overcounting for non-convex
|
||||
meshes.
|
||||
|
||||
.. _asset-mesh-smoothnormal:
|
||||
|
||||
:at:`smoothnormal`: :at-val:`[false, true], "false"`
|
||||
@@ -8016,6 +8028,8 @@ if omitted.
|
||||
|
||||
.. _default-mesh-maxhullvert:
|
||||
|
||||
.. _default-mesh-inertia:
|
||||
|
||||
:el-prefix:`default/` |-| **mesh** (?)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
+3
-5
@@ -54,9 +54,7 @@
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`discardvisual<compiler-discardvisual>` | :ref:`convexhull<compiler-convexhull>` | :ref:`usethread<compiler-usethread>` | :ref:`fusestatic<compiler-fusestatic>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`inertiafromgeom<compiler-inertiafromgeom>` | :ref:`inertiagrouprange<compiler-inertiagrouprange>` | :ref:`exactmeshinertia<compiler-exactmeshinertia>` | :ref:`assetdir<compiler-assetdir>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`alignfree<compiler-alignfree>` | | | | |
|
||||
| | | | :ref:`inertiafromgeom<compiler-inertiafromgeom>` | :ref:`inertiagrouprange<compiler-inertiagrouprange>` | :ref:`assetdir<compiler-assetdir>` | :ref:`alignfree<compiler-alignfree>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| |_| compiler |br| |_| |L| | | .. table:: |
|
||||
@@ -105,7 +103,7 @@
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`refpos<asset-mesh-refpos>` | :ref:`refquat<asset-mesh-refquat>` | :ref:`scale<asset-mesh-scale>` | :ref:`smoothnormal<asset-mesh-smoothnormal>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`maxhullvert<asset-mesh-maxhullvert>` | | | | |
|
||||
| | | | :ref:`maxhullvert<asset-mesh-maxhullvert>` | :ref:`inertia<asset-mesh-inertia>` | | | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| |_2| mesh |br| |_2| |L| | | .. table:: |
|
||||
@@ -1422,7 +1420,7 @@
|
||||
| :ref:`mesh | ? | :class: mjcf-attributes |
|
||||
| <default-mesh>` | | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`scale<default-mesh-scale>` | :ref:`maxhullvert<default-mesh-maxhullvert>` | | | |
|
||||
| | | | :ref:`scale<default-mesh-scale>` | :ref:`maxhullvert<default-mesh-maxhullvert>` | :ref:`inertia<default-mesh-inertia>` | | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| |_| default |br| |_| |L| | | .. table:: |
|
||||
|
||||
+6
-1
@@ -5,6 +5,11 @@ Changelog
|
||||
Upcoming version (not yet released)
|
||||
-----------------------------------
|
||||
|
||||
General
|
||||
^^^^^^^
|
||||
- The global compiler flag ``exactmeshinertia`` has been removed and replaced with the mesh-specific
|
||||
:ref:`inertia<asset-mesh-inertia>` attribute.
|
||||
|
||||
MJX
|
||||
^^^
|
||||
- Added ``apply_ft``, ``jac``, and ``xfrc_accumulate`` as public functions.
|
||||
@@ -1076,7 +1081,7 @@ Bug fixes
|
||||
12. Fixed bug in the handling of ellipsoid-based fluid model forces in the new implicitfast integrator.
|
||||
#. Removed spurious whole-arena copying in `mj_copyData`, which can considerably
|
||||
`slow down <https://github.com/google-deepmind/mujoco/issues/568>`__ the copying operation.
|
||||
#. Make :ref:`shellinertia<body-geom-shellinertia>` ignore :ref:`exactmeshinertia<compiler-exactmeshinertia>`, which is
|
||||
#. Make :ref:`shellinertia<body-geom-shellinertia>` ignore ``exactmeshinertia``, which is
|
||||
only used for legacy volume computations (`#759 <https://github.com/google-deepmind/mujoco/issues/759>`__).
|
||||
|
||||
|
||||
|
||||
@@ -1638,9 +1638,14 @@ struct mjrContext_ { // custom OpenGL context
|
||||
};
|
||||
typedef struct mjrContext_ mjrContext;
|
||||
typedef enum mjtGeomInertia_ { // type of inertia inference
|
||||
mjINERTIA_VOLUME, // mass distributed in the volume
|
||||
mjINERTIA_VOLUME = 0, // mass distributed in the volume
|
||||
mjINERTIA_SHELL, // mass distributed on the surface
|
||||
} mjtGeomInertia;
|
||||
typedef enum mjtMeshInertia_ { // type of mesh inertia
|
||||
mjINERTIA_CONVEX = 0, // convex mesh inertia
|
||||
mjINERTIA_EXACT, // exact mesh inertia
|
||||
mjINERTIA_LEGACY, // legacy mesh inertia
|
||||
} mjtMeshInertia;
|
||||
typedef enum mjtBuiltin_ { // type of built-in procedural texture
|
||||
mjBUILTIN_NONE = 0, // no built-in texture
|
||||
mjBUILTIN_GRADIENT, // gradient: rgb1->rgb2
|
||||
@@ -1700,7 +1705,6 @@ typedef struct mjSpec_ { // model specification
|
||||
mjtByte fusestatic; // fuse static bodies with parent
|
||||
int inertiafromgeom; // use geom inertias (mjtInertiaFromGeom)
|
||||
int inertiagrouprange[2]; // range of geom groups used to compute inertia
|
||||
mjtByte exactmeshinertia; // if false, use old formula
|
||||
int alignfree; // align free joints with inertial frame
|
||||
mjLROpt LRopt; // options for lengthrange computation
|
||||
|
||||
@@ -1989,6 +1993,7 @@ typedef struct mjsMesh_ { // mesh specification
|
||||
double refpos[3]; // reference position
|
||||
double refquat[4]; // reference orientation
|
||||
double scale[3]; // rescale mesh
|
||||
mjtMeshInertia inertia; // inertia type (convex, legacy, exact)
|
||||
mjtByte smoothnormal; // do not exclude large-angle faces from normals
|
||||
int maxhullvert; // maximum vertex count for the convex hull
|
||||
mjFloatVec* uservert; // user vertex data
|
||||
|
||||
Reference in New Issue
Block a user