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:
Alessio Quaglino
2024-10-23 07:05:32 -07:00
committed by Copybara-Service
parent 0c97dcf1fd
commit b598d79b3f
19 changed files with 170 additions and 87 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
<mujoco>
<compiler fitaabb="false" exactmeshinertia="true"/>
<compiler fitaabb="false"/>
<asset>
<mesh file="stanford_bunny.obj"/>
<mesh file="stanford_bunny.obj" inertia="exact"/>
</asset>
<worldbody>
+24
View File
@@ -0,0 +1,24 @@
<mujoco>
<asset>
<mesh name="incomplete_convex" inertia="convex"
vertex="0 0 0 1 0 0 0 1 0 0 0 1"
face="2 0 3 0 1 3 1 2 3" />
<mesh name="incomplete"
vertex="0 0 0 1 0 0 0 1 0 0 0 1"
face="2 0 3 0 1 3 1 2 3"/>
<mesh name="complete"
vertex="0 0 0 1 0 0 0 1 0 0 0 1"
face="2 0 3 0 1 3 1 2 3 1 0 2"/>
</asset>
<worldbody>
<body>
<geom type="mesh" mesh="incomplete_convex"/>
</body>
<body>
<geom type="mesh" mesh="incomplete"/>
</body>
<body>
<geom type="mesh" mesh="complete"/>
</body>
</worldbody>
</mujoco>
+6 -4
View File
@@ -1,9 +1,11 @@
<mujoco>
<compiler exactmeshinertia="true"/>
<default>
<mesh scale="10 10 10" inertia="exact"/>
</default>
<asset>
<mesh file="cube_cup.obj" scale="10 10 10"/>
<mesh file="cube_cup_quad.obj" scale="10 10 10"/>
<mesh file="cube_cup_hi.obj" scale="10 10 10"/>
<mesh file="cube_cup.obj"/>
<mesh file="cube_cup_quad.obj"/>
<mesh file="cube_cup_hi.obj"/>
</asset>
<worldbody>
<light directional="true" diffuse=".6 .6 .6" specular="0.2 0.2 0.2" pos="0 0 4" dir="0 0 -1"/>
+1 -1
View File
@@ -1,7 +1,7 @@
<mujoco>
<asset>
<mesh file="cube.obj"/>
<mesh name="inline_cube"
<mesh name="inline_cube" inertia="convex"
vertex="
-.5 -.5 -.5
.5 -.5 -.5