https://github.com/ttktjmt/mjswan
MuJoco Simulation on Web Assembly with Neural netwroks
https://github.com/ttktjmt/mjswan
mjlab mjswan mujoco mujoco-wasm onnx reinforcement-learning robotics
Last synced: 2 months ago
JSON representation
MuJoco Simulation on Web Assembly with Neural netwroks
- Host: GitHub
- URL: https://github.com/ttktjmt/mjswan
- Owner: ttktjmt
- License: apache-2.0
- Created: 2025-08-13T13:17:39.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2026-02-21T16:46:28.000Z (4 months ago)
- Last Synced: 2026-02-21T20:48:58.062Z (4 months ago)
- Topics: mjlab, mjswan, mujoco, mujoco-wasm, onnx, reinforcement-learning, robotics
- Language: Python
- Homepage: https://ttktjmt.github.io/mjswan/
- Size: 1.4 GB
- Stars: 120
- Watchers: 2
- Forks: 18
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
Real-time Interactive AI Robot Simulation in Your Browser
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
---
## 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`:
``` sh
pip install mjswan # or 'mjswan[dev]', 'mjswan[examples]'
```
or with `npm`:
``` sh
npm install mjswan
```
You can run the demo using the `uv` command with the python package `mjswan[examples]`:
``` sh
uv run main
```
The minimum python script for a sanity check:
``` python
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](https://mjswan.readthedocs.io).
## 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 License](https://github.com/robot-descriptions/robot_descriptions.py/blob/main/LICENSE) ・ [MuJoCo Playground License](https://github.com/google-deepmind/mujoco_playground/blob/main/LICENSE) ・ [MyoSuite License](https://github.com/MyoHub/myosuite/blob/main/LICENSE)
## Acknowledgments
This project was greatly inspired by the [Facet project demo](https://facet.pages.dev/) from the research group at Tsinghua University.
It is also built upon the excellent work of [zalo/mujoco_wasm](https://github.com/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](LICENSE). When using mjswan, please retain attribution notices in the app to help other users discover this project.
