Skip to content

idiap/mujoco_wasm3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MuJoCo-wasm3

Load and Run MuJoCo 3.2.6 Models using JavaScript and WebAssembly.

This repo is a fork of @zalo 's repository, updated to MuJoCo 3.2.6.

Building

1. Install emscripten

2. Build the mujoco_wasm Binary

On Linux, use:

mkdir build
cd build
emcmake cmake ..
make

On Windows, run build_windows.bat.

JavaScript API

import load_mujoco from "./mujoco_wasm.js";

// Load the MuJoCo Module
const mujoco = await load_mujoco();

// Set up Emscripten's Virtual File System
mujoco.FS.mkdir('/working');
mujoco.FS.mount(mujoco.MEMFS, { root: '.' }, '/working');
mujoco.FS.writeFile("/working/scene.xml", await (await fetch("url/to/your/mujoco/scene.xml")).text());

// Load in the state from XML
let model       = new mujoco.Model("/working/scene.xml");
let state       = new mujoco.State(model);
let simulation  = new mujoco.Simulation(model, state);

Typescript definitions are available.

About

Simulate and Render MuJoCo Models in the Browser!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 93.6%
  • Python 5.2%
  • Other 1.2%