Add mju_getXMLDependencies that given an MJCF file returns filepaths to all of it's dependencies.

PiperOrigin-RevId: 814203235
Change-Id: Ib5c2e2f4dd42224a768c88d76473544190c72bc0
This commit is contained in:
Sam Haves
2025-10-02 06:13:59 -07:00
committed by Copybara-Service
parent 7e16ecaa25
commit 6320b95957
15 changed files with 342 additions and 1 deletions
+21
View File
@@ -0,0 +1,21 @@
<mujoco>
<include file="child.xml"/>
<compiler meshdir="meshes"/>
<asset>
<model name="other" file="parent_model.xml"/>
<mesh name="mesh1" file="mesh1.obj"/>
</asset>
<worldbody>
<body name="my_parent">
<geom name="my_geom" size="2"/>
<flexcomp type="mesh" file="flex.obj" name="flex" rigid="true"/>
</body>
<body name="box">
<geom type="box" mesh="mesh1"/>
</body>
</worldbody>
<deformable>
<skin name="skin" file="cube.skn"/>
</deformable>
</mujoco>
Binary file not shown.
+39
View File
@@ -0,0 +1,39 @@
# Simple Cube - OBJ File
# Vertices (v)
# 8 corners of the cube
# Back Face
v -1.0 -1.0 -1.0
v 1.0 -1.0 -1.0
v 1.0 1.0 -1.0
v -1.0 1.0 -1.0
# Front Face
v -1.0 -1.0 1.0
v 1.0 -1.0 1.0
v 1.0 1.0 1.0
v -1.0 1.0 1.0
# Faces (f)
# A cube has 6 faces. Each face is a quad, defined by 4 vertices.
# The vertices are numbered according to their order of appearance above, starting from 1.
# The order defines the face normal (front-facing) based on the right-hand rule.
# Back Face (v1, v2, v3, v4)
f 1 2 3 4
# Right Face (v2, v6, v7, v3)
f 2 6 7 3
# Front Face (v5, v8, v7, v6) - Note the ordering for correct normal
f 5 8 7 6
# Left Face (v1, v4, v8, v5)
f 1 4 8 5
# Top Face (v4, v3, v7, v8)
f 4 3 7 8
# Bottom Face (v1, v5, v6, v2)
f 1 5 6 2
+39
View File
@@ -0,0 +1,39 @@
# Simple Cube - OBJ File
# Vertices (v)
# 8 corners of the cube
# Back Face
v -1.0 -1.0 -1.0
v 1.0 -1.0 -1.0
v 1.0 1.0 -1.0
v -1.0 1.0 -1.0
# Front Face
v -1.0 -1.0 1.0
v 1.0 -1.0 1.0
v 1.0 1.0 1.0
v -1.0 1.0 1.0
# Faces (f)
# A cube has 6 faces. Each face is a quad, defined by 4 vertices.
# The vertices are numbered according to their order of appearance above, starting from 1.
# The order defines the face normal (front-facing) based on the right-hand rule.
# Back Face (v1, v2, v3, v4)
f 1 2 3 4
# Right Face (v2, v6, v7, v3)
f 2 6 7 3
# Front Face (v5, v8, v7, v6) - Note the ordering for correct normal
f 5 8 7 6
# Left Face (v1, v4, v8, v5)
f 1 4 8 5
# Top Face (v4, v3, v7, v8)
f 4 3 7 8
# Bottom Face (v1, v5, v6, v2)
f 1 5 6 2
+11
View File
@@ -0,0 +1,11 @@
<mujoco>
<asset>
<model name="other" file="child.xml"/>
</asset>
<worldbody>
<body name="parent">
<geom name="geom" size="2"/>
<attach model="other" body="body" prefix="other"/>
</body>
</worldbody>
</mujoco>