File size: 2,409 Bytes
5b3c5de
 
2ddbf65
 
 
 
 
 
 
 
 
 
5b3c5de
2ddbf65
 
 
 
 
 
 
7d40aab
 
2ddbf65
 
 
 
 
 
 
7d40aab
2ddbf65
 
 
 
 
 
 
 
7d40aab
2ddbf65
 
 
 
 
 
 
 
 
 
 
7d40aab
 
2ddbf65
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
license: agpl-3.0
tags:
- reservoir-computing
- echo-state-networks
- connectomics
- drone-control
- robotics
- pybullet
- neuroscience
metrics:
- rmse
---

# Fly Connectome Echo State Network for Drone Control

This repository contains research and simulation code that utilizes biological neural connectivity data (the connectome of the *Drosophila melanogaster* fruit fly) as the reservoir inside an **Echo State Network (ESN)** to perform autonomous drone flight control.

## Project Overview

* **Biological Reservoir**: The network reservoir is built from the synaptic connectivity graph of the fly brain. We scale the spectral radius of the graph below `1.0` to guarantee the Echo State Property and stabilize dynamics.
* **Drone Control Task**: The ESN outputs 4D control signals (target velocities: $v_x$, $v_y$, $v_z$, and yaw rate) from a 12D drone state vector.
* **Simulation Environment**: Real-time evaluation is conducted using `gym-pybullet-drones`, a physics engine simulating ground effect, aerodynamic drag, and rotor downwash.

## Directory Structure

```text
flydrone-esn/
β”‚
β”œβ”€β”€ LICENSE                       # AGPL 3.0 license file
β”œβ”€β”€ README.md                     # English documentation (with HF YAML front matter)
β”œβ”€β”€ README.txt                    # Detailed Turkish documentation
β”‚
└── src/                          # Code files
    β”œβ”€β”€ utils.py                  # Core mathematics and ESN reservoir helpers
    β”œβ”€β”€ database_interaction.ipynb # CAVE API client for retrieving connectome synapses
    β”œβ”€β”€ drone_realtime_simulation.py # Script to run the trained model in PyBullet and log video
    β”œβ”€β”€ classes_by_cell_type.csv  # Neuron cell classifications
    β”œβ”€β”€ W_drone_components.pkl    # Pre-trained ESN drone controller weights
    └── networks_graphs/          # Connectome .graphml data files
```

## Setup and Quick Start

### 1. Install Dependencies
Make sure you have python 3.10 installed, then run:
```bash
pip install -r requirements.txt
```

### 2. Run the Real-time Simulation
To run the pre-trained ESN-controlled drone in the PyBullet simulator with a graphical interface, run:
```bash
python src/drone_realtime_simulation.py
```
This runs the simulation and logs third-person and first-person camera flight recordings to `drone_third_person.mp4` and `drone_first_person.mp4` in your directory.