AI Swarm Drones
Overview: A 180-day curriculum to develop multi-agent RL for drone swarms in two scenarios: (a) Defense/Search-and-Rescue – drones coordinate for formation flying, area surveillance, and threat neutralization; (b) Logistics/Delivery – drones optimally deliver packages cooperatively, managing battery and routing. Using Microsoft AirSim (multi-drone support) and OpenAI Gym/PettingZoo environments, you will explore decentralized decision-making and advanced multi-agent RL algorithms like QMIX and MADDPG. The program covers multi-agent coordination, cooperative vs adversarial training, and robust engineering (monitoring each agent, reproducible multi-agent training). By the end, you’ll demonstrate a swarm in simulation handling both defense and delivery tasks with learned policies.
- Tech Stack: AirSim (Unreal Engine based simulator for drones, supports multiple vehicles), with Python APIs. Alternative simulators: Microsoft Project Bonsai (for industrial-scale training), Flightmare (Unity-based quadrotor sim for massive parallel training), Unity ML Agents (for custom multi-agent environments). Frameworks: RLlib or Stable Baselines3 (multi-agent support via PettingZoo wrapper), PyTorch for custom networks (graph neural nets for swarm, etc.), OpenAI Gym for standard interface. Use ROS if integrating with PX4 firmware (optional for high fidelity).
- Key Algorithms & Papers: Multi-Agent DDPG (MADDPG by Lowe et al. 2017 for mixed cooperative-competitive tasks), QMIX (Rashid et al. 2018 for cooperative value factorization), Multi-agent PPO variants and self-play for adversarial scenarios. Formation control literature (Reynolds flocking, but here learned via RL). Decentralized vs Centralized training paradigm (CTDE). Cooperative multi-agent exploration (e.g., coverage path planning).
- Project Repos & Resources: AirSim GitHub (multi-vehicle examples), Gym-PyBullet-Drones (open-source multi-drone reinforcement learning environment), Unity ML-Agents examples (multi-agent soccer, etc.), PettingZoo MARL library for environment handling, MSRA’s Bonsai docs for machine teaching, Flightmare paper (CoRL 2020) for large-scale drone sim. Logging each agent’s reward and training curves with frameworks that support multi-agent (Tensorboard’s multi-run charts or custom vis).
Block 1 (Days 1–15): Environment Setup & Multi-Agent RL Basics
- Day 1-5: Set up AirSim and confirm multi-drone capability. For instance, use AirSim’s APIs to spawn multiple drone vehicles and control them independently. Explore AirSim’s built-in environments (urban city, forest, etc.) or import a simple open field. In parallel, review multi-agent RL fundamentals: non-stationarity in multi-agent systems (each agent’s learning affects others). Establish a codebase structure to handle N agents (e.g., a loop for each agent’s action selection and a shared memory for global state if needed). Initialize a Git repo and use dummy tests (two drones making random moves) to ensure the simulation loop runs without sync issues.
- Day 6-10: Implement a simple multi-agent environment for testing: e.g., two drones in a 2D grid (in code, not AirSim) that must reach two target points. This allows quick turn-around to verify your multi-agent RL pipeline (observation parsing, simultaneous actions). Use PettingZoo or OpenAI Gym’s multi-agent wrapper to manage agent step() calls. Deliverable: A basic multi-agent Gym environment and a script that makes multiple agents take random actions in sync, logging observations.
- Day 11-15: Integrate a basic multi-agent RL algorithm – start with Independent DQN for each agent (treat other agents as part of environment). Train on the simple grid environment where cooperation is needed (e.g., both must reach goals at same time). Observe issues (like non-stationarity causing training instability). Introduce the concept of centralized training, decentralized execution: during training, a “central” critic can see the global state. Set up logging to track each agent’s reward and a global reward. Deliverable: Successful training of two simple agents on a cooperative toy task, demonstrating the multi-agent training loop is working.
Block 2 (Days 16–30): Swarm Formation Control (Cooperative)
- Day 16-20: Move to the drone domain. Define a formation control task: e.g., 3–5 drones must maintain a geometric shape (say a V formation or a line) while moving to a target location. Simulation: in AirSim or a custom physics env, you have drones with continuous action (thrust, pitch, roll). Simplify initial state: use a 2D plane abstraction (x,y position of each drone). Reward each agent for staying close to its intended relative position and for the group moving toward the destination. This naturally requires cooperation (they must align speeds).
- Day 21-25: Apply a cooperative multi-agent RL algorithm. Use QMIX for value decomposition: it learns a Q-function for the team that factors into per-agent utilities under a monotonicity constraint. Set up QMIX with a central trainer that has access to all agents’ states during training. Train the drones to achieve and maintain formation. Track the team reward (e.g., negative if formation deviates). Gradually increase difficulty: start with static formation hovering, then add a moving target for the formation to travel to.
- Day 26-30: Evaluate formation stability. Use metrics like average inter-drone distance error from desired, and success in reaching the target. Possibly compare with a non-learning baseline (e.g., a simple PID formation controller if available). Visualize the learned formation: record AirSim footage of drones taking off and forming the pattern. Deliverable: A multi-drone policy that can achieve a stable formation flight to a goal. For example, drones take off and arrange in a “triangle” and move together to a specified location. This demonstrates learned coordination (citing that QMIX enables centralized learning of decentralized policies).
Block 3 (Days 31–45): Search-and-Rescue – Coverage and Target Detection
- Day 31-35: Scenario setup: an area (e.g., a grid of 1 km²) where a “target” (lost person or a hazard) is present at a random location. The swarm (say 3 drones) must cooperatively search the area to locate the target quickly. Each drone’s observation could be a binary “found target” flag plus its coordinates; if using AirSim, use drone cameras and a simple color-based object detection to simulate finding a target (e.g., target is a red marker on the ground). Reward can be based on time to detection (negative time penalty, big +1000 reward when target found, shared among drones).
- Day 36-40: Train a cooperative policy for area coverage. Use multi-agent PPO (which can handle continuous actions for positioning). Encourage divergent exploration: e.g., part of reward shaping gives a small bonus for covering new area (measured by how far a drone is from its teammates – encouraging them to spread out). This is a multi-agent exploration problem. Possibly maintain a memory of visited locations (could be part of state for each agent if using a centralized critic).
- Day 41-45: Test the swarm search policy. Measure how quickly and reliably the team finds the target compared to random search or a lawnmower pattern. Ensure that communication is only implicit (agents act on observations, not directly telling each other positions during execution, to simulate decentralized operation). Incorporate obstacles in area (buildings or no-fly zones) to see if drones learn to partition the search space. Deliverable: A demonstration of 3 drones starting together then fan out to cover a large area, efficiently locating the target. This showcases learned emergent behavior akin to optimal search patterns without explicit scripting.
Block 4 (Days 46–60): Adversarial Scenario – Drone Defense
- Day 46-50: Defense scenario: introduce an intruder drone (simulated as an agent or moving target) that invades a protected airspace. The friendly swarm (e.g., 2 interceptor drones) must chase and intercept the intruder. This is a pursuit-evasion game – a classic adversarial multi-agent task. Define reward: +100 to the team if they intercept (come within a certain distance of intruder), -100 if intruder escapes from a boundary or after a time limit. The intruder could be controlled by a simple heuristic (straight line or random evasive maneuvers) initially, and later as a learned agent (self-play).
- Day 51-55: Use self-play training: treat the intruder as one agent and the defenders as cooperating agents. Apply MADDPG algorithm which handles mixed competitive/cooperative environments by giving each agent (including intruder) an actor-critic that observes others’ policies during training. Train the interceptors to minimize intruder’s reward (catch it), and the intruder to maximize its own (avoid capture). This two-sided learning can be unstable; employ techniques like policy freezing (train defenders while intruder uses fixed policy, then vice versa) to stabilize.
- Day 56-60: Evaluate the outcome of self-play. Often this leads to clever evasive tactics and coordinated interception strategies. For example, two drones might pincer the intruder from both sides. Analyze using metrics: interception time, distance maintained by intruder. Possibly find that policies oscillate (one gets better, then the other) – mention need for equilibrium (like use of population based training or fencing parameters). Deliverable: A trained pair of policies for interceptors (cooperative) and intruder (adversarial) demonstrating basic predator-prey dynamics. In a simulation replay, the defense drones should collaboratively corner the intruder. This block highlights training in adversarial multi-agent settings, as per Lowe et al.’s MADDPG approach.
Block 5 (Days 61–75): Multi-Agent Path Planning for Delivery
- Day 61-65: Switch to logistics domain. Scenario: multiple delivery drones must deliver packages to multiple locations. This can be framed as each drone having a set of delivery points and needing to return to base when done (or for battery). Simplify by discretizing possible locations or use continuous but small region. State per drone: its current location, remaining battery, and remaining delivery tasks. Global objective: minimize total delivery time (or maximize deliveries within battery constraints).
- Day 66-70: Formulate as cooperative multi-agent RL with a shared reward (e.g., negative of total time or number of deliveries completed). Use QMIX again or a centralized critic to help coordinate. Challenges include task allocation – which drone takes which delivery. Introduce this implicitly: if two drones head for the same package, they waste effort. Reward shaping: slight penalty if two drones are very close en route (to discourage duplicate efforts). Possibly allow agents to see each others’ targets to decide.
- Day 71-75: Incorporate battery constraints. Each drone has a limited flight time; add a penalty for running out of battery before returning (simulate crash). The agents must learn not just shortest paths, but also to return to recharge in time. This creates an additional decision: when to interrupt deliveries to recharge (or to let another drone handle a far delivery). Deliverable: A simulation of, say, 3 drones and 5 delivery locations where the drones learn a sensible division of labor – e.g., each drone takes a subset of delivery points based on proximity, and all return to base with battery remaining. The swarm should complete all deliveries faster than a single drone approach would, showing effective parallelization.
Block 6 (Days 76–90): Decentralized Decision Making & Communication
- Day 76-80: Focus on decentralization. Ensure that the learned policies do not rely on a centralized controller at execution. To test this, run each drone’s policy on separate processes (or machines) with only local observations (and possibly a shared clock or minimal info). If performance drops, consider introducing communication actions in training (e.g., drones can broadcast a small vector that other drones receive). Train with a simple communication channel: one agent can output, say, a 2D vector (could encode its current goal or need) that others get as input. This effectively lets policies learn what info to share (if any).
- Day 81-85: Implement and experiment with communication-enabled policies. For example, in the delivery scenario, a drone low on battery might “communicate” that it needs help, and another drone might pick up its pending delivery. Use an algorithm like DIAL (Differentiable Inter-Agent Learning) or just backprop through a communication channel, treating it as part of joint action. Evaluate if this improves efficiency or success rate.
- Day 86-90: Advanced coordination: introduce unpredictable events to force coordination. In defense: maybe two intruders at once – drones must split up appropriately. In delivery: a delivery location changes or a new request comes mid-mission (online assignment). Test how the trained policies can adapt (may require retraining with such randomness to be robust). Highlight any learned emergent strategy, e.g., drones implicitly divide territory or take roles (leader-follower). Deliverable: Documentation of how adding a communication mechanism impacted performance. Possibly a brief demo where one drone signals something and others respond (e.g., blinking an LED in sim to signify communication). This block underscores the decentralized nature of swarm intelligence and how minimal communication can enhance it.
Block 7 (Days 91–105): Integration of Perception for Drones
- Day 91-95: Integrate more realistic perception. For defense: drones might have cameras to identify intruders (friend or foe detection). Implement a simple image classifier that distinguishes an intruder drone (perhaps marked with a color) from others or background, using AirSim’s camera feed. For delivery: use vision to detect delivery markers or to land precisely at a drop site (e.g., AprilTags or colored pads).
- Day 96-100: Combine the perception module with the RL policy. For instance, in search-and-rescue, replace the simulated “found target” event with an actual vision-based detection (the RL agent now must learn to move the drone’s camera over the target to detect it). This might require moving the drone in patterns to cover ground, which the earlier policy already encourages. Ensure the perception outputs (like “target seen”) are fed as observations.
- Day 101-105: Introduce environmental factors affecting perception: wind disturbance (drone position oscillates), or sensor noise. The RL policy should be retrained or fine-tuned to handle slightly noisy position info or false positives in detection. This brings the project closer to real-world conditions where sensor uncertainty exists. Deliverable: Enhanced demo of, say, a search mission where drones rely on onboard vision to find a colored object on the ground and then all converge to it. The success shows that the learned policy works with realistic sensors, not just ideal info.
Block 8 (Days 106–120): Large-Scale Simulations & Stress Testing
- Day 106-110: Scale up the number of agents. If previously using 3-5 drones, now test with 10 or more in a simulator (possibly switch to Flightmare which can simulate hundreds in parallel in a headless mode). Check if the learned policies generalize to larger swarm sizes (often they do if designed for decentralization). If not, retrain with more agents (this might require network architecture that can scale, like parameter sharing among agents or use of attention mechanisms to handle many agents).
- Day 111-115: Conduct stress tests for edge cases: e.g., in delivery, suddenly one drone fails (remove it mid-simulation) – can the others adapt to complete all deliveries? In defense, what if intruder is much faster than drones? Perhaps use curriculum to train drones to intercept faster intruders gradually. Log the system’s behavior under extreme conditions and identify any catastrophic failures.
- Day 116-120: Implement safety and reliability checks: for physical drones, you’d ensure no collisions between swarm members – simulate that in AirSim by checking distance between drones and adding a penalty for any near-collision. Train with that to ensure the learned policy has collision avoidance within the team as well (important for real deployments). Deliverable: A report on scalability and safety – e.g., “Policy X works up to 20 drones with only linear drop in performance, and maintains inter-drone separation > 2m at all times.” This proves the approach can handle larger swarms and is robust.
Block 9 (Days 121–135): Evaluation and Comparison
- Day 121-125: Evaluate the swarm policies against baselines. For the delivery scenario, baseline could be a centralized solver (like solving an assignment problem for deliveries and preset routes) – compare total time taken. For search, compare against lawnmower search or random search. For defense, compare against a non-RL heuristic where drones always head straight for intruder. Use metrics: efficiency (e.g., total distance flown), success rate, computation time (the learned policy should act in constant time, good for scalability).
- Day 126-130: Conduct ablation studies: turn off communication between agents to see impact, or test a single agent trying to do all deliveries vs the swarm to quantify benefit of multi-agent cooperation. Also, evaluate how well the trained agents adapt to slight changes: e.g., if a delivery location is moved, can they adjust without retraining (some approaches like meta-learning or having adaptive policies can be noted, though may be beyond current scope).
- Day 131-135: Incorporate human-in-the-loop testing: for example, a human operator can issue a high-level command to the swarm (like “focus search in north sector” or “deliver priority package first”). Ensure the system can take such input – maybe by adjusting the reward on the fly or switching policies. Test this in simulation by manually altering goals during an episode and observing swarm response. Deliverable: An evaluation document with quantitative results tables and possibly graphs (e.g., number of deliveries vs time for learned policy vs baseline). This validates the RL approach against traditional methods and shows where it excels (e.g., dynamically adapting to changes).
Block 10 (Days 136–150): Deployment Readiness and Engineering
- Day 136-140: Port the simulation code to a more deployable framework. If using AirSim, ensure it can run in real-time for a live demo (with rendering on). Optimize any bottlenecks (like heavy logging disabled, inference optimized perhaps with TorchScript). If Unity was used, build a standalone app for the environment.
- Day 141-145: Implement monitoring tools for a real deployment. For instance, a dashboard that shows each drone’s battery, status, and actions in real-time. This could be a simple console or a GUI that plots drone trajectories live. This is important for convincing stakeholders of the swarm’s decision-making and for debugging if something goes wrong.
- Day 146-150: Set up CI/CD for multi-agent system: automated tests where, for example, 5 episodes of the delivery scenario are run in headless mode and final total times are checked against a threshold (to ensure no regression). Use containerization (Docker or similar) for the training environment so others can reproduce the training results easily. Document how to retrain the models from scratch and get the same performance (seed and hyperparam configs in a config file). Deliverable: A “deployment kit” including the trained policies for both scenarios, a simulation playback tool or dashboard, and a reproducibility report (ensuring that training can be restarted and yield similar results, which is non-trivial in multi-agent RL but addressed by consistent procedures).
Block 11 (Days 151–165): Final Demos – Defense and Delivery Scenarios
- Day 151-155: Plan and script a defense scenario demo. Perhaps set up a situation in AirSim’s city environment: an intruder drone comes in low over the city, and 3 defender drones launch from a rooftop. Show the defenders tracking and intercepting the intruder before it reaches a certain point. Record this from multiple camera angles (attach cameras to drones or use spectator). Ensure the demo highlights cooperation (e.g., drones flanking the intruder).
- Day 156-160: Plan a delivery scenario demo. For example, simulate a warehouse rooftop where 4 drones pick up packages and deliver to various points around a small town, avoiding a no-fly zone (like an airspace near a building) and then returning. Visualize package pickups/drops (maybe not physically simulated fully, but indicated with messages or LED colors on drones). Possibly use different drone colors to distinguish, and trail lines in visualization to show their routes.
- Day 161-165: Rehearse the demos to ensure reliability. Because of the stochastic nature of RL policies, record multiple runs and choose the best representative runs for presentation. Prepare explanations for what the swarm is doing at each step (“Drone A goes to far customer, Drone B and C split closer deliveries – an emergent division of labor”). Deliverable: Two polished demo videos (or live demo scripts) – one for the defense scenario, one for the delivery scenario – each ~2-3 minutes long, showing the swarm completing the mission. These will be used in the final presentation to exemplify the project outcomes.
Block 12 (Days 166–180): Project Conclusion and Handoff
- Day 166-170: Write the final technical report. Include an introduction to objectives, the approach for each scenario, details of the multi-agent algorithms used (with citations to MADDPG, QMIX, etc.), and results. Highlight key learnings like “decentralized training with QMIX achieved X% better coverage than independent training” or “MADDPG enabled coordinated chasing behavior”. Include screenshots from simulations as figures.
- Day 171-175: Finalize documentation and code comments. Ensure that someone else can run the simulation and understand how to tweak parameters. Create a user manual if this is delivered to a non-developer audience (describing how to start the defense or delivery simulation and what knobs they can turn, e.g., number of drones, area size). Address potential real-world considerations (GPS noise, communication delays) in a discussion section to show awareness of deployment gaps.
- Day 176-180: Handoff meeting and future work discussion. Present the demos and results to the team or stakeholders. Provide all artifacts (code repo, trained models, report). Suggest next steps: for defense, perhaps transferring the policy to real drones (using PX4 SITL with AirSim in HIL mode); for delivery, maybe integrating with a real drone fleet management software or adding more constraints (weather, payload weights). Emphasize how the engineering practices (CI, logging) will help maintain the project. Deliverable: Complete project deliverables handed off – including the multi-agent RL training pipeline, ready-to-run simulations for both use cases, and thorough documentation – marking the successful completion of the 6-month swarm drone RL training program.