# omni-god/pico_drone architecture

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

- Interactive diagram: https://gitdiagram.com/omni-god/pico_drone
- Repository: https://github.com/omni-god/pico_drone

## Overview

This is Raspberry Pi Pico 2 flight-controller firmware. Its principal workflow receives CRSF radio input, combines it with IMU and attitude data, applies safety and flight-control logic, and drives motor ESCs; separate tasks also handle sensor processing and telemetry. The graph preserves the major sensor, RC, safety, control, and telemetry subsystems. Evidence is limited to the README (empty), source index, and shown excerpts; unsampled task interactions are not asserted.

Main entry points: [`drone.cpp`](https://github.com/omni-god/pico_drone/blob/main/drone.cpp) (Firmware entry), [`Flight/RC/RCTask.cpp`](https://github.com/omni-god/pico_drone/blob/main/Flight/RC/RCTask.cpp) (RC task), [`Flight/Sensor/IMUTask.cpp`](https://github.com/omni-god/pico_drone/blob/main/Flight/Sensor/IMUTask.cpp) (IMU task), [`Managers/Sensors/SensorManager.cpp`](https://github.com/omni-god/pico_drone/blob/main/Managers/Sensors/SensorManager.cpp) (Sensor manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Firmware Runtime"]
  node_drone["Firmware entry<br/>[drone.cpp]"]
  node_telemetry_task["Telemetry task<br/>[TelemetryTask.cpp]"]
end

subgraph group_sensors["Sensors and Estimation"]
  node_imu_task["IMU task<br/>[IMUTask.cpp]"]
  node_sensor_manager["Sensor manager<br/>[SensorManager.cpp]"]
  node_imu_state["Sensor state<br/>[SensorState.h]"]
  node_imu_publisher["IMU publisher<br/>[IMUPublisher.h]"]
  node_attitude["Attitude estimator"]
end

subgraph group_radio["Radio Control"]
  node_rc_task["RC task<br/>[RCTask.cpp]"]
  node_crsf["CRSF parser<br/>[CrsfParser.cpp]"]
  node_rc_input["RC input mapping<br/>[RCInput.cpp]"]
  node_rc_state["RC state<br/>[RCState.h]"]
  node_rc_publisher["RC publisher<br/>[RCPublisher.cpp]"]
  node_telemetry["CRSF telemetry<br/>[CrsfTelemetry.h]"]
end

subgraph group_flight["Safety and Flight Control"]
  node_safety_task["Safety task<br/>[SafetyTask.cpp]"]
  node_safety["Safety manager<br/>[SafetyManager.cpp]"]
  node_safety_snapshot["Safety snapshot<br/>[SafetySnapshot.h]"]
  node_control_task["Flight-control task"]
  node_controller["Flight controller"]
  node_pid["PID loops<br/>[PID.cpp]"]
  node_mixer["Motor mixer<br/>[MotorMixer.cpp]"]
end

subgraph group_hardware["Hardware Drivers"]
  node_imu_driver["ICM20948 IMU<br/>[ICM20948.cpp]"]
  node_other_sensors["Auxiliary sensors"]
  node_esc["ESC outputs<br/>[Esc.cpp]"]
  node_i2c["I2C bus<br/>[I2c.cpp]"]
end

node_operator(("Pilot / operator"))

node_operator -.->|"sends commands"| node_crsf
node_drone -->|"constructs"| node_sensor_manager
node_drone -->|"constructs"| node_imu_driver
node_drone -->|"constructs"| node_other_sensors
node_drone -->|"configures"| node_crsf
node_drone -->|"constructs"| node_control_task
node_drone -->|"constructs"| node_telemetry_task
node_sensor_manager -->|"uses sensor"| node_imu_driver
node_sensor_manager -->|"uses sensors"| node_other_sensors
node_imu_driver -.->|"uses bus"| node_i2c
node_other_sensors -.->|"uses bus"| node_i2c
node_controller -->|"updates"| node_pid
node_controller -->|"mixes outputs"| node_mixer
node_control_task -.->|"runs control"| node_controller
node_control_task -.->|"drives motors"| node_esc
node_drone -->|"starts task"| node_imu_task
node_drone -->|"starts task"| node_safety_task
node_drone -.->|"starts task"| node_rc_task
node_rc_task -.->|"receives frames"| node_crsf
node_rc_task -.->|"maps channels"| node_rc_input
node_rc_input -.->|"produces state"| node_rc_state
node_imu_task -.->|"produces samples"| node_imu_state
node_imu_task -.->|"publishes samples"| node_imu_publisher
node_imu_state -.->|"estimates attitude"| node_attitude
node_safety_task -.->|"evaluates state"| node_safety
node_safety -.->|"updates snapshot"| node_safety_snapshot
node_drone -.->|"constructs"| node_telemetry
node_telemetry_task -.->|"uses telemetry"| node_telemetry
node_rc_task -.->|"publishes state"| node_rc_publisher

click node_drone "https://github.com/omni-god/pico_drone/blob/main/drone.cpp"
click node_rc_task "https://github.com/omni-god/pico_drone/blob/main/Flight/RC/RCTask.cpp"
click node_crsf "https://github.com/omni-god/pico_drone/blob/main/Flight/RC/CrsfParser.cpp"
click node_rc_input "https://github.com/omni-god/pico_drone/blob/main/Flight/RC/RCInput.cpp"
click node_rc_state "https://github.com/omni-god/pico_drone/blob/main/Flight/RC/RCState.h"
click node_rc_publisher "https://github.com/omni-god/pico_drone/blob/main/Flight/RC/RCPublisher.cpp"
click node_imu_task "https://github.com/omni-god/pico_drone/blob/main/Flight/Sensor/IMUTask.cpp"
click node_sensor_manager "https://github.com/omni-god/pico_drone/blob/main/Managers/Sensors/SensorManager.cpp"
click node_imu_driver "https://github.com/omni-god/pico_drone/blob/main/Drivers/Sensors/ICM20948/ICM20948.cpp"
click node_other_sensors "https://github.com/omni-god/pico_drone/tree/main/Drivers/Sensors"
click node_imu_state "https://github.com/omni-god/pico_drone/blob/main/Flight/Sensor/SensorState.h"
click node_imu_publisher "https://github.com/omni-god/pico_drone/blob/main/Flight/Sensor/IMUPublisher.h"
click node_attitude "https://github.com/omni-god/pico_drone/blob/main/Flight/Sensor/AttitudeEstimator.cpp"
click node_safety_task "https://github.com/omni-god/pico_drone/blob/main/Flight/Safety/SafetyTask.cpp"
click node_safety "https://github.com/omni-god/pico_drone/blob/main/Flight/Safety/SafetyManager.cpp"
click node_safety_snapshot "https://github.com/omni-god/pico_drone/blob/main/Flight/Safety/SafetySnapshot.h"
click node_control_task "https://github.com/omni-god/pico_drone/blob/main/Flight/FlightControl/FlightControlTask.cpp"
click node_controller "https://github.com/omni-god/pico_drone/blob/main/Flight/FlightControl/FlightController.cpp"
click node_pid "https://github.com/omni-god/pico_drone/blob/main/Flight/FlightControl/PID.cpp"
click node_mixer "https://github.com/omni-god/pico_drone/blob/main/Flight/FlightControl/MotorMixer.cpp"
click node_esc "https://github.com/omni-god/pico_drone/blob/main/Drivers/PWM/Esc.cpp"
click node_telemetry_task "https://github.com/omni-god/pico_drone/blob/main/Flight/Telemetry/TelemetryTask.cpp"
click node_telemetry "https://github.com/omni-god/pico_drone/blob/main/Flight/RC/CrsfTelemetry.h"
click node_i2c "https://github.com/omni-god/pico_drone/blob/main/Drivers/I2C/I2c.cpp"

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_drone,node_telemetry_task toneBlue
class node_imu_task,node_sensor_manager,node_imu_state,node_imu_publisher,node_attitude toneAmber
class node_rc_task,node_crsf,node_rc_input,node_rc_state,node_rc_publisher,node_telemetry toneMint
class node_safety_task,node_safety,node_safety_snapshot,node_control_task,node_controller,node_pid,node_mixer toneRose
class node_imu_driver,node_other_sensors,node_esc,node_i2c,node_operator toneIndigo
```

## Components

### Firmware Runtime

- [Firmware entry](https://github.com/omni-god/pico_drone/blob/main/drone.cpp): `drone.cpp`
- [Telemetry task](https://github.com/omni-god/pico_drone/blob/main/Flight/Telemetry/TelemetryTask.cpp): `Flight/Telemetry/TelemetryTask.cpp`

### Sensors and Estimation

- [IMU task](https://github.com/omni-god/pico_drone/blob/main/Flight/Sensor/IMUTask.cpp): `Flight/Sensor/IMUTask.cpp`
- [Sensor manager](https://github.com/omni-god/pico_drone/blob/main/Managers/Sensors/SensorManager.cpp): `Managers/Sensors/SensorManager.cpp`
- [Sensor state](https://github.com/omni-god/pico_drone/blob/main/Flight/Sensor/SensorState.h): `Flight/Sensor/SensorState.h`
- [IMU publisher](https://github.com/omni-god/pico_drone/blob/main/Flight/Sensor/IMUPublisher.h): `Flight/Sensor/IMUPublisher.h`
- [Attitude estimator](https://github.com/omni-god/pico_drone/blob/main/Flight/Sensor/AttitudeEstimator.cpp): `Flight/Sensor/AttitudeEstimator.cpp`

### Radio Control

- [RC task](https://github.com/omni-god/pico_drone/blob/main/Flight/RC/RCTask.cpp): `Flight/RC/RCTask.cpp`
- [CRSF parser](https://github.com/omni-god/pico_drone/blob/main/Flight/RC/CrsfParser.cpp): `Flight/RC/CrsfParser.cpp`
- [RC input mapping](https://github.com/omni-god/pico_drone/blob/main/Flight/RC/RCInput.cpp): `Flight/RC/RCInput.cpp`
- [RC state](https://github.com/omni-god/pico_drone/blob/main/Flight/RC/RCState.h): `Flight/RC/RCState.h`
- [RC publisher](https://github.com/omni-god/pico_drone/blob/main/Flight/RC/RCPublisher.cpp): `Flight/RC/RCPublisher.cpp`
- [CRSF telemetry](https://github.com/omni-god/pico_drone/blob/main/Flight/RC/CrsfTelemetry.h): `Flight/RC/CrsfTelemetry.h`

### Safety and Flight Control

- [Safety task](https://github.com/omni-god/pico_drone/blob/main/Flight/Safety/SafetyTask.cpp): `Flight/Safety/SafetyTask.cpp`
- [Safety manager](https://github.com/omni-god/pico_drone/blob/main/Flight/Safety/SafetyManager.cpp): `Flight/Safety/SafetyManager.cpp`
- [Safety snapshot](https://github.com/omni-god/pico_drone/blob/main/Flight/Safety/SafetySnapshot.h): `Flight/Safety/SafetySnapshot.h`
- [Flight-control task](https://github.com/omni-god/pico_drone/blob/main/Flight/FlightControl/FlightControlTask.cpp): `Flight/FlightControl/FlightControlTask.cpp`
- [Flight controller](https://github.com/omni-god/pico_drone/blob/main/Flight/FlightControl/FlightController.cpp): `Flight/FlightControl/FlightController.cpp`
- [PID loops](https://github.com/omni-god/pico_drone/blob/main/Flight/FlightControl/PID.cpp): `Flight/FlightControl/PID.cpp`
- [Motor mixer](https://github.com/omni-god/pico_drone/blob/main/Flight/FlightControl/MotorMixer.cpp): `Flight/FlightControl/MotorMixer.cpp`

### Hardware Drivers

- [ICM20948 IMU](https://github.com/omni-god/pico_drone/blob/main/Drivers/Sensors/ICM20948/ICM20948.cpp): `Drivers/Sensors/ICM20948/ICM20948.cpp`
- [Auxiliary sensors](https://github.com/omni-god/pico_drone/tree/main/Drivers/Sensors): `Drivers/Sensors`
- [ESC outputs](https://github.com/omni-god/pico_drone/blob/main/Drivers/PWM/Esc.cpp): `Drivers/PWM/Esc.cpp`
- [I2C bus](https://github.com/omni-god/pico_drone/blob/main/Drivers/I2C/I2c.cpp): `Drivers/I2C/I2c.cpp`

### Other components

- **Pilot / operator**

## Connections

- Pilot / operator → CRSF parser: sends commands
- Firmware entry → Sensor manager: constructs (evidence: `drone.cpp`)
- Firmware entry → ICM20948 IMU: constructs (evidence: `drone.cpp`)
- Firmware entry → Auxiliary sensors: constructs (evidence: `drone.cpp`)
- Firmware entry → CRSF parser: configures (evidence: `drone.cpp`)
- Firmware entry → Flight-control task: constructs (evidence: `drone.cpp`)
- Firmware entry → Telemetry task: constructs (evidence: `drone.cpp`)
- Sensor manager → ICM20948 IMU: uses sensor
- Sensor manager → Auxiliary sensors: uses sensors
- ICM20948 IMU → I2C bus: uses bus
- Auxiliary sensors → I2C bus: uses bus
- Flight controller → PID loops: updates (evidence: `Flight/FlightControl/FlightController.cpp`)
- Flight controller → Motor mixer: mixes outputs (evidence: `Flight/FlightControl/FlightController.cpp`)
- Flight-control task → Flight controller: runs control
- Flight-control task → ESC outputs: drives motors
- Firmware entry → IMU task: starts task (evidence: `drone.cpp`)
- Firmware entry → Safety task: starts task (evidence: `drone.cpp`)
- Firmware entry → RC task: starts task
- RC task → CRSF parser: receives frames
- RC task → RC input mapping: maps channels
- RC input mapping → RC state: produces state
- IMU task → Sensor state: produces samples
- IMU task → IMU publisher: publishes samples
- Sensor state → Attitude estimator: estimates attitude
- Safety task → Safety manager: evaluates state
- Safety manager → Safety snapshot: updates snapshot
- Firmware entry → CRSF telemetry: constructs (evidence: `drone.cpp`)
- Telemetry task → CRSF telemetry: uses telemetry
- RC task → RC publisher: publishes state
