# pollen-robotics/microduck architecture

> Architecture diagram of the GitHub repository pollen-robotics/microduck, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pollen-robotics/microduck
- Repository: https://github.com/pollen-robotics/microduck

## Overview

Microduck is the runtime for a small biped robot: daemons provide control, sensing, connectivity, camera media, configuration, and reversible updates, with command-line and gamepad clients. The principal path is gamepad input through shared mapping to robotd’s intent/control loop and motor bus. The README documents other major services and capabilities retained here. Unsampled subsystems and cross-daemon socket wiring are shown only where the README supports them; unsupported internal calls are omitted.

Main entry points: [`robotd/src/main.rs`](https://github.com/pollen-robotics/microduck/blob/main/robotd/src/main.rs) (Control daemon), [`duck-ipc-proto/src/lib.rs`](https://github.com/pollen-robotics/microduck/blob/main/duck-ipc-proto/src/lib.rs) (JSON-RPC contract), [`mediad/src/pipeline.rs`](https://github.com/pollen-robotics/microduck/blob/main/mediad/src/pipeline.rs) (Media pipeline), [`padd/src/main.rs`](https://github.com/pollen-robotics/microduck/blob/main/padd/src/main.rs) (Gamepad daemon)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Robot control"]
  node_robotd["Control daemon<br/>[main.rs]"]
  node_params["Control parameters<br/>[edit.rs]"]
  node_policies["Policy inference<br/>[onnx.rs]"]
  node_kinematics["Robot kinematics<br/>[lib.rs]"]
  node_servos["Servo bus<br/>[bus.rs]"]
  node_sound["Sound generation<br/>[synth.rs]"]
end

subgraph group_sensing["Sensing and media"]
  node_tofd["Depth daemon<br/>[main.rs]"]
  node_camera["Camera capture<br/>[camera.rs]"]
  node_media["Media pipeline<br/>[pipeline.rs]"]
  node_mediaroute["Media routing<br/>[route.rs]"]
end

subgraph group_connectivity["Connectivity and input"]
  node_padd["Gamepad daemon<br/>[main.rs]"]
  node_padmap["Pad mapping<br/>[mapper.rs]"]
  node_netpadd["UDP pad daemon<br/>[main.rs]"]
  node_btd["Bluetooth daemon<br/>[session.rs]"]
  node_duckctl["Remote control CLI<br/>[main.rs]"]
end

subgraph group_operations["Configuration and updates"]
  node_configd["System configuration<br/>[main.rs]"]
  node_updater["Update engine<br/>[engine.rs]"]
  node_robotctl["Robot CLI<br/>[main.rs]"]
end

node_operator(("Operator"))
node_gamepad(("Gamepad"))
node_ipc["JSON-RPC contract<br/>[lib.rs]"]

node_operator -->|"uses"| node_gamepad
node_gamepad -->|"provides input"| node_padd
node_padd -->|"maps controls"| node_padmap
node_padmap -->|"sends intents"| node_robotd
node_netpadd -->|"sends intents"| node_robotd
node_robotd -->|"drives motors"| node_servos
node_robotd -->|"runs policies"| node_policies
node_robotd -.->|"loads parameters"| node_params
node_robotd -.->|"uses geometry"| node_kinematics
node_robotd -.->|"generates sound"| node_sound
node_tofd -->|"publishes frames"| node_ipc
node_camera -.->|"provides frames"| node_media
node_media -->|"routes streams"| node_mediaroute
node_operator -->|"operates robot"| node_robotctl
node_robotctl -->|"sends RPC"| node_ipc
node_btd -->|"serves calls"| node_ipc
node_duckctl -->|"connects over Bluetooth"| node_btd
node_configd -->|"serves RPC"| node_ipc
node_updater -->|"health gates"| node_robotd
node_operator -->|"requests updates"| node_updater

click node_padd "https://github.com/pollen-robotics/microduck/blob/main/padd/src/main.rs"
click node_padmap "https://github.com/pollen-robotics/microduck/blob/main/pad-map/src/mapper.rs"
click node_netpadd "https://github.com/pollen-robotics/microduck/blob/main/netpadd/src/main.rs"
click node_robotd "https://github.com/pollen-robotics/microduck/blob/main/robotd/src/main.rs"
click node_params "https://github.com/pollen-robotics/microduck/blob/main/robotd-params/src/edit.rs"
click node_policies "https://github.com/pollen-robotics/microduck/blob/main/duck-detect/src/onnx.rs"
click node_kinematics "https://github.com/pollen-robotics/microduck/blob/main/kinematics/src/lib.rs"
click node_servos "https://github.com/pollen-robotics/microduck/blob/main/duck-control/src/bus.rs"
click node_tofd "https://github.com/pollen-robotics/microduck/blob/main/tof/src/main.rs"
click node_camera "https://github.com/pollen-robotics/microduck/blob/main/mediad/src/camera.rs"
click node_media "https://github.com/pollen-robotics/microduck/blob/main/mediad/src/pipeline.rs"
click node_mediaroute "https://github.com/pollen-robotics/microduck/blob/main/mediad/src/route.rs"
click node_configd "https://github.com/pollen-robotics/microduck/blob/main/configd/src/main.rs"
click node_updater "https://github.com/pollen-robotics/microduck/blob/main/updater/src/engine.rs"
click node_robotctl "https://github.com/pollen-robotics/microduck/blob/main/robotctl/src/main.rs"
click node_btd "https://github.com/pollen-robotics/microduck/blob/main/btd/src/session.rs"
click node_duckctl "https://github.com/pollen-robotics/microduck/blob/main/duckctl/src/main.rs"
click node_ipc "https://github.com/pollen-robotics/microduck/blob/main/duck-ipc-proto/src/lib.rs"
click node_sound "https://github.com/pollen-robotics/microduck/blob/main/sounds/src/synth.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_robotd,node_params,node_policies,node_kinematics,node_servos,node_sound toneBlue
class node_tofd,node_camera,node_media,node_mediaroute toneAmber
class node_padd,node_padmap,node_netpadd,node_btd,node_duckctl toneMint
class node_configd,node_updater,node_robotctl toneRose
class node_operator,node_gamepad toneIndigo
class node_ipc toneTeal
```

## Components

### Robot control

- [Control daemon](https://github.com/pollen-robotics/microduck/blob/main/robotd/src/main.rs): `robotd/src/main.rs`
- [Control parameters](https://github.com/pollen-robotics/microduck/blob/main/robotd-params/src/edit.rs): `robotd-params/src/edit.rs`
- [Policy inference](https://github.com/pollen-robotics/microduck/blob/main/duck-detect/src/onnx.rs): `duck-detect/src/onnx.rs`
- [Robot kinematics](https://github.com/pollen-robotics/microduck/blob/main/kinematics/src/lib.rs): `kinematics/src/lib.rs`
- [Servo bus](https://github.com/pollen-robotics/microduck/blob/main/duck-control/src/bus.rs): `duck-control/src/bus.rs`
- [Sound generation](https://github.com/pollen-robotics/microduck/blob/main/sounds/src/synth.rs): `sounds/src/synth.rs`

### Sensing and media

- [Depth daemon](https://github.com/pollen-robotics/microduck/blob/main/tof/src/main.rs): `tof/src/main.rs`
- [Camera capture](https://github.com/pollen-robotics/microduck/blob/main/mediad/src/camera.rs): `mediad/src/camera.rs`
- [Media pipeline](https://github.com/pollen-robotics/microduck/blob/main/mediad/src/pipeline.rs): `mediad/src/pipeline.rs`
- [Media routing](https://github.com/pollen-robotics/microduck/blob/main/mediad/src/route.rs): `mediad/src/route.rs`

### Connectivity and input

- [Gamepad daemon](https://github.com/pollen-robotics/microduck/blob/main/padd/src/main.rs): `padd/src/main.rs`
- [Pad mapping](https://github.com/pollen-robotics/microduck/blob/main/pad-map/src/mapper.rs): `pad-map/src/mapper.rs`
- [UDP pad daemon](https://github.com/pollen-robotics/microduck/blob/main/netpadd/src/main.rs): `netpadd/src/main.rs`
- [Bluetooth daemon](https://github.com/pollen-robotics/microduck/blob/main/btd/src/session.rs): `btd/src/session.rs`
- [Remote control CLI](https://github.com/pollen-robotics/microduck/blob/main/duckctl/src/main.rs): `duckctl/src/main.rs`

### Configuration and updates

- [System configuration](https://github.com/pollen-robotics/microduck/blob/main/configd/src/main.rs): `configd/src/main.rs`
- [Update engine](https://github.com/pollen-robotics/microduck/blob/main/updater/src/engine.rs): `updater/src/engine.rs`
- [Robot CLI](https://github.com/pollen-robotics/microduck/blob/main/robotctl/src/main.rs): `robotctl/src/main.rs`

### Other components

- **Operator**
- **Gamepad**
- [JSON-RPC contract](https://github.com/pollen-robotics/microduck/blob/main/duck-ipc-proto/src/lib.rs): `duck-ipc-proto/src/lib.rs`

## Connections

- Operator → Gamepad: uses
- Gamepad → Gamepad daemon: provides input (evidence: `padd/src/main.rs`)
- Gamepad daemon → Pad mapping: maps controls (evidence: `padd/src/main.rs`)
- Pad mapping → Control daemon: sends intents
- UDP pad daemon → Control daemon: sends intents (evidence: `netpadd/src/main.rs`)
- Control daemon → Servo bus: drives motors
- Control daemon → Policy inference: runs policies
- Control daemon → Control parameters: loads parameters
- Control daemon → Robot kinematics: uses geometry
- Control daemon → Sound generation: generates sound
- Depth daemon → JSON-RPC contract: publishes frames (evidence: `tof/src/main.rs`)
- Camera capture → Media pipeline: provides frames
- Media pipeline → Media routing: routes streams (evidence: `mediad/src/pipeline.rs`)
- Operator → Robot CLI: operates robot
- Robot CLI → JSON-RPC contract: sends RPC (evidence: `robotctl/src/main.rs`)
- Bluetooth daemon → JSON-RPC contract: serves calls
- Remote control CLI → Bluetooth daemon: connects over Bluetooth (evidence: `duckctl/src/main.rs`)
- System configuration → JSON-RPC contract: serves RPC
- Update engine → Control daemon: health gates
- Operator → Update engine: requests updates
