# pearwpi/asternav architecture

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

- Interactive diagram: https://gitdiagram.com/pearwpi/asternav
- Repository: https://github.com/pearwpi/asternav

## Overview

AsterNav is a darkness-capable aerial navigation system built around structured-light depth estimation. Its workflow generates synthetic image/depth pairs, trains AsterNet, optionally converts it for TensorRT, then estimates depth from onboard imagery, plans obstacle-avoiding motion, and sends commands to a Pixhawk via MAVLink. The README documents the major capabilities; unsampled source limits details of dataset internals, camera wiring, and runtime data handling.

Main entry points: [`Training/train.py`](https://github.com/pearwpi/asternav/blob/main/Training/train.py) (Training pipeline), [`Inference/autonomous_navigation.py`](https://github.com/pearwpi/asternav/blob/main/Inference/autonomous_navigation.py) (Navigation runtime), [`Inference/convert_to_trt.py`](https://github.com/pearwpi/asternav/blob/main/Inference/convert_to_trt.py) (TensorRT conversion), [`Inference/infer_depth.py`](https://github.com/pearwpi/asternav/blob/main/Inference/infer_depth.py) (Depth estimator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Data and training"]
  node_data_sources(("Base images and PSFs"))
  node_generator["Synthetic data generator<br/>[datagen.py]"]
  node_paired_data[("Image/depth dataset<br/>[datagen.py]")]
  node_trainer["Training pipeline<br/>[train.py]"]
  node_network["AsterNet model<br/>[model.py]"]
  node_checkpoint["Model checkpoint"]
end

subgraph group_depth["Depth inference"]
  node_converter["TensorRT conversion<br/>[convert_to_trt.py]"]
  node_engine["TensorRT engine"]
  node_depth_estimator["Depth estimator<br/>[infer_depth.py]"]
  node_depth_tools["Inference utilities<br/>[utils.py]"]
end

subgraph group_flight["Autonomous flight"]
  node_camera(("Onboard camera"))
  node_navigation["Navigation runtime"]
  node_planner["Potential-field planner<br/>[planner.py]"]
  node_controller["MAVLink controller"]
  node_pixhawk(("Pixhawk drone"))
end

node_data_sources -->|"provides inputs"| node_generator
node_generator -->|"generates pairs"| node_paired_data
node_trainer -->|"runs generation"| node_generator
node_trainer -->|"loads training data"| node_paired_data
node_trainer -->|"trains"| node_network
node_trainer -->|"saves weights"| node_checkpoint
node_converter -->|"loads architecture"| node_network
node_converter -->|"loads weights"| node_checkpoint
node_converter -->|"exports engine"| node_engine
node_camera -->|"provides frames"| node_navigation
node_navigation -->|"requests depth"| node_depth_estimator
node_depth_estimator -.->|"runs optimized model"| node_engine
node_depth_estimator -->|"uses backend utilities"| node_depth_tools
node_navigation -->|"requests motion plan"| node_planner
node_navigation -->|"queues flight commands"| node_controller
node_controller -->|"sends MAVLink"| node_pixhawk

click node_generator "https://github.com/pearwpi/asternav/blob/main/Training/datagen.py"
click node_paired_data "https://github.com/pearwpi/asternav/blob/main/Training/datagen.py"
click node_trainer "https://github.com/pearwpi/asternav/blob/main/Training/train.py"
click node_network "https://github.com/pearwpi/asternav/blob/main/Training/model.py"
click node_converter "https://github.com/pearwpi/asternav/blob/main/Inference/convert_to_trt.py"
click node_depth_estimator "https://github.com/pearwpi/asternav/blob/main/Inference/infer_depth.py"
click node_depth_tools "https://github.com/pearwpi/asternav/blob/main/Inference/utils.py"
click node_navigation "https://github.com/pearwpi/asternav/blob/main/Inference/autonomous_navigation.py"
click node_planner "https://github.com/pearwpi/asternav/blob/main/Inference/planner.py"
click node_controller "https://github.com/pearwpi/asternav/blob/main/Inference/mavlink_controller.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_data_sources,node_generator,node_paired_data,node_trainer,node_network,node_checkpoint toneBlue
class node_converter,node_engine,node_depth_estimator,node_depth_tools toneAmber
class node_camera,node_navigation,node_planner,node_controller,node_pixhawk toneMint
```

## Components

### Data and training

- **Base images and PSFs**
- [Synthetic data generator](https://github.com/pearwpi/asternav/blob/main/Training/datagen.py): `Training/datagen.py`
- [Image/depth dataset](https://github.com/pearwpi/asternav/blob/main/Training/datagen.py): `Training/datagen.py`
- [Training pipeline](https://github.com/pearwpi/asternav/blob/main/Training/train.py): `Training/train.py`
- [AsterNet model](https://github.com/pearwpi/asternav/blob/main/Training/model.py): `Training/model.py`
- **Model checkpoint**

### Depth inference

- [TensorRT conversion](https://github.com/pearwpi/asternav/blob/main/Inference/convert_to_trt.py): `Inference/convert_to_trt.py`
- **TensorRT engine**
- [Depth estimator](https://github.com/pearwpi/asternav/blob/main/Inference/infer_depth.py): `Inference/infer_depth.py`
- [Inference utilities](https://github.com/pearwpi/asternav/blob/main/Inference/utils.py): `Inference/utils.py`

### Autonomous flight

- **Onboard camera**
- [Navigation runtime](https://github.com/pearwpi/asternav/blob/main/Inference/autonomous_navigation.py): `Inference/autonomous_navigation.py`
- [Potential-field planner](https://github.com/pearwpi/asternav/blob/main/Inference/planner.py): `Inference/planner.py`
- [MAVLink controller](https://github.com/pearwpi/asternav/blob/main/Inference/mavlink_controller.py): `Inference/mavlink_controller.py`
- **Pixhawk drone**

## Connections

- Base images and PSFs → Synthetic data generator: provides inputs (evidence: `README.md`)
- Synthetic data generator → Image/depth dataset: generates pairs (evidence: `README.md`)
- Training pipeline → Synthetic data generator: runs generation (evidence: `Training/train.py`)
- Training pipeline → Image/depth dataset: loads training data (evidence: `Training/train.py`)
- Training pipeline → AsterNet model: trains (evidence: `Training/train.py`)
- Training pipeline → Model checkpoint: saves weights (evidence: `README.md`)
- TensorRT conversion → AsterNet model: loads architecture (evidence: `Inference/convert_to_trt.py`)
- TensorRT conversion → Model checkpoint: loads weights (evidence: `README.md`)
- TensorRT conversion → TensorRT engine: exports engine (evidence: `README.md`)
- Onboard camera → Navigation runtime: provides frames (evidence: `Inference/autonomous_navigation.py`)
- Navigation runtime → Depth estimator: requests depth (evidence: `Inference/autonomous_navigation.py`)
- Depth estimator → TensorRT engine: runs optimized model (evidence: `README.md`)
- Depth estimator → Inference utilities: uses backend utilities (evidence: `Inference/infer_depth.py`)
- Navigation runtime → Potential-field planner: requests motion plan (evidence: `Inference/autonomous_navigation.py`)
- Navigation runtime → MAVLink controller: queues flight commands (evidence: `Inference/autonomous_navigation.py`)
- MAVLink controller → Pixhawk drone: sends MAVLink (evidence: `Inference/mavlink_controller.py`)
