This repository contains the simulation environment and training scripts for a deep reinforcement learning agent to control a quadcopter/drone in Python. Using OpenAI Gym (or Gymnasium) and Stable-Baselines3, you can train policies (e.g., PPO) to navigate the drone from a start point to a target point in 3D space, with options for video recording and custom callbacks.
- Custom Gym environment (
DroneGymEnv) with physics-based simulation - Support for single- and multi-environment vectorized training
- Pre-built PPO training and evaluation scripts
- TensorBoard logging and custom callbacks
- Video recording of rollouts (GIF)
- Python 3.8+
-
Clone this repository:
git clone https://github.com/henryplas/drone_rl.git cd drone_rl -
Create a virtual environment and activate it:
conda env create -f environment.yaml conda activate drone-rl
Run the main training script using PPO:
python train.py To record rollouts to an MP4:
python test.pydrone_rl/
├── drone.py # Custom Gym environment implementation
├── train.py # Training entry point
├── test.py # Video recording utility
├── environment.yaml # Python dependencies
├── tensorboard/ # TensorBoard and model outputs
└── README.md # This file
Contributions are welcome! Please open an issue or submit a pull request:
- Fork the repo
- Create a feature branch (
git checkout -b feature-name) - Commit your changes (
git commit -m "Add new feature") - Push to the branch (
git push origin feature-name) - Open a pull request
(TODO) Curriculum learning steps: add curriculum added pos-target to obs made the target easier used different shaping at first
- Smoothing out flight controls.
- Trajectory planning
- Playing tag via Multi Agent RL
This project is licensed under the MIT License. See LICENSE for details.
For questions or feedback, contact Henry Plaskonos at henry.plaskonos@gmail.com. Happy flying!
