Skip to content

markusgrotz/mujoco-scene-editor

Repository files navigation

Supported Python Versions PyPI version License Code style

Scene Editor for MuJoCo

Lightweight, interactive scene editor for MuJoCo 3.x. Create or edit scenes in your browser to place shapes, import meshes, add robots, and edit elements interactively.

Quickstart

pip install mujoco-scene-editor

# Start a fresh, empty scene
mjcreate

# Load from MJCF XML or a blueprint JSON
mjedit path/to/scene.xml

Installation

Install the package on PyPi with

pip install mujoco-scene-editor

This installs necessary dependencies and exposes console scripts. The following entry points are available and they are also accessible as scene-editor subcommands:

  • mjcreate: Create an empty scene (opens the web browser)
  • mjedit: Edit an existing scene (opens the web browser)
  • mjprompt: Generate a scene from a prompt and save it as a MuJoCo XML

From a local checkout:

pip install -e .
# or with dev tools
pip install -e '.[dev]'

To run with uv, use

# Run the installed console script via uv
uv run scene-editor --help
uv run scene-editor new

When the server starts, it prints the URL and opens your browser. Quit with Ctrl+C or the "Quit server" button.

Examples

Use the provided chemistry lab MJCF as a starting point:

# With pip-installed package
mjedit examples/prompt/scene_chemistry_lab.xml

# With uv (no install)
uv run --with mujoco-scene-editor mjedit examples/prompt/scene_chemistry_lab.xml

Then:

  • Use "Add Box/Sphere/Cylinder" to place primitive geoms.
  • Use "Add Asset" to insert a local mesh from your file system.
  • Drag the gizmo to change pose; use “Export” to write MJCF/JSON.

Robot models are detected using a heuristic. See the section below on how to configure the editor to use different robot models.

Prompting / Scene Generation Examples

You can conveniently generate a MuJoCo scene from a natural-language prompt (requires an OpenAI API key):

# Set this to your API key
export OPENAI_API_KEY=...
# Generate a scene from a prompt string
mjprompt

# Edit the generated scene. 
mjedit examples/prompt/scene_coffee_shop.xml

Loading a generated scene might not work out of the box in all cases. Generated scenes can have inconsistencies in geometry, but can be easily edited.

Examples

Below are some generated example scenes. More examples are available in the examples/prompt folder.

Living Room
Living Room
Chess Table
Chess Table
Playground
Playground
Chemistry Lab
Chemistry Lab

Working with different robots or cameras

Robot models must be specified with a JSON configuration. To work with additional robot models, set the ROBITS_CONFIG_DIR environment variable to another config folder. See the RoBits documentation for more details.

  export ROBITS_CONFIG_DIR=$HOME/code/robits/robits_config/additional_config_sim
  mjedit examples/prompt/scene_coffee_shop.xml

Limitations

  • Importing MuJoCo XML files may alter the internal structure, and some tags are discarded.
    • Joints/actuators are discarded if they are not part of a robot description.
    • Additional geom tags, including friction, conaffinity, or contype are not yet supported and discarded.
    • Light/option/compiler elements are not implemented yet.

If you are looking for a robot editor for MuJoCo that supports all the assets please checkout Robola web

  • Not all MuJoCo robot descriptions have an equivalent URDF representation.

Links

About

Lightweight, interactive scene editor for MuJoCo 3.x. Create or edit scenes in your browser to place shapes, import meshes, add robots, and edit elements interactively.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages