PyMJCF nested include tags relative to base model
还没有人认领这个 Issue。
评估
调研方向
首先使用 scenes.zip 中的三个场景复现 mjcf.Physics.from_xml_path 和 mjcf.Physics.from_mjcf_model 之间的差异。追踪 PyMJCF 对 include 和 asset 路径的处理;完成标准是嵌套 include 和外部 asset 都相对于顶层模型目录进行解析,并与 MuJoCo 保持一致。
由索引模型根据 Issue 内容生成。
描述
PyMJCF does not support nested include tags the same way as the MuJoCo compiler. No matter how deep the include tag is, MuJoCo expects all included models and their assets to be given as paths to the corresponding file relative to the input file parent directory. However, the current implementation of PyMJCF checks paths relative to the current file's parent directory, which MuJoCo does not support.
In the attached scenes.zip file are 3 scenes.
- my_scene1/scene.xml includes a file in an inner directory that includes another file in yet another inner directory. The internal include tag uses a path relative to the top-level model directory (my_scene1/). This is supported by MuJoCo but PyMJCF fails to parse the scene:
>>> mjcf.Physics.from_xml_path('my_scene1/scene.xml') # parse using mujoco directly
<dm_control.mjcf.physics.Physics object at 0x7fd0d191b0d0>
>>> mjcf.Physics.from_mjcf_model(mjcf.from_path('my_scene1/scene.xml')) # parse with PyMJCF then convert to physics
FileNotFoundError: [Errno 2] No such file or directory: 'my_scene1/inner/inner/inner-inner/include.xml'
- my_scene2/scene.xml is the same as my_scene1/scene.xml but the inner include path is given relative to the current model directory (my_scene2/inner/). PyMJCF supports this but it does not compile natively using MuJoCo.
>>> mjcf.Physics.from_xml_path('my_scene2/scene.xml') # parse using mujoco directly
ValueError: XML Error: Could not open file 'my_scene2/inner-inner/include.xml'
Element 'include', line 0
>>> mjcf.Physics.from_mjcf_model(mjcf.from_path('my_scene2/scene.xml')) # parse with PyMJCF then convert to physics
<dm_control.mjcf.physics.Physics object at 0x7fc61f1a6700>
- my_scene3/scene.xml specifies mesh and texture files in an included file to show that MuJoCo expects these files to be specified relative to the top-level model directory as well.
>>> mjcf.Physics.from_xml_path('my_scene3/scene.xml') # parse using mujoco directly
<dm_control.mjcf.physics.Physics object at 0x7fc61f1a6f10>
>>> mjcf.Physics.from_mjcf_model(mjcf.from_path('my_scene2/scene.xml')) # parse with PyMJCF then convert to physics
FileNotFoundError: Line 4: error while parsing element <mesh>: during initialization of attribute 'file' of element <mesh>: [Errno 2] No such file or directory: 'my_scene3/inner/meshes/banana.stl'
In conclusion, models with nested include tags or external assets in included files are parsed differently with MuJoCo than with PyMJCF.
- 主要语言
- Python
- 星标
- 4.7k
- 派生
- 765
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
google-deepmind/dm_control 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 76/100
google-deepmind/dm_control#552 ·
-
难度 3/5 1-2 天 新手友好度 45/100
google-deepmind/dm_control#540 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 55/100
google-deepmind/dm_control#537 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 45/100
google-deepmind/dm_control#529 ·
-
难度 5/5 一周以上 新手友好度 25/100
google-deepmind/dm_control#527 · 1 条评论 ·
查看 google-deepmind/dm_control 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
anthropics/skills#1811 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
speaches-ai/speaches#678 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
datalayer/mcp-compose#42 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
conda-forge/spacy-feedstock#177 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
UKGovernmentBEIS/inspect_evals#2523 ·