File size: 2,914 Bytes
31a02b4
 
7aeb58b
 
 
31a02b4
 
7aeb58b
7c5820a
 
 
7aeb58b
 
 
 
 
 
 
 
 
 
 
c8be8af
7aeb58b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
title: Mini Fleet
emoji: 🤖
colorFrom: yellow
colorTo: gray
sdk: static
pinned: false
short_description: Dashboard and one-tap reset for many Reachy Minis
tags:
 - reachy_mini
 - reachy_mini_python_app
 - fleet
 - classroom
---

# Mini Fleet

A teacher's view of a room full of Reachy Minis. It shows which robots are online, their daemon version,
current app, motor state and installed apps. One button returns every robot to a known state.

Built and tested against **simulated robots only** (`reachy-mini-daemon --mockup-sim`, SDK 1.14.0).
I don't have hardware yet.
By [Jonathan Beri](https://huggingface.co/jonathanberi).

## Two ways to run it

**As a robot app.** Install it from the Reachy Mini dashboard and open the app's page (port 8042).
The host robot nods when a fleet reset succeeds and shakes its head if one fails. Fleet actions skip the host,
so it never stops itself.

**On a laptop, without tying up a robot:**

```bash
uv pip install reachy-mini "git+https://huggingface.co/spaces/jonathanberi/mini_fleet"
mini-fleet --robot 192.168.1.20 --robot reachy-mini.local --open
```

The robot list is saved to `~/.config/mini_fleet/robots.json`.

## Try it with simulated robots

```bash
scripts/sim_fleet.sh start 3     # sim-1..3 on localhost:8000-8002
mini-fleet --robot localhost:8000 --robot localhost:8001 --robot localhost:8002 --open
scripts/sim_fleet.sh stop
```

On one machine, apps launched by any of these daemons connect to the daemon on `:8000`.
Daemons started from the same venv also share installed apps.

## What "reset to known state" does

1. Stop the current app, if one is running
2. `goto_sleep` and wait for the move to finish (this disables the motors)
3. Re-enable the motors (`wake_up` over REST does not)
4. `wake_up` and wait
5. Optionally start a baseline app, chosen in the dashboard

## How it works

Everything runs server-side with `httpx` against each robot's daemon REST API:
`/api/daemon/status`, `/api/apps/*`, `/api/move/*`, `/api/motors/*`.
A browser page can't do this itself. The daemon only allows cross-origin reads from localhost and rejects
cross-origin state-changing requests. The dashboard page talks only to Mini Fleet's own backend.
Actions are limited to robots on your list, and app names are validated before they go into a URL.

| File | What |
|---|---|
| `mini_fleet/fleet.py` | Polling, reset sequence, actions (no web framework dependency) |
| `mini_fleet/api.py` | `/api/fleet` routes, shared by both modes |
| `mini_fleet/main.py` | `ReachyMiniApp` wrapper and host-robot gestures |
| `mini_fleet/cli.py` | `mini-fleet` laptop command |
| `mini_fleet/static/` | Dashboard page (plain HTML/JS, no build step) |
| `scripts/sim_fleet.sh` | Start and stop N simulated daemons |

## Next

- mDNS discovery of `reachy-mini.local` robots
- Update apps across the fleet via `/api/apps/check-updates`
- Test on real Lite and Wireless robots