File size: 3,512 Bytes
11c954b
4055d08
49ef597
 
 
11c954b
49ef597
 
 
4055d08
49ef597
 
 
 
 
 
 
11c954b
 
4055d08
49ef597
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4055d08
49ef597
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
---
title: CablePilot
emoji: 🦢
colorFrom: yellow
colorTo: green
sdk: static
pinned: true
license: apache-2.0
short_description: A cable robot plans with a 28k-param world model, live
thumbnail: https://huggingface.co/spaces/MacroSwan/CablePilot/resolve/main/thumbnail.png
tags:
  - robotics
  - world-model
  - model-predictive-control
  - mppi
  - cable-robot
  - embodied-ai
---

# CablePilot: clear the playroom

A cable robot hangs from four lines in a playroom. Every 0.2 s it imagines 128 futures with a small learned world model
and follows the cheapest. **Furniture is only a cost**: drag it around and watch the plans bend.

- **Click the floor** to drop a toy. The robot flies over it, reaches down, grabs it and drops it in the hamper.
- **Drag furniture**, resize it, or add more. Purple patches on the floor are **line shadows**: places a cable would
  have to cut through furniture to reach, so the robot cannot pick there. Push a tall shelf around and watch them move.
- **Watch it think**: the ember line is the plan it chose, the green lines are the best futures it imagined, and the
  panel shows what each decision costs (milliseconds, futures per CPU-second, CPU-seconds per toy) and which cost
  terms shaped the plan.

Everything runs in your browser on one CPU thread. There is no server and no GPU.

## What is real here

| | |
|---|---|
| **World model** | The released [MacroSwan/cablepilot](https://huggingface.co/MacroSwan/cablepilot) model: 28,401 parameters, trained on our own simulated motion ([MacroSwan/cablepilot-motion](https://huggingface.co/datasets/MacroSwan/cablepilot-motion)), ported to JavaScript. It matches PyTorch to 0.0005 mm (`tools/test.mjs`). |
| **Planner** | MPPI, ported from `cablepilot/planner/mppi.py` with the same settings. |
| **Furniture** | Reaches the planner only as costs: clearance of spheres down the robot's pole and of points along the four lines, as in `cablepilot/roommap/costs.py`. |
| **Robot** | Simulated by the same world model plus noise. Against the MuJoCo twin the model is off by about 2 cm over 2 s, and a real robot would differ more. |
| **Room** | Fictional: 4.6 × 4.0 m, line anchors in the corners at about 2.5 m. The floor is drawn in code. |

Grasping is a distance test, not contact physics.

## Files

| file | what |
|---|---|
| `core/model.js` | the world model in plain JS |
| `core/mppi.js` | MPPI |
| `core/mission.js` | the room, furniture costs, the line-shadow map, the pick and carry phases, the simulated robot |
| `worker.js` | runs the robot's brain off the page's thread |
| `main.js`, `index.html`, `style.css` | the 3D page (three.js r170, vendored) |
| `tools/export_model.py` | the cablepilot weights → `core/model.json`, plus PyTorch test fixtures |
| `tools/test.mjs` | the JS model against PyTorch |
| `tools/run_headless.mjs` | the whole mission in node: 5/5 toys, 0 furniture contacts, about 210 s of robot time |

```bash
node tools/test.mjs && node tools/run_headless.mjs 400
python3 -m http.server 8767        # then http://127.0.0.1:8767/?autorun&speed=4&follow
```

The pilots: [CablePilot](https://huggingface.co/spaces/MacroSwan/CablePilot) (a cable robot clears a playroom) · [DronePilot](https://huggingface.co/spaces/MacroSwan/DronePilot) (a quadrotor flies your task card) · [ArmPilot](https://huggingface.co/spaces/MacroSwan/ArmPilot) (an SO-101 puts a pen in a cup).
Part of [MacroSwan](https://huggingface.co/MacroSwan): small world models and planning, with their compute bill.