# flybabo/inav-vtol architecture

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

- Interactive diagram: https://gitdiagram.com/flybabo/inav-vtol
- Repository: https://github.com/flybabo/inav-vtol

## Overview

INAV is embedded flight-controller firmware for multirotor, fixed-wing, and other UAV platforms. Its principal runtime loop initializes the controller, then repeatedly runs scheduled work: sensor updates and flight-control tasks support stabilization and navigation, while communications, OSD, and logging provide operator feedback. The README also documents waypoint missions, return-to-home, configurable mixing, telemetry, and multiple sensor types. Sampled excerpts establish the main loop, task scheduling, battery/rangefinder-related work, and bootloader duties; unsampled capability links are documented or marked unverified rather than treated as inspected call paths.

Main entry points: [`src/main/fc/fc_tasks.c`](https://github.com/flybabo/inav-vtol/blob/master/src/main/fc/fc_tasks.c) (Scheduled tasks), [`src/main/fc`](https://github.com/flybabo/inav-vtol/tree/master/src/main/fc) (Flight control), [`src/main/msc/usbd_storage.c`](https://github.com/flybabo/inav-vtol/blob/master/src/main/msc/usbd_storage.c) (USB mass storage), [`src/main/drivers`](https://github.com/flybabo/inav-vtol/tree/master/src/main/drivers) (Sensor inputs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and control"]
  node_mainloop["Firmware loop<br/>[main.c]"]
  node_tasks["Scheduled tasks<br/>[fc_tasks.c]"]
end

subgraph group_flight["Flight capabilities"]
  node_sensors["Sensor inputs"]
  node_navigation["Navigation modes"]
  node_sqrtcontrol["Sqrt controller<br/>[sqrt_controller.c]"]
  node_flightcontrol["Flight control"]
  node_mixer["Configurable mixer"]
  node_actuators["Actuator outputs"]
end

subgraph group_operator["Operator interfaces"]
  node_cli["CLI and setup<br/>[cli.c]"]
  node_osd["On-screen display<br/>[osd.c]"]
  node_telemetry["Telemetry<br/>[mavlink.c]"]
  node_blackbox["Blackbox recorder<br/>[blackbox.c]"]
end

subgraph group_platform["Platform services"]
  node_bootloader["Firmware updater<br/>[bl_main.c]"]
  node_usbmsc["USB mass storage<br/>[usbd_storage.c]"]
  node_flashstorage[("Flash storage")]
  node_sdstorage[("SD storage")]
end

node_pilot(("Pilot"))
node_configurator["INAV Configurator"]

node_pilot -.->|"configures"| node_configurator
node_configurator -.->|"sets up"| node_cli
node_mainloop -->|"runs scheduler"| node_tasks
node_tasks -.->|"updates inputs"| node_sensors
node_tasks -.->|"schedules control"| node_flightcontrol
node_sensors -.->|"provides measurements"| node_navigation
node_navigation -.->|"uses controller"| node_sqrtcontrol
node_sqrtcontrol -.->|"computes correction"| node_flightcontrol
node_flightcontrol -.->|"sets outputs"| node_mixer
node_mixer -.->|"drives outputs"| node_actuators
node_tasks -.->|"updates display"| node_osd
node_tasks -.->|"services telemetry"| node_telemetry
node_tasks -.->|"records flight"| node_blackbox
node_bootloader -.->|"uses flash"| node_flashstorage
node_usbmsc -->|"exposes storage"| node_flashstorage
node_usbmsc -.->|"exposes storage"| node_sdstorage

click node_mainloop "https://github.com/flybabo/inav-vtol/blob/master/src/main/main.c"
click node_tasks "https://github.com/flybabo/inav-vtol/blob/master/src/main/fc/fc_tasks.c"
click node_sensors "https://github.com/flybabo/inav-vtol/tree/master/src/main/drivers"
click node_navigation "https://github.com/flybabo/inav-vtol/tree/master/src/main/navigation"
click node_sqrtcontrol "https://github.com/flybabo/inav-vtol/blob/master/src/main/navigation/sqrt_controller.c"
click node_flightcontrol "https://github.com/flybabo/inav-vtol/tree/master/src/main/fc"
click node_mixer "https://github.com/flybabo/inav-vtol/tree/master/src/main/fc"
click node_actuators "https://github.com/flybabo/inav-vtol/tree/master/src/main/drivers"
click node_cli "https://github.com/flybabo/inav-vtol/blob/master/src/main/fc/cli.c"
click node_osd "https://github.com/flybabo/inav-vtol/blob/master/src/main/io/osd.c"
click node_telemetry "https://github.com/flybabo/inav-vtol/blob/master/src/main/telemetry/mavlink.c"
click node_blackbox "https://github.com/flybabo/inav-vtol/blob/master/src/main/blackbox/blackbox.c"
click node_bootloader "https://github.com/flybabo/inav-vtol/blob/master/src/bl/bl_main.c"
click node_usbmsc "https://github.com/flybabo/inav-vtol/blob/master/src/main/msc/usbd_storage.c"
click node_flashstorage "https://github.com/flybabo/inav-vtol/blob/master/src/main/msc/usbd_storage_emfat.c"
click node_sdstorage "https://github.com/flybabo/inav-vtol/blob/master/src/main/msc/usbd_storage_sd_spi.c"

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_mainloop,node_tasks toneBlue
class node_sensors,node_navigation,node_sqrtcontrol,node_flightcontrol,node_mixer,node_actuators toneAmber
class node_cli,node_osd,node_telemetry,node_blackbox toneMint
class node_bootloader,node_usbmsc,node_flashstorage,node_sdstorage toneRose
class node_pilot,node_configurator toneIndigo
```

## Components

### Runtime and control

- [Firmware loop](https://github.com/flybabo/inav-vtol/blob/master/src/main/main.c): `src/main/main.c`
- [Scheduled tasks](https://github.com/flybabo/inav-vtol/blob/master/src/main/fc/fc_tasks.c): `src/main/fc/fc_tasks.c`

### Flight capabilities

- [Sensor inputs](https://github.com/flybabo/inav-vtol/tree/master/src/main/drivers): `src/main/drivers`
- [Navigation modes](https://github.com/flybabo/inav-vtol/tree/master/src/main/navigation): `src/main/navigation`
- [Sqrt controller](https://github.com/flybabo/inav-vtol/blob/master/src/main/navigation/sqrt_controller.c): `src/main/navigation/sqrt_controller.c`
- [Flight control](https://github.com/flybabo/inav-vtol/tree/master/src/main/fc): `src/main/fc`
- [Configurable mixer](https://github.com/flybabo/inav-vtol/tree/master/src/main/fc): `src/main/fc`
- [Actuator outputs](https://github.com/flybabo/inav-vtol/tree/master/src/main/drivers): `src/main/drivers`

### Operator interfaces

- [CLI and setup](https://github.com/flybabo/inav-vtol/blob/master/src/main/fc/cli.c): `src/main/fc/cli.c`
- [On-screen display](https://github.com/flybabo/inav-vtol/blob/master/src/main/io/osd.c): `src/main/io/osd.c`
- [Telemetry](https://github.com/flybabo/inav-vtol/blob/master/src/main/telemetry/mavlink.c): `src/main/telemetry/mavlink.c`
- [Blackbox recorder](https://github.com/flybabo/inav-vtol/blob/master/src/main/blackbox/blackbox.c): `src/main/blackbox/blackbox.c`

### Platform services

- [Firmware updater](https://github.com/flybabo/inav-vtol/blob/master/src/bl/bl_main.c): `src/bl/bl_main.c`
- [USB mass storage](https://github.com/flybabo/inav-vtol/blob/master/src/main/msc/usbd_storage.c): `src/main/msc/usbd_storage.c`
- [Flash storage](https://github.com/flybabo/inav-vtol/blob/master/src/main/msc/usbd_storage_emfat.c): `src/main/msc/usbd_storage_emfat.c`
- [SD storage](https://github.com/flybabo/inav-vtol/blob/master/src/main/msc/usbd_storage_sd_spi.c): `src/main/msc/usbd_storage_sd_spi.c`

### Other components

- **Pilot**
- **INAV Configurator**

## Connections

- Pilot → INAV Configurator: configures
- INAV Configurator → CLI and setup: sets up
- Firmware loop → Scheduled tasks: runs scheduler (evidence: `src/main/main.c`)
- Scheduled tasks → Sensor inputs: updates inputs (evidence: `src/main/fc/fc_tasks.c`)
- Scheduled tasks → Flight control: schedules control (evidence: `src/main/fc/fc_tasks.c`)
- Sensor inputs → Navigation modes: provides measurements
- Navigation modes → Sqrt controller: uses controller (evidence: `src/main/navigation/sqrt_controller.c`)
- Sqrt controller → Flight control: computes correction
- Flight control → Configurable mixer: sets outputs
- Configurable mixer → Actuator outputs: drives outputs (evidence: `src/main/fc/fc_tasks.c`)
- Scheduled tasks → On-screen display: updates display
- Scheduled tasks → Telemetry: services telemetry
- Scheduled tasks → Blackbox recorder: records flight
- Firmware updater → Flash storage: uses flash (evidence: `src/bl/bl_main.c`)
- USB mass storage → Flash storage: exposes storage (evidence: `src/main/msc/usbd_storage_emfat.c`)
- USB mass storage → SD storage: exposes storage
