# lokestrom/drone_piloting architecture

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

- Interactive diagram: https://gitdiagram.com/lokestrom/drone_piloting
- Repository: https://github.com/lokestrom/drone_piloting

## Overview

Drone Piloting is an interactive drone-flight simulator. The principal workflow is: the user launches the application, provides keyboard/gamepad input, the simulation updates player and drone state through PID control, and the renderer presents the resulting scene and UI. Startup also loads a drone and map asynchronously; menus can request replacements. The excerpts directly establish application-loop orchestration, input handling, PID control, asynchronous work, ImGui UI, and Vulkan/GLFW integration. Several model and loading call paths are inferred only at subsystem level because their implementations were not sampled.

Main entry points: [`src/App.cpp`](https://github.com/lokestrom/drone_piloting/blob/main/src/App.cpp) (Application Loop), [`src/structures/asyncWorker.cpp`](https://github.com/lokestrom/drone_piloting/blob/main/src/structures/asyncWorker.cpp) (Async Worker), [`src/Player.cpp`](https://github.com/lokestrom/drone_piloting/blob/main/src/Player.cpp) (Player State), [`src/importJSONData.cpp`](https://github.com/lokestrom/drone_piloting/blob/main/src/importJSONData.cpp) (Asset Import)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime Orchestration"]
  node_app["Application Loop<br/>[App.cpp]"]
  node_input["Input Handling"]
end

subgraph group_simulation["Flight Simulation"]
  node_player["Player State<br/>[Player.cpp]"]
  node_pid["PID Controller<br/>[PIDcontroller.hpp]"]
  node_drone_api["Drone API<br/>[DroneAPI.h]"]
  node_drone["Drone Model<br/>[Drone.cpp]"]
  node_map["Map Model<br/>[Map.cpp]"]
end

subgraph group_ui_loading["UI And Loading"]
  node_async["Async Worker<br/>[asyncWorker.cpp]"]
  node_asset_import["Asset Import<br/>[importJSONData.cpp]"]
  node_gui_app["GUI Application<br/>[guiApp.cpp]"]
  node_selection["Selection Windows"]
  node_settings["Settings UI<br/>[settingsGui.cpp]"]
  node_worker_gui["Worker Status UI<br/>[asyncWorkerGui.cpp]"]
end

subgraph group_rendering["Rendering"]
  node_renderer_setup["Renderer Setup<br/>[rendererSetup.cpp]"]
  node_renderer["Vulkan Renderer"]
end

node_user(("Pilot"))
node_glfw["GLFW Window"]
node_vulkan["Vulkan Runtime"]

node_user -->|"launches"| node_app
node_user -->|"provides input"| node_input
node_app -->|"polls events"| node_glfw
node_app -->|"resets input"| node_input
node_app -->|"updates players"| node_player
node_input -->|"drives targets"| node_pid
node_player -->|"updates controller"| node_pid
node_pid -->|"writes commands"| node_drone_api
node_player -->|"updates state"| node_drone
node_app -->|"submits loading"| node_async
node_async -->|"runs import"| node_asset_import
node_asset_import -->|"loads drone"| node_drone
node_asset_import -->|"loads map"| node_map
node_async -->|"reports status"| node_worker_gui
node_app -->|"generates windows"| node_gui_app
node_gui_app -->|"dispatches views"| node_selection
node_gui_app -->|"renders settings"| node_settings
node_selection -->|"requests loading"| node_async
node_app -->|"configures renderer"| node_renderer_setup
node_app -->|"renders frame"| node_renderer
node_renderer_setup -->|"initializes Vulkan"| node_vulkan
node_renderer_setup -->|"creates window"| node_glfw
node_renderer -->|"submits drawing"| node_vulkan

click node_app "https://github.com/lokestrom/drone_piloting/blob/main/src/App.cpp"
click node_input "https://github.com/lokestrom/drone_piloting/blob/main/src/Input/InputEventHandler.hpp"
click node_player "https://github.com/lokestrom/drone_piloting/blob/main/src/Player.cpp"
click node_pid "https://github.com/lokestrom/drone_piloting/blob/main/src/API/helpers/PIDcontroller.hpp"
click node_drone_api "https://github.com/lokestrom/drone_piloting/blob/main/src/API/DroneAPI.h"
click node_drone "https://github.com/lokestrom/drone_piloting/blob/main/src/Drone.cpp"
click node_map "https://github.com/lokestrom/drone_piloting/blob/main/src/Map.cpp"
click node_async "https://github.com/lokestrom/drone_piloting/blob/main/src/structures/asyncWorker.cpp"
click node_asset_import "https://github.com/lokestrom/drone_piloting/blob/main/src/importJSONData.cpp"
click node_gui_app "https://github.com/lokestrom/drone_piloting/blob/main/src/gui/guiApp.cpp"
click node_selection "https://github.com/lokestrom/drone_piloting/tree/main/src/windows"
click node_settings "https://github.com/lokestrom/drone_piloting/blob/main/src/gui/settingsGui.cpp"
click node_worker_gui "https://github.com/lokestrom/drone_piloting/blob/main/src/gui/asyncWorkerGui.cpp"
click node_renderer_setup "https://github.com/lokestrom/drone_piloting/blob/main/src/rendererSetup.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_app,node_input toneBlue
class node_player,node_pid,node_drone_api,node_drone,node_map toneAmber
class node_async,node_asset_import,node_gui_app,node_selection,node_settings,node_worker_gui toneMint
class node_renderer_setup,node_renderer toneRose
class node_user,node_glfw,node_vulkan toneIndigo
```

## Components

### Runtime Orchestration

- [Application Loop](https://github.com/lokestrom/drone_piloting/blob/main/src/App.cpp): `src/App.cpp`
- [Input Handling](https://github.com/lokestrom/drone_piloting/blob/main/src/Input/InputEventHandler.hpp): `src/Input/InputEventHandler.hpp`

### Flight Simulation

- [Player State](https://github.com/lokestrom/drone_piloting/blob/main/src/Player.cpp): `src/Player.cpp`
- [PID Controller](https://github.com/lokestrom/drone_piloting/blob/main/src/API/helpers/PIDcontroller.hpp): `src/API/helpers/PIDcontroller.hpp`
- [Drone API](https://github.com/lokestrom/drone_piloting/blob/main/src/API/DroneAPI.h): `src/API/DroneAPI.h`
- [Drone Model](https://github.com/lokestrom/drone_piloting/blob/main/src/Drone.cpp): `src/Drone.cpp`
- [Map Model](https://github.com/lokestrom/drone_piloting/blob/main/src/Map.cpp): `src/Map.cpp`

### UI And Loading

- [Async Worker](https://github.com/lokestrom/drone_piloting/blob/main/src/structures/asyncWorker.cpp): `src/structures/asyncWorker.cpp`
- [Asset Import](https://github.com/lokestrom/drone_piloting/blob/main/src/importJSONData.cpp): `src/importJSONData.cpp`
- [GUI Application](https://github.com/lokestrom/drone_piloting/blob/main/src/gui/guiApp.cpp): `src/gui/guiApp.cpp`
- [Selection Windows](https://github.com/lokestrom/drone_piloting/tree/main/src/windows): `src/windows`
- [Settings UI](https://github.com/lokestrom/drone_piloting/blob/main/src/gui/settingsGui.cpp): `src/gui/settingsGui.cpp`
- [Worker Status UI](https://github.com/lokestrom/drone_piloting/blob/main/src/gui/asyncWorkerGui.cpp): `src/gui/asyncWorkerGui.cpp`

### Rendering

- [Renderer Setup](https://github.com/lokestrom/drone_piloting/blob/main/src/rendererSetup.cpp): `src/rendererSetup.cpp`
- **Vulkan Renderer**

### Other components

- **Pilot**
- **GLFW Window**
- **Vulkan Runtime**

## Connections

- Pilot → Application Loop: launches
- Pilot → Input Handling: provides input
- Application Loop → GLFW Window: polls events
- Application Loop → Input Handling: resets input
- Application Loop → Player State: updates players
- Input Handling → PID Controller: drives targets
- Player State → PID Controller: updates controller
- PID Controller → Drone API: writes commands
- Player State → Drone Model: updates state
- Application Loop → Async Worker: submits loading
- Async Worker → Asset Import: runs import
- Asset Import → Drone Model: loads drone
- Asset Import → Map Model: loads map
- Async Worker → Worker Status UI: reports status
- Application Loop → GUI Application: generates windows
- GUI Application → Selection Windows: dispatches views
- GUI Application → Settings UI: renders settings
- Selection Windows → Async Worker: requests loading
- Application Loop → Renderer Setup: configures renderer
- Application Loop → Vulkan Renderer: renders frame
- Renderer Setup → Vulkan Runtime: initializes Vulkan
- Renderer Setup → GLFW Window: creates window
- Vulkan Renderer → Vulkan Runtime: submits drawing
