# neshanthr/llm-controllered-uav architecture

> Architecture diagram of the GitHub repository neshanthr/llm-controllered-uav, 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/neshanthr/llm-controllered-uav
- Repository: https://github.com/neshanthr/llm-controllered-uav

## Overview

The product turns an operator’s natural-language request into a structured UAV mission, validates it, then dispatches flight operations and plots the recorded trajectory. Its main stages are planning, safety validation, mission dispatch, and vehicle control; trajectory logging is a supporting internal layer. The README documents the Ollama/Qwen and MAVSDK–MAVLink–PX4 SITL–Gazebo stack. Source excerpts confirm the Python call chain and logging/plotting links; simulator links and some integrations are documented rather than verified in sampled implementation.

Main entry points: [`main.py`](https://github.com/neshanthr/llm-controllered-uav/blob/main/main.py) (CLI orchestrator), [`executor.py`](https://github.com/neshanthr/llm-controllered-uav/blob/main/executor.py) (Mission dispatcher), [`drone.py`](https://github.com/neshanthr/llm-controllered-uav/blob/main/drone.py) (Drone controller), [`planner.py`](https://github.com/neshanthr/llm-controllered-uav/blob/main/planner.py) (LLM planner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_planning["Mission planning"]
  node_planner["LLM planner<br/>[planner.py]"]
  node_validator["Mission validator<br/>[validator.py]"]
end

subgraph group_dispatch["Mission dispatch"]
  node_mission_entry["CLI orchestrator<br/>[main.py]"]
  node_mission_dispatch["Mission dispatcher<br/>[executor.py]"]
end

subgraph group_flight["Flight control"]
  node_flight_executor["Flight executor<br/>[flight_executor.py]"]
  node_drone_controller["Drone controller<br/>[drone.py]"]
  node_mavsdk["MAVSDK"]
  node_mavlink["MAVLink"]
  node_px4["PX4 SITL"]
  node_gazebo["Gazebo simulator"]
end

subgraph group_observability["Flight observability"]
  node_trajectory_log["Trajectory logger"]
  node_trajectory_plot["Trajectory plotter<br/>[plot_trajectory.py]"]
end

node_operator(("Operator"))
node_ollama["Ollama / Qwen"]

node_operator -->|"enters prompt"| node_mission_entry
node_mission_entry -->|"requests plan"| node_planner
node_planner -->|"generates mission"| node_ollama
node_mission_entry -->|"validates mission"| node_validator
node_mission_entry -->|"dispatches mission"| node_mission_dispatch
node_mission_dispatch -->|"selects flight operation"| node_flight_executor
node_flight_executor -->|"runs flight actions"| node_drone_controller
node_drone_controller -->|"controls vehicle"| node_mavsdk
node_mavsdk -->|"communicates over"| node_mavlink
node_mavlink -->|"sends vehicle commands"| node_px4
node_px4 -->|"controls simulation"| node_gazebo
node_drone_controller -->|"records waypoints"| node_trajectory_log
node_mission_dispatch -->|"plots after execution"| node_trajectory_plot
node_trajectory_plot -->|"reads trajectory"| node_trajectory_log

click node_planner "https://github.com/neshanthr/llm-controllered-uav/blob/main/planner.py"
click node_validator "https://github.com/neshanthr/llm-controllered-uav/blob/main/validator.py"
click node_mission_entry "https://github.com/neshanthr/llm-controllered-uav/blob/main/main.py"
click node_mission_dispatch "https://github.com/neshanthr/llm-controllered-uav/blob/main/executor.py"
click node_flight_executor "https://github.com/neshanthr/llm-controllered-uav/blob/main/flight_executor.py"
click node_drone_controller "https://github.com/neshanthr/llm-controllered-uav/blob/main/drone.py"
click node_trajectory_log "https://github.com/neshanthr/llm-controllered-uav/blob/main/trajectory_logger.py"
click node_trajectory_plot "https://github.com/neshanthr/llm-controllered-uav/blob/main/plot_trajectory.py"

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_planner,node_validator toneBlue
class node_mission_entry,node_mission_dispatch toneAmber
class node_flight_executor,node_drone_controller,node_mavsdk,node_mavlink,node_px4,node_gazebo toneMint
class node_trajectory_log,node_trajectory_plot toneRose
class node_operator,node_ollama toneIndigo
```

## Components

### Mission planning

- [LLM planner](https://github.com/neshanthr/llm-controllered-uav/blob/main/planner.py): `planner.py`
- [Mission validator](https://github.com/neshanthr/llm-controllered-uav/blob/main/validator.py): `validator.py`

### Mission dispatch

- [CLI orchestrator](https://github.com/neshanthr/llm-controllered-uav/blob/main/main.py): `main.py`
- [Mission dispatcher](https://github.com/neshanthr/llm-controllered-uav/blob/main/executor.py): `executor.py`

### Flight control

- [Flight executor](https://github.com/neshanthr/llm-controllered-uav/blob/main/flight_executor.py): `flight_executor.py`
- [Drone controller](https://github.com/neshanthr/llm-controllered-uav/blob/main/drone.py): `drone.py`
- **MAVSDK**
- **MAVLink**
- **PX4 SITL**
- **Gazebo simulator**

### Flight observability

- [Trajectory logger](https://github.com/neshanthr/llm-controllered-uav/blob/main/trajectory_logger.py): `trajectory_logger.py`
- [Trajectory plotter](https://github.com/neshanthr/llm-controllered-uav/blob/main/plot_trajectory.py): `plot_trajectory.py`

### Other components

- **Operator**
- **Ollama / Qwen**

## Connections

- Operator → CLI orchestrator: enters prompt (evidence: `main.py`)
- CLI orchestrator → LLM planner: requests plan (evidence: `main.py`)
- LLM planner → Ollama / Qwen: generates mission (evidence: `README.md`)
- CLI orchestrator → Mission validator: validates mission (evidence: `main.py`)
- CLI orchestrator → Mission dispatcher: dispatches mission (evidence: `main.py`)
- Mission dispatcher → Flight executor: selects flight operation (evidence: `executor.py`)
- Flight executor → Drone controller: runs flight actions (evidence: `flight_executor.py`)
- Drone controller → MAVSDK: controls vehicle (evidence: `drone.py`)
- MAVSDK → MAVLink: communicates over (evidence: `README.md`)
- MAVLink → PX4 SITL: sends vehicle commands (evidence: `README.md`)
- PX4 SITL → Gazebo simulator: controls simulation (evidence: `README.md`)
- Drone controller → Trajectory logger: records waypoints (evidence: `drone.py`)
- Mission dispatcher → Trajectory plotter: plots after execution (evidence: `executor.py`)
- Trajectory plotter → Trajectory logger: reads trajectory (evidence: `plot_trajectory.py`)
