Skip to main content

Browser-based MuJoCo simulation with real-time policy control

Project description

mjswan

Real-time Interactive AI Robot Simulation in Your Browser

deploy test docs pypi version npm version

mjswan is a powerful framework for creating interactive MuJoCo simulations with real-time policy control, running entirely in the browser. Built on top of mujoco wasm, onnxruntime, and three.js, it enables easy sharing of AI robot simulation demos as static sites, perfect for GitHub Pages hosting.

Check out the demo ― ttktjmt.github.io/mjswan

mjlab Demo   Robot Descriptions Demo   MuJoCo Playground Demo   MyoSuite Demo


Features

  • Real-time: Run mujoco simulations and policy control in real time.
  • Interactive: Change the state of objects by applying forces.
  • Cross-platform: Works seamlessly on desktop and mobile devices.
  • VR Support: Native VR viewer support with WebXR.
  • Client-only: All computation runs in the browser. No server for simulation is required.
  • Easy Sharing: Host as a static site for effortless demo distribution (e.g., GitHub Pages).
  • Portable: Embed the simulation in a web page or Google Colab notebook.
  • Customizable: Visualize your mujoco models and onnx policies quickly.

Quick Start

mjswan can be installed with pip:

pip install mjswan  # or 'mjswan[dev]', 'mjswan[examples]'

or with npm:

npm install mjswan

You can run the demo using the uv command with the python package mjswan[examples]:

uv run main

The minimum python script for a sanity check:

import os, mujoco, mjswan

model_path = os.path.join(os.path.dirname(mujoco.__file__), "testdata", "model.xml")
mjspec = mujoco.MjSpec.from_file(model_path)

builder = mjswan.Builder()
builder.add_project(name="Sanity Check").add_scene(name="Humanoid", spec=mjspec)
app = builder.build()
app.launch()

For detailed instructions, visit the documentation.

Third-Party Assets

mjswan incorporates mujoco models from the external sources in its demo. See the respective submodule for full details, including individual model licenses and copyrights. All models are used under their respective licenses. Please review and comply with those terms for any use or redistribution.

Robot Descriptions LicenseMuJoCo Playground LicenseMyoSuite License

Acknowledgments

This project was greatly inspired by the Facet project demo from the research group at Tsinghua University.
It is also built upon the excellent work of zalo/mujoco_wasm, one of the earliest efforts to run MuJoCo simulations in a browser.

License

This project is licensed under the Apache-2.0 License. When using mjswan, please retain attribution notices in the app to help other users discover this project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mjswan-0.4.3.tar.gz (9.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mjswan-0.4.3-py3-none-any.whl (9.8 MB view details)

Uploaded Python 3

File details

Details for the file mjswan-0.4.3.tar.gz.

File metadata

  • Download URL: mjswan-0.4.3.tar.gz
  • Upload date:
  • Size: 9.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mjswan-0.4.3.tar.gz
Algorithm Hash digest
SHA256 ed227222bec558f9dbc5e892ac1382ad8e82d0cc4bfe05e92b39f3aeba561196
MD5 a8af4cf7a47a9c6dce38d3ebf73930df
BLAKE2b-256 d750970241912d3cde25819a0af80be0785a9f514d5ab7e8c2fc05b3281c2955

See more details on using hashes here.

File details

Details for the file mjswan-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: mjswan-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 9.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mjswan-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b6dca285075b4229c4a7bf51f92127db0c6f2a6bb93dd1b1a66360eb7cb1621a
MD5 66e1fb92d71e4624d46af30f29d65423
BLAKE2b-256 f02e1fbb4e585dc4ce5676be35d06535f9beb68662ac3293a1de52121f37dfbe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page