mjviser
A web-based MuJoCo viewer built on Viser.
Quick start
Run it directly with uvx (nothing to install):
uvx mjviser path/to/model.xml
Or pip install mjviser and run mjviser path/to/model.xml.
mjviser also does fuzzy path matching against the current directory:
mjviser humanoid # finds **/humanoid*.xml
mjviser shadow_hand # finds **/shadow_hand*.xml
Use --port to bind to a specific port (default: 8080):
mjviser model.xml --port 7070
If robot_descriptions is available, you can load any of its 57 MuJoCo models by name:
uvx --with robot_descriptions mjviser go1
[!NOTE]
uvxdefaults to the system Python and may not respectrequires-pythonconstraints (astral-sh/uv#8206). If your system Python is 3.14+, where MuJoCo can't build yet, pass-p 3.13explicitly:uvx -p 3.13 mjviser path/to/model.xml.
Python API
import mujoco
from mjviser import Viewer
model = mujoco.MjModel.from_xml_path("robot.xml")
data = mujoco.MjData(model)
Viewer(model, data).run()
Open the printed URL in your browser. You get most of what the native MuJoCo viewer offers: simulation controls, joint and actuator sliders, contact and force visualization, camera tracking, keyframes, and more.
Extension points
Viewer accepts three optional callbacks:
step_fn(model, data): called each simulation step. Defaults tomujoco.mj_step.render_fn(scene): called each render frame. Defaults toscene.update_from_mjdata(data).reset_fn(model, data): called on reset.
For full control, use ViserMujocoScene directly. The server is a standard Viser server, so you can add GUI elements, scene overlays, or anything else Viser supports.
server = viser.ViserServer()
scene = ViserMujocoScene(server, model, num_envs=1)
scene.create_visualization_gui()
with server.gui.add_folder("My Controls"):
slider = server.gui.add_slider("Force", min=0, max=100, initial_value=0)
while True:
mujoco.mj_step(model, data)
scene.update_from_mjdata(data)
Examples
active_viewer.py: simplest usage with playback controlsactive_viewer_with_controller.py: customstep_fnwith random torquespassive_viewer.py: manual simulation loop withViserMujocoScenemulti_env.py: 4 humanoids in parallel via mujoco-warpghost_overlay.py: customrender_fnthat overlays a time-delayed ghostmotion_playback.py: recorded trajectory with timeline scrubber, speed control, and contact replay
Acknowledgments
Thanks to Matija Kecman for early feedback and suggestions.
Limitations
- No mouse interaction: clicking/dragging bodies and keyboard callbacks require upstream Viser support.
Metadata
Release files for mjviser 0.0.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mjviser-0.0.14.tar.gz | 29.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mjviser-0.0.14-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.9 kB
Release files / mjviser-0.0.14.tar.gz
| Download URL | mjviser-0.0.14.tar.gz |
|---|---|
| Size | 29.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebde2203dab89959a13ae549b4d3e5e5cf9eb69de11a1a2fd759cbe8f8c641f3
|
|
BLAKE2b-256 checksum How to use checksums |
1de4eef89b279fb1811b5f120a99ac9284c32ff2ca4fad5e6f5c93035f72ba9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / mjviser-0.0.14-py3-none-any.whl
| Download URL | mjviser-0.0.14-py3-none-any.whl |
|---|---|
| Size | 32.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b09f8e90506fc4a71d76fc628872147157947e9292428213ab78cfe137c9a26
|
|
BLAKE2b-256 checksum How to use checksums |
9cc24534d678ad1b3f7dee6fd83110112800287be21ba007d988abb9ddc8e0ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|