File size: 2,240 Bytes
094478c c8f39b4 094478c c8f39b4 9f9cc1c c8f39b4 68e86d4 c8f39b4 04f936c 68e86d4 04f936c bb90cc7 c8f39b4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | ---
title: Microduck Sandbox
emoji: 🐤
colorFrom: yellow
colorTo: gray
sdk: static
pinned: false
---
# Microduck RL playground
Real trained RL policies for the Microduck robot, running fully in the
browser: MuJoCo compiled to WebAssembly steps the physics, onnxruntime-web
runs the policy network at 50 Hz. No server, no backend.
## Policies
| Button | Checkpoint | What it does |
|--------|-----------|--------------|
| Run | `BEST_alpha_walking.onnx` | Velocity-tracking locomotion (arrows / WASD to steer) |
| Sit | `BEST_alpha_sitstand.onnx` | Sits down on its hull, stands back up |
| Roll | `roulade.onnx` | Rolls over and recovers |
Policies and MJCF model from
[apirrone/microduck_runtime](https://github.com/apirrone/microduck_runtime)
and [apirrone/mjlab_microduck](https://github.com/apirrone/mjlab_microduck).
## Controls
- Arrow up / down: forward / back
- Arrow left / right: turn
- A / E: strafe
- Space: roll (one barrel roll, then back to running)
- R: reset
- Drag to orbit, scroll to zoom
- Colour dots: repaint the duck (it quacks)
### Gamepad
Plug in a controller and the same mapping as the real robot runtime applies:
- Left stick: forward / back + strafe
- Right stick: turn
- X: roll
- D-pad down: sit / stand toggle
- Right trigger: mouth (analog) + quack
## Multiplayer ghosts
Other people visiting the Space at the same time show up as translucent
ducks, live. Peer-to-peer WebRTC via [Trystero](https://github.com/dmotz/trystero)
(serverless signaling over public Nostr relays), so it works from a static
Space with no backend. Each tab broadcasts its duck's pose (trunk + 14
joints + jaw + colour) at 10 Hz; up to 3 ghosts are rendered, extra peers
stay connected but invisible. The header shows "N online" when peers are
around.
## How it works
- `rl.js` fetches the MJCF (`robot_allcollisions.xml`), strips the visual
geoms, injects a floor and a STAND keyframe, and compiles it with the
official `@mujoco/mujoco` WASM bindings.
- The 61D observation (gyro, projected gravity, joint pos/vel, last action,
command) matches `mjlab_microduck/scripts/infer_policy.py`.
- Rendering is a three.js rig built from `kinematics.json` + decimated STL
meshes, driven directly from MuJoCo `qpos`.
|