界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
效率与协作 · SKILL.md

mjcf-mujoco-models

mjcf-mujoco-models

【效率与协作】Build, parse, compose, export, compile, step, inspect, and optionally render MJCF/MuJoCo models with dm_control.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: mjcf-mujoco-models description: "Build, parse, compose, export, compile, step, inspect, and optionally render MJCF/MuJoCo models with dm_control." metadata: disco-role: operating disable-model-invocation: true license: Apache 2.0

MJCF and MuJoCo Models

Use this sub-skill when a task is about raw MJCF/PyMJCF models or dm_control.mujoco.Physics: building XML object models, parsing model files or strings, composing attached models, exporting assets, compiling a Physics, stepping/resetting state, named data/model inspection, action specs, or a small render probe.

Route before working

  • Stay here for dm_control.mjcf.RootElement, Element.add/find/find_all, parser/export helpers, mjcf.Physics.from_mjcf_model, mujoco.Physics.from_xml_string/from_xml_path, physics.named, reset_context, mujoco.action_spec, and physics.render API usage.
  • Route custom Composer Entity, Task, observable, and variation abstractions to composer-environments.
  • Route Control Suite benchmark loading, wrappers, and rollout loops to suite-rl-workflows.
  • Route operational OpenGL, viewer, pixel-observation, EGL/OSMesa/GLFW, and Blender-exporter troubleshooting to rendering-viewer-assets.

Installation and runtime guardrails

Install the public package with:

pip install dm_control

For unreleased source installs use:

pip install git+https://github.com/google-deepmind/dm_control.git

Editable installs are not supported; do not rely on a source checkout, local paths, notebooks, or repository tests at runtime. Rendering is optional: CPU model construction, compile, reset, and stepping should work without an OpenGL backend, while physics.render depends on a configured MuJoCo GL backend.

Read or run these bundled files

  • Read references/pymjcf-reference.md when creating, parsing, modifying, attaching, namespacing, validating, or exporting MJCF/PyMJCF models.
  • Read references/mujoco-physics-reference.md when compiling models into Physics, stepping/resetting simulations, using named data/model access, deriving action specs, rendering, or wrapping a custom dm_env environment.
  • Read references/troubleshooting.md when schema/attribute validation, duplicate names, invalid references, assets, compile failures, render backend selection, or simulation divergence blocks progress.
  • Run scripts/mjcf_smoke_model.py to verify an installed dm_control can build a tiny PyMJCF model, compile mjcf.Physics, step it, optionally render, and optionally write the generated XML.

Default operating sequence

  1. Choose the level: PyMJCF object model for programmatic construction/composition; raw mujoco.Physics constructors for existing XML or MJB models.
  2. Build or parse the model; use dclass for XML class, getattr(model.visual, 'global') for keyword child names, and direct mjcf.Element references for reference attributes.
  3. If composing models, attach a fresh or copied child model, keep the returned attachment frame if joints/inertials are needed, and validate namespaced identifiers after attachment.
  4. Compile with mjcf.Physics.from_mjcf_model(model) or mujoco.Physics.from_xml_string(xml, assets=model.get_assets()) before claiming the model is valid.
  5. Inspect and control through physics.named, physics.bind(element) for PyMJCF elements, reset_context, set_control, step, and mujoco.action_spec.
  6. Treat rendering as an optional probe. If rendering fails but non-rendering compile/step succeeds, preserve the model result and route backend diagnosis to the rendering sibling skill.
我的收藏