# Safe Multi-Agent Reinforcement Learning for UAVs
This project studies how to add explicit safety constraints to reinforcement
learning policies for UAVs. It connects two complementary tracks:
- **safe-control-gym benchmarks**: single-agent, model-based safety methods such
as CBF, MPSC, NMPC, and PPO safety layers.
- **Safe PyFlyt MARL experiments**: multi-agent UAV tasks in PyFlyt, comparing
unconstrained IPPO with safety-aware variants for quadrotor hover and
fixed-wing dogfight scenarios.
The core idea is a **safety wrapper** between the policy and the simulator. A
MARL policy proposes an action, the safety module checks constraints such as
collision distance, speed limits, altitude, attitude, and actuator smoothness,
then executes either the original action or the closest safer correction.
## Poster and Visuals
Open the full-resolution poster PDF
| Fixed-wing dogfight | QuadX swarm |
| --- | --- |
| | |
Additional PyFlyt visualizations are available in `assets/`:
`Fixedwing_Waypoint.gif`, `QuadX_Waypoint.gif`, and `QuadX_Pole_Balance.gif`.
## Motivation
UAV deployment is moving from single-agent control to multi-agent swarms. This
raises safety requirements that plain reward shaping does not reliably satisfy:
- inter-agent collision avoidance
- stall and overspeed prevention
- altitude bounds
- pitch and roll limits
- actuator and slew-rate limits
PyFlyt provides realistic Gymnasium and PettingZoo-compatible UAV environments,
but does not enforce formal runtime safety. safe-control-gym provides CBF and
MPSC safety filters with symbolic dynamics, but is mostly single-agent. This
repository uses safe-control-gym as the safety reference point and PyFlyt as the
multi-agent simulation target.
## Repository Layout
```text
.
|-- assets/ # GIF visualizations for PyFlyt tasks
|-- poster/ # Final poster PDF
|-- safe-control-gym-benchmarks/ # CBF, MPSC, NMPC, PPO benchmark scripts/results
`-- safe-marl …