# isphada2002-tech/3d-drone-double-dqn-numpy architecture

> Architecture diagram of the GitHub repository isphada2002-tech/3d-drone-double-dqn-numpy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/isphada2002-tech/3d-drone-double-dqn-numpy
- Repository: https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy

## Overview

This repository is a NumPy-based 3D drone-navigation simulation that loads satellite elevation data, simulates drift and terrain clearance, and trains a Double DQN agent to correct the flight path. Its main workflow runs in `Drone-agent-3D.py`; `ddqn_agent.py` implements action selection, replay-based learning, and weight persistence. The README documents collision avoidance, target navigation, and the pre-trained weights. The graph follows the shown calls; visualization is integrated into the simulation script rather than a separate runtime module.

Main entry points: [`Drone-agent-3D.py`](https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/Drone-agent-3D.py) (Flight simulation), [`ddqn_agent.py`](https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/ddqn_agent.py) (Double DQN agent), [`ddqn_weights.pkl`](https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/ddqn_weights.pkl) (Saved weights), [`output_AW3D30.tif`](https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/output_AW3D30.tif) (Elevation raster)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_environment["Flight environment"]
  node_elevation_data["Elevation raster<br/>[output_AW3D30.tif]"]
  node_terrain["Terrain preparation<br/>[Drone-agent-3D.py]"]
  node_flight_sim["Flight simulation<br/>[Drone-agent-3D.py]"]
  node_clearance_reward["Clearance and reward<br/>[Drone-agent-3D.py]"]
  node_visualization["3D visualization<br/>[Drone-agent-3D.py]"]
end

subgraph group_learning["DDQN learning"]
  node_agent["Double DQN agent<br/>[ddqn_agent.py]"]
  node_action_selection["Action selection<br/>[ddqn_agent.py]"]
  node_replay_buffer["Replay buffer<br/>[ddqn_agent.py]"]
  node_network_learning["Network learning<br/>[ddqn_agent.py]"]
end

subgraph group_outputs["Model and results"]
  node_saved_weights["Saved weights<br/>[ddqn_weights.pkl]"]
  node_reward_plots["Reward plots<br/>[Drone-agent-3D.py]"]
end

node_operator(("Operator"))

node_operator -->|"runs"| node_flight_sim
node_flight_sim -->|"reads"| node_elevation_data
node_flight_sim -->|"prepares"| node_terrain
node_flight_sim -->|"initializes"| node_agent
node_agent -->|"loads"| node_saved_weights
node_flight_sim -->|"computes"| node_clearance_reward
node_flight_sim -->|"requests action"| node_action_selection
node_flight_sim -->|"stores transitions"| node_replay_buffer
node_flight_sim -->|"trains"| node_network_learning
node_network_learning -->|"samples"| node_replay_buffer
node_agent -->|"saves"| node_saved_weights
node_flight_sim -->|"updates"| node_visualization
node_flight_sim -->|"plots rewards"| node_reward_plots

click node_elevation_data "https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/output_AW3D30.tif"
click node_terrain "https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/Drone-agent-3D.py"
click node_flight_sim "https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/Drone-agent-3D.py"
click node_clearance_reward "https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/Drone-agent-3D.py"
click node_visualization "https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/Drone-agent-3D.py"
click node_agent "https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/ddqn_agent.py"
click node_action_selection "https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/ddqn_agent.py"
click node_replay_buffer "https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/ddqn_agent.py"
click node_network_learning "https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/ddqn_agent.py"
click node_saved_weights "https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/ddqn_weights.pkl"
click node_reward_plots "https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/Drone-agent-3D.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_elevation_data,node_terrain,node_flight_sim,node_clearance_reward,node_visualization toneBlue
class node_agent,node_action_selection,node_replay_buffer,node_network_learning toneAmber
class node_saved_weights,node_reward_plots toneMint
class node_operator toneIndigo
```

## Components

### Flight environment

- [Elevation raster](https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/output_AW3D30.tif): `output_AW3D30.tif`
- [Terrain preparation](https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/Drone-agent-3D.py): `Drone-agent-3D.py`
- [Flight simulation](https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/Drone-agent-3D.py): `Drone-agent-3D.py`
- [Clearance and reward](https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/Drone-agent-3D.py): `Drone-agent-3D.py`
- [3D visualization](https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/Drone-agent-3D.py): `Drone-agent-3D.py`

### DDQN learning

- [Double DQN agent](https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/ddqn_agent.py): `ddqn_agent.py`
- [Action selection](https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/ddqn_agent.py): `ddqn_agent.py`
- [Replay buffer](https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/ddqn_agent.py): `ddqn_agent.py`
- [Network learning](https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/ddqn_agent.py): `ddqn_agent.py`

### Model and results

- [Saved weights](https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/ddqn_weights.pkl): `ddqn_weights.pkl`
- [Reward plots](https://github.com/isphada2002-tech/3d-drone-double-dqn-numpy/blob/main/Drone-agent-3D.py): `Drone-agent-3D.py`

### Other components

- **Operator**

## Connections

- Operator → Flight simulation: runs (evidence: `README.md`)
- Flight simulation → Elevation raster: reads (evidence: `Drone-agent-3D.py`)
- Flight simulation → Terrain preparation: prepares (evidence: `Drone-agent-3D.py`)
- Flight simulation → Double DQN agent: initializes (evidence: `Drone-agent-3D.py`)
- Double DQN agent → Saved weights: loads (evidence: `ddqn_agent.py`)
- Flight simulation → Clearance and reward: computes (evidence: `Drone-agent-3D.py`)
- Flight simulation → Action selection: requests action (evidence: `Drone-agent-3D.py`)
- Flight simulation → Replay buffer: stores transitions (evidence: `Drone-agent-3D.py`)
- Flight simulation → Network learning: trains (evidence: `Drone-agent-3D.py`)
- Network learning → Replay buffer: samples (evidence: `ddqn_agent.py`)
- Double DQN agent → Saved weights: saves
- Flight simulation → 3D visualization: updates (evidence: `Drone-agent-3D.py`)
- Flight simulation → Reward plots: plots rewards (evidence: `Drone-agent-3D.py`)
