mjlab/docs/source/debugging/export_scene.rst
Upstream Snapshot 32a241c28f
Some checks failed
nightly / Test against latest dependencies (py3.10) (push) Has been cancelled
nightly / Test against latest dependencies (py3.13) (push) Has been cancelled
tests / tests (3.13, locked) (push) Has been cancelled
tests / tests (3.13, unlocked) (push) Has been cancelled
tests / pyright (3.10) (push) Has been cancelled
tests / lint-format (push) Has been cancelled
tests / tests (3.10, locked) (push) Has been cancelled
tests / tests (3.11, locked) (push) Has been cancelled
tests / tests (3.12, locked) (push) Has been cancelled
tests / pyright (3.11) (push) Has been cancelled
tests / pyright (3.12) (push) Has been cancelled
tests / pyright (3.13) (push) Has been cancelled
tests / ty-check (3.10) (push) Has been cancelled
tests / ty-check (3.11) (push) Has been cancelled
tests / ty-check (3.12) (push) Has been cancelled
tests / ty-check (3.13) (push) Has been cancelled
tests / stubs (push) Has been cancelled
tests / smoke-test (push) Has been cancelled
Docker / check_paths (push) Has been cancelled
docs / build (push) Has been cancelled
Docker / build (push) Has been cancelled
Import upstream snapshot c19f713c415a699a79d71cd96aa13c3104a05047
Upstream: https://github.com/michaelgillett/mjlab
Upstream-Commit: c19f713c415a699a79d71cd96aa13c3104a05047
Upstream-Branch: main
2026-08-28 15:42:17 +08:00

51 lines
1.6 KiB
ReStructuredText

.. _export-scene:
Export Scene
============
The ``export-scene`` script writes a complete scene (XML and mesh assets) to a
directory for inspection, sharing, or loading in standalone MuJoCo.
Quick start
-----------
.. code-block:: bash
# Export a built-in entity by alias.
uv run export-scene g1 --output-dir /tmp/g1
# Export a registered task scene.
uv run export-scene Mjlab-Velocity-Flat-Unitree-Go1 --output-dir /tmp/task
# Export as a zip archive.
uv run export-scene yam --output-dir /tmp/yam --zip True
# Export a custom entity via import path.
uv run export-scene my_pkg.robots:get_my_robot_cfg --output-dir /tmp/custom
The output directory contains a ``scene.xml`` and an ``assets/`` subdirectory
with all referenced mesh files. The XML can be loaded directly with
``mujoco.MjModel.from_xml_path()`` or dropped into the
`simulate viewer <https://mujoco.readthedocs.io/en/stable/programming/samples.html#sasimulate>`_.
Target resolution
-----------------
The positional ``target`` argument is resolved in order:
1. **Task ID**: checked against the task registry (``import mjlab.tasks``).
2. **Entity alias**: one of the built-in shorthands (``g1``, ``go1``, ``yam``).
3. **Import path**: a ``module:attribute`` string pointing to any callable
that returns an ``EntityCfg``.
If none match, the script prints available task IDs and aliases.
Options
-------
``--output-dir DIR`` *(default: "export")*
Destination directory. Cleaned before each export to prevent stale assets.
``--zip True`` *(default: False)*
Compress the output into a ``.zip`` archive and remove the directory.