# evilbinary/miniduck architecture

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

- Interactive diagram: https://gitdiagram.com/evilbinary/miniduck
- Repository: https://github.com/evilbinary/miniduck

## Overview

miniduck is a bipedal robot platform: a shared robot definition drives simulation assets, Python trains and exports a policy, and yac software is intended to run the policy in a real-robot control loop. The principal workflow runs from robot configuration through generation and simulated PPO training to policy export and deployment. The graph also preserves the physical-modeling and visualization tools. Deployment internals and some mind subsystems are documented but unsampled; those links reflect README statements, not inspected implementation.

Main entry points: [`train/envs/duck_env.py`](https://github.com/evilbinary/miniduck/blob/main/train/envs/duck_env.py) (Stand environment), [`body/robot.yaml`](https://github.com/evilbinary/miniduck/blob/main/body/robot.yaml) (Robot definition), [`mind/robotd`](https://github.com/evilbinary/miniduck/tree/main/mind/robotd) (Robot control loop), [`body`](https://github.com/evilbinary/miniduck/tree/main/body) (URDF / MJCF assets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_body["Robot design"]
  node_robot_config["Robot definition<br/>[robot.yaml]"]
  node_generator["Asset generator<br/>[gen.py]"]
  node_sim_assets["URDF / MJCF assets"]
end

subgraph group_sim["Simulation tools"]
  node_stance_solver["Stance solver<br/>[solve_stance.py]"]
  node_physics_check["Physics checks<br/>[check_physics.py]"]
  node_actuators["Actuator models<br/>[actuators.py]"]
  node_env["Stand environment<br/>[duck_env.py]"]
  node_viewer["Simulation viewer<br/>[view.py]"]
end

subgraph group_train["Training and export"]
  node_spec_loader["Spec parser<br/>[spec_loader.py]"]
  node_ppo["PPO trainer<br/>[train.py]"]
  node_export["Policy exporter<br/>[export.py]"]
  node_policy_artifacts["Policy artifacts"]
end

subgraph group_deploy["On-robot software"]
  node_specs["Behavior specifications"]
  node_robotd["Robot control loop"]
  node_mindd["Intent service"]
  node_updaterd["OTA updater"]
end

node_engineer(("Robot engineer"))
node_robot(("Physical robot"))

node_engineer -->|"defines robot"| node_robot_config
node_robot_config -->|"configures generation"| node_generator
node_generator -->|"generates assets"| node_sim_assets
node_robot_config -->|"supplies geometry"| node_stance_solver
node_sim_assets -->|"simulates stance"| node_stance_solver
node_stance_solver -->|"updates stance pose"| node_robot_config
node_sim_assets -->|"checks physics"| node_physics_check
node_robot_config -->|"checks robot model"| node_physics_check
node_specs -->|"parses specs"| node_spec_loader
node_specs -->|"sets training parameters"| node_ppo
node_specs -->|"defines runtime behavior"| node_robotd
node_robot_config -->|"configures robot model"| node_env
node_spec_loader -->|"provides parsed specs"| node_env
node_env -->|"uses actuator models"| node_actuators
node_env -->|"loads simulation model"| node_sim_assets
node_ppo -->|"collects rollouts"| node_env
node_ppo -->|"reads specs"| node_spec_loader
node_export -->|"reads specs"| node_spec_loader
node_export -->|"writes policy"| node_policy_artifacts
node_export -->|"generates golden frames"| node_env
node_viewer -->|"drives simulation"| node_env
node_policy_artifacts -->|"loads policy blob"| node_robotd
node_robotd -->|"controls at 50 Hz"| node_robot
node_mindd -.->|"provides high-level intent"| node_robotd
node_updaterd -.->|"updates deployed software"| node_robotd

click node_robot_config "https://github.com/evilbinary/miniduck/blob/main/body/robot.yaml"
click node_generator "https://github.com/evilbinary/miniduck/blob/main/body/tools/gen.py"
click node_sim_assets "https://github.com/evilbinary/miniduck/tree/main/body"
click node_stance_solver "https://github.com/evilbinary/miniduck/blob/main/body/tools/solve_stance.py"
click node_physics_check "https://github.com/evilbinary/miniduck/blob/main/body/tools/check_physics.py"
click node_specs "https://github.com/evilbinary/miniduck/tree/main/mind/spec"
click node_spec_loader "https://github.com/evilbinary/miniduck/blob/main/train/envs/spec_loader.py"
click node_actuators "https://github.com/evilbinary/miniduck/blob/main/train/envs/actuators.py"
click node_env "https://github.com/evilbinary/miniduck/blob/main/train/envs/duck_env.py"
click node_ppo "https://github.com/evilbinary/miniduck/blob/main/train/ppo/train.py"
click node_export "https://github.com/evilbinary/miniduck/blob/main/train/export.py"
click node_policy_artifacts "https://github.com/evilbinary/miniduck/tree/main/train"
click node_viewer "https://github.com/evilbinary/miniduck/blob/main/train/scripts/view.py"
click node_robotd "https://github.com/evilbinary/miniduck/tree/main/mind/robotd"
click node_mindd "https://github.com/evilbinary/miniduck/tree/main/mind/mindd"
click node_updaterd "https://github.com/evilbinary/miniduck/tree/main/mind/updaterd"

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_robot_config,node_generator,node_sim_assets toneBlue
class node_stance_solver,node_physics_check,node_actuators,node_env,node_viewer toneAmber
class node_spec_loader,node_ppo,node_export,node_policy_artifacts toneMint
class node_specs,node_robotd,node_mindd,node_updaterd toneRose
class node_engineer,node_robot toneIndigo
```

## Components

### Robot design

- [Robot definition](https://github.com/evilbinary/miniduck/blob/main/body/robot.yaml): `body/robot.yaml`
- [Asset generator](https://github.com/evilbinary/miniduck/blob/main/body/tools/gen.py): `body/tools/gen.py`
- [URDF / MJCF assets](https://github.com/evilbinary/miniduck/tree/main/body): `body`

### Simulation tools

- [Stance solver](https://github.com/evilbinary/miniduck/blob/main/body/tools/solve_stance.py): `body/tools/solve_stance.py`
- [Physics checks](https://github.com/evilbinary/miniduck/blob/main/body/tools/check_physics.py): `body/tools/check_physics.py`
- [Actuator models](https://github.com/evilbinary/miniduck/blob/main/train/envs/actuators.py): `train/envs/actuators.py`
- [Stand environment](https://github.com/evilbinary/miniduck/blob/main/train/envs/duck_env.py): `train/envs/duck_env.py`
- [Simulation viewer](https://github.com/evilbinary/miniduck/blob/main/train/scripts/view.py): `train/scripts/view.py`

### Training and export

- [Spec parser](https://github.com/evilbinary/miniduck/blob/main/train/envs/spec_loader.py): `train/envs/spec_loader.py`
- [PPO trainer](https://github.com/evilbinary/miniduck/blob/main/train/ppo/train.py): `train/ppo/train.py`
- [Policy exporter](https://github.com/evilbinary/miniduck/blob/main/train/export.py): `train/export.py`
- [Policy artifacts](https://github.com/evilbinary/miniduck/tree/main/train): `train`

### On-robot software

- [Behavior specifications](https://github.com/evilbinary/miniduck/tree/main/mind/spec): `mind/spec`
- [Robot control loop](https://github.com/evilbinary/miniduck/tree/main/mind/robotd): `mind/robotd`
- [Intent service](https://github.com/evilbinary/miniduck/tree/main/mind/mindd): `mind/mindd`
- [OTA updater](https://github.com/evilbinary/miniduck/tree/main/mind/updaterd): `mind/updaterd`

### Other components

- **Robot engineer**
- **Physical robot**

## Connections

- Robot engineer → Robot definition: defines robot (evidence: `README.md`)
- Robot definition → Asset generator: configures generation (evidence: `README.md`)
- Asset generator → URDF / MJCF assets: generates assets (evidence: `README.md`)
- Robot definition → Stance solver: supplies geometry (evidence: `README.md`)
- URDF / MJCF assets → Stance solver: simulates stance (evidence: `README.md`)
- Stance solver → Robot definition: updates stance pose (evidence: `README.md`)
- URDF / MJCF assets → Physics checks: checks physics (evidence: `README.md`)
- Robot definition → Physics checks: checks robot model (evidence: `README.md`)
- Behavior specifications → Spec parser: parses specs (evidence: `README.md`)
- Behavior specifications → PPO trainer: sets training parameters (evidence: `README.md`)
- Behavior specifications → Robot control loop: defines runtime behavior (evidence: `README.md`)
- Robot definition → Stand environment: configures robot model (evidence: `README.md`)
- Spec parser → Stand environment: provides parsed specs (evidence: `README.md`)
- Stand environment → Actuator models: uses actuator models (evidence: `train/envs/duck_env.py`)
- Stand environment → URDF / MJCF assets: loads simulation model (evidence: `train/envs/duck_env.py`)
- PPO trainer → Stand environment: collects rollouts (evidence: `train/ppo/train.py`)
- PPO trainer → Spec parser: reads specs (evidence: `train/ppo/train.py`)
- Policy exporter → Spec parser: reads specs (evidence: `train/export.py`)
- Policy exporter → Policy artifacts: writes policy (evidence: `README.md`)
- Policy exporter → Stand environment: generates golden frames (evidence: `train/export.py`)
- Simulation viewer → Stand environment: drives simulation (evidence: `train/scripts/view.py`)
- Policy artifacts → Robot control loop: loads policy blob (evidence: `README.md`)
- Robot control loop → Physical robot: controls at 50 Hz (evidence: `README.md`)
- Intent service → Robot control loop: provides high-level intent
- OTA updater → Robot control loop: updates deployed software
