Daniele1209 / Swarm-Behavior-in-Multi-Agent-Drone-Systems

Using Multiagent Reinforcement Learning in PyBullet Gym environments for Drone Swarm behavior

Home Page:https://utiasDSL.github.io/gym-pybullet-drones/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gym-pybullet-drones

This is a (minimalist) refactoring of the original gym-pybullet-drones repository, designed for compatibility with gymnasium and stable-baselines3 2.0.

formation flight control info

Installation

git clone https://github.com/utiasDSL/gym-pybullet-drones.git
cd gym-pybullet-drones/

conda create -n drones python=3.10
conda activate drones

pip3 install --upgrade pip
pip3 install -e .

At the time of writing, stable-baselines3 2.0's alpha can be installed from PyPI

pip3 install "sb3_contrib>=2.0.0a1" --upgrade
pip3 install "stable_baselines3>=2.0.0a1" --upgrade

Use

PID position control example

cd gym_pybullet_drones/examples/
python3 pid.py

PPO RL example

cd gym_pybullet_drones/examples/
python3 learn.py

Betaflight SITL example

In one terminal, run the Betaflight SITL binary

git clone  https://github.com/betaflight/betaflight
cd betaflight/
make TARGET=SITL # comment out this line: https://github.com/betaflight/betaflight/blob/c41b458e5891205da50465caeec0c1aa83beeb0c/src/main/main.c#L52
betaflight/obj/main/betaflight_SITL.elf

In another terminal, run the example

cd gym_pybullet_drones/examples/
python3 beta.py

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.

Citation

If you wish, please cite our IROS 2021 paper as

@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

TODO

  • IMU transforms in Betaflight SITL example
  • Flatten dict observations/action into np.arrays (with wrapper?)
  • Replace aggregate_phy_steps with simulation and control frequencies
  • Add motor delay
  • Replace rpy with quaternions and ang_vel with body rates
  • Replace BaseSingleAgentAviary and BaseMultiAgentAviary with RLAviary
  • Add pointer in README.md to the original master branch
  • Add yaml configuration files
  • Add stable-baselines3 2.0 support/examples
  • Add pytests/GitHub Action for learning examples
  • Add cffirmware SITL support

University of Toronto's Dynamic Systems Lab / Vector Institute / University of Cambridge's Prorok Lab

About

Using Multiagent Reinforcement Learning in PyBullet Gym environments for Drone Swarm behavior

https://utiasDSL.github.io/gym-pybullet-drones/

License:MIT License


Languages

Language:Python 99.7%Language:Shell 0.3%