Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Exported XML loses meshdir and relative mesh paths

未关闭
#523 1 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
python
领域
backend

调研方向

从 issue 中描述的 scene_model.to_xml_string() 调用开始,并将其行为与 issue #454 中相关的 mjcf.export_with_assets(...) 路径进行比较。检查导出是否能够保留 meshdir 和相对 mesh 路径,并单独调查 dm_control.viewer 是否接受组合后的场景。只有对这两个问题都有文档记录或经过测试的答案,才算完成。

由索引模型根据 Issue 内容生成。

描述

I'm using PyMJCF to load a robot model from an XML file and build a MuJoCo scene. When I export the composed scene back to an XML string using scene_model.to_xml_string(), I've run into an issue with the file paths.

The Problem

The exported XML file is missing the directive. Meanwhile, all the mesh file paths, which were originally relative to that directory, are now missing their path prefixes.

For example, a mesh defined like file="my_robot/meshes/part1.stl" becomes file="part1.stl" in the exported file.

Code Snippet

Here is the line of code I'm using for the export:

final_xml_string = scene_model.to_xml_string()
What I've Found

I found a related issue (#454) that suggests using mjcf.export_with_assets(...) as a potential solution for managing assets.

My Questions
  1. Is there a direct method in PyMJCF to preserve the meshdir compiler attribute and the corresponding relative file paths when exporting a model to an XML string?

  2. Separately, my main goal is to visualize the composed scene. I know dm_control.viewer can be used for simulations. Does the viewer also support loading and visualizing a custom MJCF scene like the one I'm building?

Thanks for your help!

主要语言
Python
星标
4.7k
派生
765
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

google-deepmind/dm_control 的其他 Issue

查看 google-deepmind/dm_control 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。