Skip to content

Commit

Permalink
added git and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
L-ED committed Jun 6, 2024
1 parent 8890f94 commit 9b44c77
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 90 deletions.
94 changes: 16 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# gym-pybullet-drones
# RL_DRONE
Diploma work based on PyBullet physics simulator. Target of this work is to develop position control system using only following input data:
- linear and angular velocity in drone local coordinates
- projected gravity [orientation analog]
- position displacement

This is a minimalist refactoring of the original `gym-pybullet-drones` repository, designed for compatibility with [`gymnasium`](https://github.com/Farama-Foundation/Gymnasium), [`stable-baselines3` 2.0](https://github.com/DLR-RM/stable-baselines3/pull/1327), and SITL [`betaflight`](https://github.com/betaflight/betaflight)/[`crazyflie-firmware`](https://github.com/bitcraze/crazyflie-firmware/).
Also this work contains absolute position controllers from
https://github.com/utiasDSL/gym-pybullet-drones.git

> **NOTE**: if you prefer to access the original codebase, presented at IROS in 2021, please `git checkout [paper|master]` after cloning the repo, and refer to the corresponding `README.md`'s.
<img src="files/readme_images/helix.gif" alt="formation flight" width="350"> <img src="files/readme_images/helix.png" alt="control info" width="450">
<img src="files/imu_flight.gif" alt="formation flight" width="700">

## Installation

Tested on Intel x64/Ubuntu 22.04 and Apple Silicon/macOS 13.4.

```sh
git clone https://github.com/utiasDSL/gym-pybullet-drones.git
git clone https://github.com/L-ED/RL_Drone.git
cd gym-pybullet-drones/

conda create -n drones python=3.10
Expand All @@ -24,86 +25,23 @@ pip3 install -e . # if needed, `sudo apt install build-essentials` to install `g

## Use

### PID position control example
### RL Position Control from local coordinates

```sh
cd gym_pybullet_drones/examples/
python3 pid.py
python hover/hover_learn_multienv.py
```

### Stable-baselines3 PPO RL example
### PID position control example

```sh
cd gym_pybullet_drones/examples/
python3 learn.py
```

### Betaflight SITL example (Ubuntu only)

First, check the steps in the docstrings of [`beta.py`](https://github.com/utiasDSL/gym-pybullet-drones/blob/main/gym_pybullet_drones/examples/beta.py), then, in one terminal, run the Betaflight SITL binary

```sh
git clone https://github.com/betaflight/betaflight
cd betaflight/
make arm_sdk_install # if needed, `apt install curl``
make TARGET=SITL # comment out this line: https://github.com/betaflight/betaflight/blob/master/src/main/main.c#L52
betaflight/obj/main/betaflight_SITL.elf
python3 pid.py
```

In another terminal, run the example
### Stable-baselines3 PPO RL example

```sh
conda activate drones
cd gym_pybullet_drones/examples/
python3 beta.py # also check the steps in the file's docstrings
```

## Troubleshooting

- On Ubuntu, with an NVIDIA card, if you receive a "Failed to create and OpenGL context" message, launch `nvidia-settings` and under "PRIME Profiles" select "NVIDIA (Performance Mode)", reboot and try again.

Run all tests from the top folder with

```sh
pytest tests/
```

## Citation

If you wish, please cite our [IROS 2021 paper](https://arxiv.org/abs/2103.02142) ([and original codebase](https://github.com/utiasDSL/gym-pybullet-drones/tree/paper)) as

```bibtex
@INPROCEEDINGS{panerati2021learning,
title={Learning to Fly---a Gym Environment with PyBullet Physics for Reinforcement Learning of Multi-agent Quadcopter Control},
author={Jacopo Panerati and Hehui Zheng and SiQi Zhou and James Xu and Amanda Prorok and Angela P. Schoellig},
booktitle={2021 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)},
year={2021},
volume={},
number={},
pages={7512-7519},
doi={10.1109/IROS51168.2021.9635857}
}
```

## References

- Carlos Luis and Jeroome Le Ny (2016) [*Design of a Trajectory Tracking Controller for a Nanoquadcopter*](https://arxiv.org/pdf/1608.05786.pdf)
- Nathan Michael, Daniel Mellinger, Quentin Lindsey, Vijay Kumar (2010) [*The GRASP Multiple Micro UAV Testbed*](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.169.1687&rep=rep1&type=pdf)
- Benoit Landry (2014) [*Planning and Control for Quadrotor Flight through Cluttered Environments*](http://groups.csail.mit.edu/robotics-center/public_papers/Landry15)
- Julian Forster (2015) [*System Identification of the Crazyflie 2.0 Nano Quadrocopter*](https://www.research-collection.ethz.ch/handle/20.500.11850/214143)
- Antonin Raffin, Ashley Hill, Maximilian Ernestus, Adam Gleave, Anssi Kanervisto, and Noah Dormann (2019) [*Stable Baselines3*](https://github.com/DLR-RM/stable-baselines3)
- Guanya Shi, Xichen Shi, Michael O’Connell, Rose Yu, Kamyar Azizzadenesheli, Animashree Anandkumar, Yisong Yue, and Soon-Jo Chung (2019)
[*Neural Lander: Stable Drone Landing Control Using Learned Dynamics*](https://arxiv.org/pdf/1811.08027.pdf)
- C. Karen Liu and Dan Negrut (2020) [*The Role of Physics-Based Simulators in Robotics*](https://www.annualreviews.org/doi/pdf/10.1146/annurev-control-072220-093055)
- Yunlong Song, Selim Naji, Elia Kaufmann, Antonio Loquercio, and Davide Scaramuzza (2020) [*Flightmare: A Flexible Quadrotor Simulator*](https://arxiv.org/pdf/2009.00563.pdf)

## TODO

- [ ] Add `crazyflie-firmware` SITL support @spencerteetaert
- [ ] Add motor delay @JacopoPan / @spencerteetaert
- [ ] Replace `rpy` with quaternions (and `ang_vel` with body rates) in `obs` @JacopoPan
- [ ] Replace `BaseSingleAgentAviary` and `BaseMultiAgentAviary` with a single `RLAviary`, incl. PR #161 @JacopoPan
- [ ] Add a multi-agent MDP with 2-drone chase through a gate @JacopoPan

-----
> University of Toronto's [Dynamic Systems Lab](https://github.com/utiasDSL) / [Vector Institute](https://github.com/VectorInstitute) / University of Cambridge's [Prorok Lab](https://github.com/proroklab)
python3 learn.py
```
Binary file added files/imu_flight.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file removed files/logs/foo.txt
Empty file.
Binary file removed files/readme_images/2020.gif
Binary file not shown.
Binary file removed files/readme_images/dep.gif
Binary file not shown.
Binary file removed files/readme_images/downwash.gif
Binary file not shown.
Binary file removed files/readme_images/downwash.png
Binary file not shown.
Binary file removed files/readme_images/helix.gif
Binary file not shown.
Binary file removed files/readme_images/helix.png
Binary file not shown.
Binary file removed files/readme_images/rgb.gif
Binary file not shown.
Binary file removed files/readme_images/seg.gif
Binary file not shown.
12 changes: 0 additions & 12 deletions files/videos/ffmpeg_png2mp4.sh

This file was deleted.

0 comments on commit 9b44c77

Please sign in to comment.