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:
committed by
Copybara-Service
parent
7e16ecaa25
commit
6320b95957
@@ -16,6 +16,7 @@
|
||||
|
||||
import contextlib
|
||||
import copy
|
||||
from etils import epath
|
||||
import pickle
|
||||
import sys
|
||||
|
||||
@@ -1658,6 +1659,16 @@ Euler integrator, semi-implicit in velocity.
|
||||
model = mujoco.MjModel.from_xml_string(TEST_XML_TEXTURE)
|
||||
self.assertEqual(model.tex('tex').data.shape, (512, 512, 3))
|
||||
|
||||
def test_xml_dependencies(self):
|
||||
model_path = str(epath.resource_path("mujoco") / "testdata" / "msh.xml")
|
||||
msh_path =str(epath.resource_path("mujoco") / "testdata" / "abdomen_1_body.msh")
|
||||
|
||||
model_path = model_path.replace('\\', '/')
|
||||
msh_path = msh_path.replace('\\', '/')
|
||||
dependencies = mujoco.mju_getXMLDependencies(model_path)
|
||||
self.assertIn(model_path, dependencies)
|
||||
self.assertIn(msh_path, dependencies)
|
||||
|
||||
def _assert_attributes_equal(self, actual_obj, expected_obj, attr_to_compare):
|
||||
for name in attr_to_compare:
|
||||
actual_value = getattr(actual_obj, name)
|
||||
|
||||
Reference in New Issue
Block a user