Skip to content

Commit a39eff4

Browse files
committed
Readme and refactor
1 parent db84656 commit a39eff4

10 files changed

+65
-37
lines changed

.gitignore

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
myenv/
22
__pycache__/
33
output.mp4
4-
models/
5-
logs/
6-
videos/
7-
results/c_code/
8-
results/onnx/
9-
results/quantized/
4+
105

README

+59-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,75 @@
11
# G&C Network
22

3-
This project consists in training a feedfoward network using reinforcement learning to fly a drone through a set of gates. More information of this project can be found on the following scientific paper.
3+
This project consists in training a feedfoward network using reinforcement learning to fly a drone through a set of gates. For more information, consult the [Nano Drone Racing](https://github.com/fed12345/nano-drone-racing) repository.
44

55

66
## Description
7+
This is a repository to that create, trains and accelerates a nerual network, which handles the drone’s guidance and control functions. This network runs at an impressive rate of 167Hz on an STM32F405 processor, outputting attitude rates and thrust values for an attitude rate PID controller.
8+
9+
The steps that need to be carried out are:
10+
1. Carry out system identification of the drone
11+
2. Train the decided architerue and train NN
12+
3. Evaluate NN
13+
4. Convert it to C code via [ONNX](https://github.com/onnx/onnx)
14+
5. Deploy it on any drone autopilot for example [bitcraze](https://github.com/bitcraze/crazyflie-firmware)(this is not included in this repo)
715

8-
An in-depth paragraph about your project and overview of use.
916

1017
## Getting Started
1118

1219
### Dependencies
1320

14-
- Describe any prerequisites, libraries, OS version, etc., needed before installing the program.
15-
- ex. Windows 10
21+
- [Docker](https://docs.docker.com/engine/install/)
22+
- [Conda](https://www.anaconda.com/download) or Pip
1623

1724
### Installing
1825

19-
- How/where to download your program
20-
- Any modifications needed to be made to files/folders
26+
1. **Clone the repository:**
27+
28+
```bash
29+
git clone https://github.com/fed12345/controlnet
30+
cd controlnet
31+
```
32+
33+
34+
2. **Set Up a Virtual Environment (recommended)**
35+
36+
It’s a best practice to use a virtual environment to manage dependencies. To create a virtual environment, run the following command with conda installed:
37+
38+
```bash
39+
conda create --name controlnet
40+
conda activate controlnet
41+
```
42+
43+
3. **Intall Dependencies**
44+
45+
With the environment active, install all necessary packages by running:
46+
47+
```bash
48+
pip install -r requirements.txt
49+
```
50+
## Executing Progam
51+
52+
1. **Model Quadcopter**
53+
It is necessary to aquire some data on the dynamics on the drone, as we will model the droens response as a first over system in terms of roll, pitch, yaw and thrust. We desired states and measured stated.
54+
55+
We can then use the python modelling script to model the drone, the output will be a series of marticies which have to be inputted in the simulator:
56+
57+
```bash
58+
model_quadcopter.py
59+
```
60+
61+
2. **Training the Model**
62+
The training stage will save model in the
63+
```bash
64+
train_godzilla.py
65+
```
66+
67+
3. **Evaluate the model**
68+
69+
```bash
70+
run_sim.py
71+
```
72+
73+
2174

22-
### Executing program
2375

24-
- How to run the program
25-
- Step-by-step bullets
File renamed without changes.

evaluation/plot_log.py

-17
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
absl-py==1.4.0
2-
ale-py==0.7.4
32
anyio==4.0.0
43
appnope==0.1.3
54
argon2-cffi==23.1.0
@@ -144,3 +143,4 @@ websocket-client==1.6.3
144143
Werkzeug==2.3.7
145144
widgetsnbextension==4.0.8
146145
zipp==3.16.2
146+
ale-py==0.7.4

trainGodzilla.py train_godzilla.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ def run():
151151
import importlib
152152
from quadcopter_animation import animation
153153

154-
models_dir = 'models/PPO_INDI'
155-
log_dir = 'logs/PPO_INDI'
156-
video_log_dir = 'videos/PPO_INDI'
154+
models_dir = 'results/models/PPO_INDI'
155+
log_dir = 'resultslogs/PPO_INDI'
156+
video_log_dir = 'results/videos/PPO_INDI'
157157

158158
if not os.path.exists(models_dir):
159159
os.makedirs(models_dir)
@@ -220,4 +220,4 @@ def train(model, test_env, log_name, n=1000):
220220
all_items = os.listdir(models_dir + '/' + log_name)
221221

222222

223-
#train(model, test_env, 'INDI_TEST2_with_rate_penalty')
223+
train(model, test_env, 'INDI_TEST2_with_rate_penalty')

0 commit comments

Comments
 (0)