|
| 1 | +--- |
| 2 | +title: (Optional) Extend the project |
| 3 | +weight: 7 |
| 4 | + |
| 5 | +### FIXED, DO NOT MODIFY |
| 6 | +layout: learningpathall |
| 7 | +--- |
| 8 | + |
| 9 | +## Try focused changes |
| 10 | + |
| 11 | +You now have a working physical AI pattern: sensor input at the edge, local |
| 12 | +inference, robot commands, and a dashboard for visibility. A good next step is |
| 13 | +to make small changes where the effect is easy to observe: |
| 14 | + |
| 15 | +- Change `VERDICT_MIN_CONFIDENCE` in `main.py` to make thumbs detection |
| 16 | + stricter or more forgiving. |
| 17 | +- Change `MOVE_REPETITIONS` in `main.py` so each move plays more or fewer |
| 18 | + times. |
| 19 | +- Add a fifth move in `moves.py` and register it in `MOVE_CATALOGUE`. |
| 20 | +- Try a different webcam with `REACHY_GLADIATOR_CAMERA_INDEX=1`. |
| 21 | + |
| 22 | +These changes are deliberately small. They help you learn which part of the |
| 23 | +system owns each behavior before you make larger changes to perception, robot |
| 24 | +motion, or packaging. |
| 25 | + |
| 26 | +## Change the classifier |
| 27 | + |
| 28 | +Trying adding new gesture controls. Start in `gesture.py`, where the app maps MediaPipe labels such as `Thumb_Up` and `Thumb_Down` to app labels. Then add matching robot behavior in `moves.py` and branch on the new label in `main.py`. |
| 29 | + |
| 30 | +Some game-themed ideas: |
| 31 | + |
| 32 | +- Map `Closed_Fist` to `challenge`, and make Reachy repeat the current move |
| 33 | +- Map `Pointing_Up` to `reroll`, and make Reachy reject the current move and |
| 34 | + choose another one. |
| 35 | +- Map `Number of fingers` to choosing a specific move. |
| 36 | + |
| 37 | +## Add audio output |
| 38 | + |
| 39 | +The gladiator theme is a good fit for sound. Try adding audio cues such as: |
| 40 | + |
| 41 | +- a crowd cheer during victory, |
| 42 | +- a dramatic sound during defeat, |
| 43 | +- a short drum hit before each move, |
| 44 | +- a spoken move name before Reachy performs it. |
| 45 | + |
| 46 | +Keep audio output separate from `moves.py` at first. For example, create an |
| 47 | +`audio.py` helper and call it from `main.py` when the state changes. This keeps |
| 48 | +robot motion and sound effects easy to change independently. |
| 49 | + |
| 50 | +## Replace thumbs with audio input |
| 51 | + |
| 52 | +The vision-based verdict is one edge AI input modality. You can replace |
| 53 | +or complement it with audio - many webcams include microphones or you can use a USB microphone. |
| 54 | + |
| 55 | +- say "yes" for victory and "no" for defeat, |
| 56 | +- clap once for victory and twice for defeat, |
| 57 | + |
| 58 | +A lightweight keyword-spotting model can map spoken commands to the same game states currently triggered by MediaPipe gestures. |
| 59 | + |
| 60 | +## Try the packaged app on a physical Reachy |
| 61 | + |
| 62 | +If you have a physical Reachy Mini, the quickest way to try the finished |
| 63 | +experience is to install the packaged [Reachy Gladiator app](https://huggingface.co/spaces/cossinsmatthew/reachy_gladiator) through the [Reachy Mini Control app](https://github.com/pollen-robotics/reachy-mini-desktop-app). |
| 64 | + |
| 65 | +Simply install Reachy Mini Control on a supported machine, connected to your Reachy, and search for the reachy gladiator app. |
| 66 | + |
| 67 | +{{% notice Warning %}} |
| 68 | +If using a physical Reachy Mini, use caution and ensure the robot is used in an area with appropriate space. The robot has moving parts and could be a health & safety risk. You are responsible for your safety and the safety of others around you when using physical robotic devices |
| 69 | +{{% /notice %}} |
| 70 | + |
| 71 | +## Adapt this source project for physical Reachy |
| 72 | + |
| 73 | +The main learning path uses the Raspberry Pi USB webcam for perception and a |
| 74 | +remote MuJoCo daemon for robot motion. A physical Reachy route changes two |
| 75 | +things: |
| 76 | + |
| 77 | +- camera frames come from the Reachy daemon instead of the Pi USB webcam, |
| 78 | +- the Pi app connects to the physical Reachy daemon instead of the simulation |
| 79 | + daemon. |
| 80 | + |
| 81 | +The source project exposes these switches as environment variables, so you do |
| 82 | +not need to edit the Python source: |
| 83 | + |
| 84 | +```bash |
| 85 | +REACHY_GLADIATOR_MEDIA_BACKEND=reachy \ |
| 86 | +REACHY_GLADIATOR_CAMERA=reachy \ |
| 87 | +REACHY_GLADIATOR_DAEMON_PORT=8000 \ |
| 88 | +./scripts/run_pi_app.sh localhost |
| 89 | +``` |
| 90 | + |
| 91 | +Use `localhost` only when the physical daemon runs on the same Pi as the app. |
| 92 | +If the daemon runs on another machine, replace `localhost` with that machine's |
| 93 | +IP address and set `REACHY_GLADIATOR_DAEMON_PORT` to the daemon port. |
| 94 | + |
| 95 | +These variables map to the code in two places: |
| 96 | + |
| 97 | +- `REACHY_GLADIATOR_MEDIA_BACKEND=reachy` lets `ReachyMiniApp` request daemon |
| 98 | + camera media. |
| 99 | +- `REACHY_GLADIATOR_CAMERA=reachy` tells `camera.py` to use |
| 100 | + `ReachyMediaFrameSource` instead of `OpenCVCameraFrameSource`. |
| 101 | + |
| 102 | +## Build your own Reachy Mini app |
| 103 | + |
| 104 | +A Reachy Mini app is a Python package with a class that inherits from `ReachyMiniApp`, implements `run()`, and exposes an entry point in `pyproject.toml`. |
| 105 | + |
| 106 | +To build a fresh app: |
| 107 | + |
| 108 | +1. Start with one `ReachyMiniApp` class. |
| 109 | +2. Add one safe motion such as `neutral()`. |
| 110 | +3. Add one input source such as a camera gesture, audio command, button, or web |
| 111 | + endpoint. |
| 112 | +4. Add a dashboard only after the core loop works. |
| 113 | +5. Test in simulation before physical hardware. |
| 114 | +6. Package the app when it is stable enough for repeated use. |
| 115 | + |
| 116 | +The Reachy Mini tooling can scaffold and validate a shareable app: |
| 117 | + |
| 118 | +```bash |
| 119 | +reachy-mini-app-assistant create my_app ~/reachy_projects |
| 120 | +reachy-mini-app-assistant check ~/reachy_projects/my_app |
| 121 | +``` |
| 122 | + |
| 123 | +The [Reachy Mini app publishing guide](https://huggingface.co/blog/pollen-robotics/make-and-publish-your-reachy-mini-apps) |
| 124 | +explains the packaging and publishing workflow in more detail. |
| 125 | + |
| 126 | +Use the Reachy Mini SDK documentation and examples to understand available |
| 127 | +motion, media, and daemon APIs. If you use an AI coding agent, give it the |
| 128 | +Pollen Robotics `AGENTS.md` instructions, provided by the [Reachy Mini project](https://github.com/pollen-robotics/reachy_mini) so it follows the expected app structure. |
| 129 | + |
| 130 | +## What you learned |
| 131 | + |
| 132 | +You explored options for extending from simulation to a physical Reachy, as well ideas for changing the project to include audio, new vision gestures, or different behaviours. |
0 commit comments