# sagigile/navigationdrone architecture

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

- Interactive diagram: https://gitdiagram.com/sagigile/navigationdrone
- Repository: https://github.com/sagigile/navigationdrone

## Overview

This is a UAV visual-localization system: reference-flight imagery and telemetry establish a georeferenced map, while query-video frames are matched and combined with visual odometry and satellite/reference anchors to estimate a view-center trajectory. Offline fusion smooths and exports the route; a separate real-time demo uses a constant-velocity Kalman filter. The README establishes the product capabilities and entry points; some pipeline handoffs are only implied by the documented architecture and are marked unverified.

Main entry points: [`build_once/localize_query_video.py`](https://github.com/sagigile/navigationdrone/blob/main/build_once/localize_query_video.py) (Query localization), [`pipeline/option2_fusion_optimizer.py`](https://github.com/sagigile/navigationdrone/blob/main/pipeline/option2_fusion_optimizer.py) (Robust fusion), [`src/wgs84.py`](https://github.com/sagigile/navigationdrone/blob/main/src/wgs84.py) (WGS84 transforms), [`src/geo_align.py`](https://github.com/sagigile/navigationdrone/blob/main/src/geo_align.py) (Geo alignment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_reference["Reference Mapping"]
  node_extract_reference["Reference extraction"]
  node_frame_io["Frame extraction<br/>[frame_io.py]"]
  node_telemetry["Telemetry parsing<br/>[telemetry.py]"]
  node_build_map["SfM map builder<br/>[build_map_hloc.py]"]
  node_geo_alignment["Geo alignment<br/>[geo_align.py]"]
end

subgraph group_localization["Query Localization"]
  node_main["Offline entry<br/>[Main.py]"]
  node_query_localize["Query localization"]
  node_rerank["Match reranking"]
  node_realtime["Real-time demo<br/>[RealTime_Demo.py]"]
end

subgraph group_fusion["Trajectory Fusion"]
  node_anchor_vo["Anchor and VO route<br/>[anchor_vo_v2.py]"]
  node_satellite_prior["Satellite map priors"]
  node_fusion_optimizer["Robust fusion"]
end

subgraph group_core["Geospatial Core"]
  node_colmap["COLMAP model reader<br/>[colmap_model.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_kalman["Kalman filter<br/>[kalman.py]"]
  node_wgs84["WGS84 transforms<br/>[wgs84.py]"]
  node_kml["KML export<br/>[kml_export.py]"]
end

node_operator(("Operator / video"))
node_route["Localized route"]

node_operator -->|"starts offline"| node_main
node_main -.->|"runs offline fusion"| node_fusion_optimizer
node_operator -.->|"provides reference flights"| node_extract_reference
node_extract_reference -->|"extracts frames"| node_frame_io
node_frame_io -->|"reads telemetry"| node_telemetry
node_operator -.->|"provides reference images"| node_build_map
node_build_map -->|"loads settings"| node_config
node_operator -.->|"provides reference metadata"| node_geo_alignment
node_geo_alignment -->|"reads image poses"| node_colmap
node_geo_alignment -->|"converts coordinates"| node_wgs84
node_operator -.->|"provides query video"| node_query_localize
node_query_localize -->|"extracts query frames"| node_frame_io
node_query_localize -->|"loads settings"| node_config
node_query_localize -->|"smooths locations"| node_kalman
node_query_localize -->|"converts coordinates"| node_wgs84
node_query_localize -->|"exports route"| node_kml
node_rerank -.->|"ranks reference matches"| node_anchor_vo
node_anchor_vo -->|"converts anchor positions"| node_wgs84
node_anchor_vo -.->|"supplies initial route"| node_fusion_optimizer
node_satellite_prior -.->|"supplies map priors"| node_fusion_optimizer
node_fusion_optimizer -->|"converts coordinates"| node_wgs84
node_fusion_optimizer -.->|"writes fused route"| node_route
node_operator -->|"starts live demo"| node_realtime
node_realtime -->|"filters live positions"| node_kalman

click node_main "https://github.com/sagigile/navigationdrone/blob/main/Main.py"
click node_extract_reference "https://github.com/sagigile/navigationdrone/blob/main/build_once/extract_reference.py"
click node_frame_io "https://github.com/sagigile/navigationdrone/blob/main/src/frame_io.py"
click node_telemetry "https://github.com/sagigile/navigationdrone/blob/main/src/telemetry.py"
click node_build_map "https://github.com/sagigile/navigationdrone/blob/main/build_once/build_map_hloc.py"
click node_geo_alignment "https://github.com/sagigile/navigationdrone/blob/main/src/geo_align.py"
click node_colmap "https://github.com/sagigile/navigationdrone/blob/main/src/colmap_model.py"
click node_config "https://github.com/sagigile/navigationdrone/blob/main/src/config.py"
click node_query_localize "https://github.com/sagigile/navigationdrone/blob/main/build_once/localize_query_video.py"
click node_rerank "https://github.com/sagigile/navigationdrone/blob/main/pipeline/fast_rerank_query_reference_matches.py"
click node_anchor_vo "https://github.com/sagigile/navigationdrone/blob/main/pipeline/anchor_vo_v2.py"
click node_satellite_prior "https://github.com/sagigile/navigationdrone/blob/main/pipeline/option2_satellite_prior.py"
click node_fusion_optimizer "https://github.com/sagigile/navigationdrone/blob/main/pipeline/option2_fusion_optimizer.py"
click node_kalman "https://github.com/sagigile/navigationdrone/blob/main/src/kalman.py"
click node_wgs84 "https://github.com/sagigile/navigationdrone/blob/main/src/wgs84.py"
click node_kml "https://github.com/sagigile/navigationdrone/blob/main/src/kml_export.py"
click node_realtime "https://github.com/sagigile/navigationdrone/blob/main/RealTime_Demo.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_extract_reference,node_frame_io,node_telemetry,node_build_map,node_geo_alignment toneBlue
class node_main,node_query_localize,node_rerank,node_realtime toneAmber
class node_anchor_vo,node_satellite_prior,node_fusion_optimizer,node_route toneMint
class node_colmap,node_config,node_kalman,node_wgs84,node_kml toneRose
class node_operator toneIndigo
```

## Components

### Reference Mapping

- [Reference extraction](https://github.com/sagigile/navigationdrone/blob/main/build_once/extract_reference.py): `build_once/extract_reference.py`
- [Frame extraction](https://github.com/sagigile/navigationdrone/blob/main/src/frame_io.py): `src/frame_io.py`
- [Telemetry parsing](https://github.com/sagigile/navigationdrone/blob/main/src/telemetry.py): `src/telemetry.py`
- [SfM map builder](https://github.com/sagigile/navigationdrone/blob/main/build_once/build_map_hloc.py): `build_once/build_map_hloc.py`
- [Geo alignment](https://github.com/sagigile/navigationdrone/blob/main/src/geo_align.py): `src/geo_align.py`

### Query Localization

- [Offline entry](https://github.com/sagigile/navigationdrone/blob/main/Main.py): `Main.py`
- [Query localization](https://github.com/sagigile/navigationdrone/blob/main/build_once/localize_query_video.py): `build_once/localize_query_video.py`
- [Match reranking](https://github.com/sagigile/navigationdrone/blob/main/pipeline/fast_rerank_query_reference_matches.py): `pipeline/fast_rerank_query_reference_matches.py`
- [Real-time demo](https://github.com/sagigile/navigationdrone/blob/main/RealTime_Demo.py): `RealTime_Demo.py`

### Trajectory Fusion

- [Anchor and VO route](https://github.com/sagigile/navigationdrone/blob/main/pipeline/anchor_vo_v2.py): `pipeline/anchor_vo_v2.py`
- [Satellite map priors](https://github.com/sagigile/navigationdrone/blob/main/pipeline/option2_satellite_prior.py): `pipeline/option2_satellite_prior.py`
- [Robust fusion](https://github.com/sagigile/navigationdrone/blob/main/pipeline/option2_fusion_optimizer.py): `pipeline/option2_fusion_optimizer.py`

### Geospatial Core

- [COLMAP model reader](https://github.com/sagigile/navigationdrone/blob/main/src/colmap_model.py): `src/colmap_model.py`
- [Configuration](https://github.com/sagigile/navigationdrone/blob/main/src/config.py): `src/config.py`
- [Kalman filter](https://github.com/sagigile/navigationdrone/blob/main/src/kalman.py): `src/kalman.py`
- [WGS84 transforms](https://github.com/sagigile/navigationdrone/blob/main/src/wgs84.py): `src/wgs84.py`
- [KML export](https://github.com/sagigile/navigationdrone/blob/main/src/kml_export.py): `src/kml_export.py`

### Other components

- **Operator / video**
- **Localized route**

## Connections

- Operator / video → Offline entry: starts offline (evidence: `README.md`)
- Offline entry → Robust fusion: runs offline fusion
- Operator / video → Reference extraction: provides reference flights
- Reference extraction → Frame extraction: extracts frames (evidence: `build_once/extract_reference.py`)
- Frame extraction → Telemetry parsing: reads telemetry (evidence: `src/frame_io.py`)
- Operator / video → SfM map builder: provides reference images
- SfM map builder → Configuration: loads settings (evidence: `build_once/build_map_hloc.py`)
- Operator / video → Geo alignment: provides reference metadata
- Geo alignment → COLMAP model reader: reads image poses (evidence: `src/geo_align.py`)
- Geo alignment → WGS84 transforms: converts coordinates (evidence: `src/geo_align.py`)
- Operator / video → Query localization: provides query video
- Query localization → Frame extraction: extracts query frames (evidence: `build_once/localize_query_video.py`)
- Query localization → Configuration: loads settings (evidence: `build_once/localize_query_video.py`)
- Query localization → Kalman filter: smooths locations (evidence: `build_once/localize_query_video.py`)
- Query localization → WGS84 transforms: converts coordinates (evidence: `build_once/localize_query_video.py`)
- Query localization → KML export: exports route (evidence: `build_once/localize_query_video.py`)
- Match reranking → Anchor and VO route: ranks reference matches
- Anchor and VO route → WGS84 transforms: converts anchor positions (evidence: `pipeline/anchor_vo_v2.py`)
- Anchor and VO route → Robust fusion: supplies initial route
- Satellite map priors → Robust fusion: supplies map priors
- Robust fusion → WGS84 transforms: converts coordinates (evidence: `pipeline/option2_fusion_optimizer.py`)
- Robust fusion → Localized route: writes fused route
- Operator / video → Real-time demo: starts live demo (evidence: `README.md`)
- Real-time demo → Kalman filter: filters live positions (evidence: `RealTime_Demo.py`)
