<p align="center">
<img src="assets/banner.svg" alt="mjswan" width="60%">
</p>
<p align="center">
<strong><em>Real-time Interactive AI Robot Simulation in Your Browser</em></strong>
</p>
<p align="center">
<a href="https://github.com/ttktjmt/mjswan/actions/workflows/deploy.yml"><img src="https://github.com/ttktjmt/mjswan/actions/workflows/deploy.yml/badge.svg" alt="deploy"/></a>
<a href="https://github.com/ttktjmt/mjswan/actions/workflows/pytest.yml"><img src="https://github.com/ttktjmt/mjswan/actions/workflows/pytest.yml/badge.svg" alt="test"/></a>
<a href="https://mjswan.readthedocs.io"><img src="https://img.shields.io/readthedocs/mjswan?logo=readthedocs" alt="docs"/></a>
<a href="https://pypi.org/project/mjswan"><img src="https://img.shields.io/pypi/v/mjswan.svg?logo=pypi" alt="pypi version"></a>
<a href="https://www.npmjs.com/package/mjswan"><img src="https://img.shields.io/npm/v/mjswan.svg?logo=nodedotjs" alt="npm version"></a>
</p>
<p align="center">
mjswan is a powerful framework for creating interactive MuJoCo simulations with real-time policy control, running entirely in the browser. Built on top of <a href="https://github.com/google-deepmind/mujoco/tree/main/wasm">mujoco wasm</a>, <a href="https://github.com/microsoft/onnxruntime">onnxruntime</a>, and <a href="https://github.com/mrdoob/three.js/">three.js</a>, it enables easy sharing of AI robot simulation demos as static sites, perfect for GitHub Pages hosting.
</p>
<p align="center">
<a href="https://ttktjmt.github.io/mjswan/"><img src="assets/demo.gif" width="70%"/></a>
</p>
<p align="center">
<em>Check out the demo ― <a href="https://ttktjmt.github.io/mjswan/">ttktjmt.github.io/mjswan</a></em>
</p>
<p align="center">
<a href="https://ttktjmt.github.io/mjswan/robotdesc"><img src="https://img.shields.io/badge/Robot_Descriptions-E0E0E0?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAACYUlEQVR4nHyS208TQRjFv5nd7mW2205JQSExjVwfEEQxoon+q/4DRiKRlhTiLTGxNZK0gA8QLUZpbGtppLvd2es3ZlsfePI8/V7OzDknH5VS9vqXB6/fhGEkrylJkutcr9cnTAHgy/FRJpMJw7DdbjcajUqlAgB+ELx7/qxafpUkMSJqmlatVgEgNXysf7p3d900meM4p6enCwsL/X5/cHlJbyyurK6dn3+nlG5sbBiGAelLvl+r1cb/yv9EklK2Wi0pJRmJ4GroKJQwyyIA3W5XeN7t+XlE6fZ/6aal23lEiZj4QmRtmxJChkM3SSQZy/NGVKETbr7d+7C/O2HfF67rEEJUADANHUDCWLado5ROOF9a4sWZYa+dLc6ZJkviOC2dxqKgaZlJ3NxYE15cfwBaVuczUsogCBDHs2oqLdiMYmhqumXqo85F5A2ZoZm6Gvpi7uY0t5mpqzxn2VnGDI2qqkoV9c/VcBKjfVQ7OdjBJBFCdDqds7OzwWCQ9mkevdjeBoC0A6VUzWQISQ285lcJECCEMVYocM55oVBAxKXlFaKZAEDiOEGJvhCGaVECo5FLAJiVRYlhEKoZVVVUlBhFkfAE51wNovhH5/cMt2kcB0Ls7Lw0DOPh1pZFlff7VRPk8pOnucJU69vXi58Xd9bW0gWFH/hCAEAYRfc3N6WUum70et2DvUq5XK7slhVFOTz8nOd5xhjx/PDk+MRxnK3Hj0DKMAyDILAsq9vpzs7NNpuNUqnE+ZTnjVzXKRanU4PruoiYtW0CQAhBREopokySOIoixhiiBPh3Cn8DAAD//3KKiEEyOiLAAAAAAElFTkSuQmCC" alt="Robot Descriptions Demo"></a>
<a href="https://ttktjmt.github.io/mjswan/playground"><img src="https://img.shields.io/badge/MuJoCo_Playground-E0E0E0?logo=deepmind" alt="MuJoCo Playground Demo"></a>
<a href="https://ttktjmt.github.io/mjswan/myosuite"><img src="https://img.shields.io/badge/MyoSuite-E0E0E0?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PGRlZnM+PHN0eWxlPi5jbHMtMXtmaWxsOiMxNTUyNTc7fS5jbHMtMntmaWxsOiNlNmY1ZjA7fTwvc3R5bGU+P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XNzPSJjbHMtMSIgZD0iTTIyLDUuNTJhMy42MSwzLjYxLDAsMCwwLS4xNy0yLjcyLDMuNTUsMy41NSwwLDAsMC0zLjIxLTJoMEEzLjU3LDMuNTcsMCwxLDAsMjIsNS41MloiLz48L2c+PC9zdmc+" alt="MyoSuite Demo"></a>
</p>
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
For detailed installation 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.
MyoSuite License ・ robot_descriptions.py License ・ MuJoCo Playground License
Acknowledgments
This project was greatly inspired by the Facet project demo from the research group at Tsinghua University.<br>
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.