This project implements an AI system to control a swarm of unmanned aerial vehicles (UAVs) for tracking and monitoring pollutant clouds. The simulation includes realistic UAV dynamics, UAV-to-UAV communication, battery life limitations, and cloud dispersion models.
The system simulates a swarm of UAVs that work together to track and monitor the concentration of pollutants in a moving cloud. Each UAV is equipped with:
- Sensors to detect pollutant concentration
- GPS for navigation
- Communication capabilities to coordinate with other UAVs
- A limited battery life
The UAVs use a combination of swarm intelligence algorithms to efficiently track the cloud while avoiding collisions with each other.
- Realistic UAV dynamics with velocity and turn rate constraints
- Simulated sensor noise and GPS error
- Inter-UAV communications with message delay
- Collision avoidance algorithms
- Pheromone-based coordination strategy
- Battery life simulation with random failures
- Two different cloud dispersion models for testing
- Easy-to-use configuration interface
sim_start.m
: Main simulation script that runs the simulationUavBrain.m
: Implements the AI decision-making logic for each UAVUavBody.m
: Physical model of the UAV with movement constraintsUavState.m
: Defines the states for the UAV state machinePheremone.m
andPheremoneType.m
: Implements the pheromone-based coordination systemMessage.m
: Defines the communication protocol between UAVs
cloudplot.m
: Visualization for the pollution cloudcloudsamp.m
: Sampling function for pollution concentrationcloud1.mat
andcloud2.mat
: Pre-computed cloud dispersion data
moveRungeKutta.m
: Advanced movement calculationforwardEuler.m
: Simple movement calculationsqrLen.m
: Utility function for distance calculations
run_simulation.m
: Easy-to-use script for configuring and running simulationsvisualize_results.m
: Post-simulation analysis and visualization tool
- MATLAB R2014b or later
- No additional toolboxes required
There are two ways to run the simulation:
- Open MATLAB
- Navigate to the project directory
- Open and edit the parameters in
run_simulation.m
as desired - Run the script:
run_simulation
- Open MATLAB
- Navigate to the project directory
- Run the main simulation script with default parameters:
sim_start
The following parameters can be adjusted in run_simulation.m
:
uavCount
: Number of UAVs in the swarm (default: 24)dt
: Time step for simulation (default: 1.0 second)maxTime
: Maximum simulation time (default: 1800 seconds/30 minutes)uavBatteryFailProb
: Probability of a UAV having reduced battery life (default: 0.1)initialUavSpacing
: Initial spacing between UAVs (default: 50.0 meters)uavCrashRadius
: Minimum distance before UAVs crash (default: 15.0 meters)drawCloud
,drawUavs
,drawAI
,drawAIExtra
: Visualization optionscloudSelection
: Choose between different cloud models (1 or 2)
After running a simulation, you can analyze the results using the visualization tool:
- Make sure you've just completed a simulation (variables must be in memory)
- Run:
visualize_results
This will generate:
- UAV position plot with operational status
- Battery life distribution histogram
- UAV states pie chart
- Operational status summary
- Detailed statistics in the command window
The UAV swarm uses a distributed AI approach where each UAV:
- Takes sensor readings to detect pollutant concentration
- Communicates its position and findings to nearby UAVs
- Leaves virtual "pheromones" to mark searched areas
- Makes decisions based on local information and pheromone trails
- Avoids collisions with other UAVs
- Returns home when battery is low
After running the simulation, the system reports:
- Number of UAVs that failed to return to their launch spot
- Number of UAVs that crashed into other UAVs
- Number of UAVs that left the bounds of the map