Skip to content

Vector-Wangel/MuJoCo-GS-Web

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

367 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Load and Run MuJoCo 3.3.8 Models using JavaScript and the official MuJoCo WebAssembly Bindings.

Features

  • MuJoCo 3.3.8 WebAssembly: MuJoCo running entirely in the browser, works on any devices, even your phone.

  • Hybrid Rendering: Combine MuJoCo with photorealistic 3D Gaussian Splatting scenes, with physics objects correctly occlude and interact with 3DGS environments

  • Toggle Mode: Switch between pure physics rendering and hybrid 3DGS+physics mode

  • Mouse Interaction: Click and drag any physics object in the scene

  • Keyboard teleop: End-effector teleop controller for SO101 (analytical) and Franka Panda (numerical, SGD)

  • RL policy: Run 10+ pretrained policies on Unitree G1

  • Import any robot: By uploading the whole folder

    • The folder should only contain a single .xml, along with /assets folder
    • Find available robots at MuJoCo Menagerie)
image
  • Import any scene: use any 3DGS scene you want
    • .spz file, recommend: Marble from World Labs
    • If you only upload the .spz file, there will not be any collision other than the floor
    • You can add a 3DGS scene along with an .xml file for collision setup
image

Easiest way to find collision boxes' coordinate: adding boxes in the studio in Marble and give the bounding boxes info to AI to generate a collision.xml

image

πŸ€– Supported Robots (& keyboard control)

XLeRobot - Dual-Arm Mobile Manipulator

  • DOF: 2 (base) + 10 (dual 5-DOF arms) + 2 (grippers) + 2 (head)
  • Control Method: Inverse kinematics with keyboard teleoperation
  • Actuators: STS3215 servos (SO-Arm101 specification)
  • Keyboard Mapping:
    • Base: W/S (forward/backward), A/D (turn)
    • Left arm: 7/Y (rotation), 8/U (EE Y), 9/I (EE X), 0/O (pitch), -/P (wrist roll)
    • Right arm: H/N (rotation), J/M (EE Y), K/, (EE X), L/. (pitch), ;// (wrist roll)
    • Grippers: V (left), B (right)
    • Head: R/T (pan), F/G (tilt)
    • Reset: X

SO101 - Single-Arm Manipulator

  • DOF: 6 (shoulder rotation, shoulder pitch, elbow, wrist pitch, wrist roll, gripper)
  • Control Method: 2-link inverse kinematics
  • Actuators: STS3215 servos with high-precision position control
  • Keyboard Mapping:
    • Shoulder: A/D (rotation)
    • End effector: W/S (Y axis), Q/E (X axis)
    • Orientation: R/F (pitch adjustment)
    • Wrist: Z/C (roll)
    • Gripper: V (toggle)
    • Reset: X

Franka Emika Panda - 7-DOF Research Arm

  • DOF: 7 (redundant arm) + 2 (parallel gripper)
  • Control Method: Damped Least Squares inverse kinematics with gravity compensation
  • Special Features:
    • 6-DOF pose control (position + orientation)
    • Adaptive damping for stability
    • Multi-iteration IK solver
    • High-force gripper (100N)
  • Keyboard Mapping:
    • Position: W/S (X), A/D (Y), Q/E (Z)
    • Orientation: Z/C (roll), R/F (pitch), T/G (yaw)
    • Gripper: V (open), B (close)
    • Reset: X

Humanoid

  • DOF: Full humanoid with torso, arms, and legs
  • Control Method: Joint-level PD control
  • Interaction: Mouse drag support for direct manipulation

JavaScript API

import load_mujoco from "./dist/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/humanoid.xml", await (await fetch("./assets/scenes/humanoid.xml")).text());

// Load model and create data
let model = mujoco.MjModel.loadFromXML("/working/humanoid.xml");
let data  = new mujoco.MjData(model);

// Access model properties directly
let timestep = model.opt.timestep;
let nbody = model.nbody;

// Access data buffers (typed arrays)
let qpos = data.qpos;  // Joint positions
let qvel = data.qvel;  // Joint velocities
let ctrl = data.ctrl;  // Control inputs
let xpos = data.xpos;  // Body positions

// Step the simulation
mujoco.mj_step(model, data);

// Run forward kinematics
mujoco.mj_forward(model, data);

// Reset simulation
mujoco.mj_resetData(model, data);

// Apply forces (force, torque, point, body, qfrc_target)
mujoco.mj_applyFT(model, data, [fx, fy, fz], [tx, ty, tz], [px, py, pz], bodyId, data.qfrc_applied);

// Clean up
data.delete();
model.delete();

πŸ™ Acknowledgements

This project is built based on mujoco-wasm, sparkjs, and human policy viewer.

About

Simulate and Render MuJoCo in the Browser with 3DGS.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 97.8%
  • HTML 2.2%