# firmament-autopilot/fmt-firmware architecture

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

- Interactive diagram: https://gitdiagram.com/firmament-autopilot/fmt-firmware
- Repository: https://github.com/firmament-autopilot/fmt-firmware

## Overview

FMT is an embedded autopilot firmware for autonomous vehicles, with model-based control and support for multiple hardware platforms. The conceptual workflow is vehicle sensing, control computation, and actuator output, alongside task/runtime services and ground-station communication. The tree identifies these subsystems, but sampled source does not show the main flight-control orchestration or most driver-to-HAL bindings; those connections are therefore omitted rather than inferred. The README documents RT-Thread, model-based development, and MAVLink/QGroundControl support.

Main entry points: [`src/model/control`](https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/model/control) (Vehicle controllers), [`src/module/ftp/ftp_manager.c`](https://github.com/firmament-autopilot/fmt-firmware/blob/master/src/module/ftp/ftp_manager.c) (FTP manager), [`src/driver`](https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/driver) (Sensor drivers), [`src/hal`](https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/hal) (Sensor HAL)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Sensing and I/O"]
  node_drivers["Sensor drivers"]
  node_sensor_hal["Sensor HAL"]
  node_actuator_hal["Actuator HAL"]
  node_rc_input["RC input"]
end

subgraph group_control["Control"]
  node_model_controllers["Vehicle controllers"]
end

subgraph group_runtime["Runtime services"]
  node_task_manager["Task manager<br/>[task_manager.c]"]
  node_workqueue["Workqueue"]
  node_power_manager["Power management<br/>[power_manager.h]"]
  node_heater["Heater control"]
end

subgraph group_communication["Communication and storage"]
  node_mavlink["MAVLink protocol<br/>[v2.0]"]
  node_ftp["FTP manager<br/>[ftp_manager.c]"]
  node_file_manager["File manager<br/>[file_manager.c]"]
  node_mavproxy["MAV proxy"]
end

node_vehicle(("Autonomous vehicle"))
node_ground_station(("QGroundControl"))
node_rtthread(("RT-Thread"))

node_vehicle -.->|"provides measurements"| node_drivers
node_drivers -.->|"uses interfaces"| node_sensor_hal
node_sensor_hal -.->|"supplies inputs"| node_model_controllers
node_rc_input -.->|"supplies commands"| node_model_controllers
node_model_controllers -.->|"produces outputs"| node_actuator_hal
node_actuator_hal -.->|"drives actuators"| node_vehicle
node_rtthread -->|"provides RTOS"| node_task_manager
node_model_controllers -.->|"generated for platforms"| node_vehicle
node_ground_station -->|"communicates via"| node_mavlink
node_ftp -->|"uses file APIs"| node_file_manager
node_ftp -->|"sets stream session"| node_mavproxy

click node_drivers "https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/driver"
click node_sensor_hal "https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/hal"
click node_actuator_hal "https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/hal/actuator"
click node_rc_input "https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/hal/rc"
click node_model_controllers "https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/model/control"
click node_task_manager "https://github.com/firmament-autopilot/fmt-firmware/blob/master/src/module/task_manager/task_manager.c"
click node_workqueue "https://github.com/firmament-autopilot/fmt-firmware/blob/master/src/module/workqueue/workqueue_manager.c"
click node_power_manager "https://github.com/firmament-autopilot/fmt-firmware/blob/master/src/module/pmu/power_manager.h"
click node_heater "https://github.com/firmament-autopilot/fmt-firmware/blob/master/src/module/heater/heater_controller.c"
click node_mavlink "https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/lib/mavlink/v2.0"
click node_ftp "https://github.com/firmament-autopilot/fmt-firmware/blob/master/src/module/ftp/ftp_manager.c"
click node_file_manager "https://github.com/firmament-autopilot/fmt-firmware/blob/master/src/module/file_manager/file_manager.c"
click node_mavproxy "https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/module/mavproxy"

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_drivers,node_sensor_hal,node_actuator_hal,node_rc_input toneBlue
class node_model_controllers toneAmber
class node_task_manager,node_workqueue,node_power_manager,node_heater toneMint
class node_mavlink,node_ftp,node_file_manager,node_mavproxy toneRose
class node_vehicle,node_ground_station,node_rtthread toneIndigo
```

## Components

### Sensing and I/O

- [Sensor drivers](https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/driver): `src/driver`
- [Sensor HAL](https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/hal): `src/hal`
- [Actuator HAL](https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/hal/actuator): `src/hal/actuator`
- [RC input](https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/hal/rc): `src/hal/rc`

### Control

- [Vehicle controllers](https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/model/control): `src/model/control`

### Runtime services

- [Task manager](https://github.com/firmament-autopilot/fmt-firmware/blob/master/src/module/task_manager/task_manager.c): `src/module/task_manager/task_manager.c`
- [Workqueue](https://github.com/firmament-autopilot/fmt-firmware/blob/master/src/module/workqueue/workqueue_manager.c): `src/module/workqueue/workqueue_manager.c`
- [Power management](https://github.com/firmament-autopilot/fmt-firmware/blob/master/src/module/pmu/power_manager.h): `src/module/pmu/power_manager.h`
- [Heater control](https://github.com/firmament-autopilot/fmt-firmware/blob/master/src/module/heater/heater_controller.c): `src/module/heater/heater_controller.c`

### Communication and storage

- [MAVLink protocol](https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/lib/mavlink/v2.0): `src/lib/mavlink/v2.0`
- [FTP manager](https://github.com/firmament-autopilot/fmt-firmware/blob/master/src/module/ftp/ftp_manager.c): `src/module/ftp/ftp_manager.c`
- [File manager](https://github.com/firmament-autopilot/fmt-firmware/blob/master/src/module/file_manager/file_manager.c): `src/module/file_manager/file_manager.c`
- [MAV proxy](https://github.com/firmament-autopilot/fmt-firmware/tree/master/src/module/mavproxy): `src/module/mavproxy`

### Other components

- **Autonomous vehicle**
- **QGroundControl**
- **RT-Thread**

## Connections

- Autonomous vehicle → Sensor drivers: provides measurements
- Sensor drivers → Sensor HAL: uses interfaces
- Sensor HAL → Vehicle controllers: supplies inputs
- RC input → Vehicle controllers: supplies commands
- Vehicle controllers → Actuator HAL: produces outputs
- Actuator HAL → Autonomous vehicle: drives actuators
- RT-Thread → Task manager: provides RTOS
- Vehicle controllers → Autonomous vehicle: generated for platforms
- QGroundControl → MAVLink protocol: communicates via
- FTP manager → File manager: uses file APIs (evidence: `src/module/ftp/ftp_manager.c`)
- FTP manager → MAV proxy: sets stream session (evidence: `src/module/ftp/ftp_manager.c`)
