This project demonstrates the control of a swarm of four drones in a simulated environment using ROS, Gazebo, MAVROS, and ArduPilot SITL. The drones perform coordinated movements in specific formations, utilizing waypoints defined in custom C++ scripts.
- Multi-Drone Simulation: Four drones simulated using ArduPilot SITL and Gazebo.
- Waypoint Navigation: Each drone navigates predefined waypoints, maintaining formation.
- Formation Control: Custom C++ scripts control the drones to move in patterns like squares, rectangles, or circles.
- Automated Launch: A bash script automates launching the simulation, MAVROS nodes, and control scripts.
- ROS Noetic: Middleware for robotic systems.
- Gazebo: 3D simulation environment.
- ArduPilot SITL: Software-in-the-loop simulation for drones.
- MAVROS: Communication between ROS and MAVLink-compatible drones.
- C++: Setpoint scripts for controlling drone movements.
- Operating System: Ubuntu 20.04
- Software Requirements:
- ROS Noetic
- Gazebo (compatible version with ROS Noetic)
- ArduPilot SITL
- MAVROS and MAVROS-Extras
-
Update your system and install ROS Noetic:
sudo apt update sudo apt install ros-noetic-desktop-full
-
Install MAVROS and MAVROS Extras:
sudo apt install ros-noetic-mavros ros-noetic-mavros-extras
-
Install GeographicLib datasets for MAVROS:
wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh sudo bash install_geographiclib_datasets.sh
-
Ensure Gazebo and ArduPilot SITL are installed:
- Follow Gazebo Installation Guide
- Follow ArduPilot SITL Installation Guide
git clone https://github.com/yourusername/multi_drone_control.git
cd multi_drone_control-
Create a new ROS workspace and copy the project:
mkdir -p ~/catkin_ws/src cp -r multi_drone_control ~/catkin_ws/src/
-
Build the workspace:
cd ~/catkin_ws catkin_make source devel/setup.bash
Use the provided bash script to initialize all components in separate terminals:
./scripts/run_simulation.shThis script will:
- Launch Gazebo with a multi-drone world.
- Start SITL instances for each drone.
- Launch MAVROS nodes for communication.
- Run custom setpoint control scripts for all drones.
- View the simulation in Gazebo.
- Use
rostopicto monitor MAVROS topics:rostopic echo /uav1/mavros/state
To modify the drone trajectories:
- Edit the respective setpoint scripts in the
scripts/directory (e.g.,setpoint_node1.cpp). - Rebuild the workspace after making changes:
cd ~/catkin_ws catkin_make
multi_uav_sim/
├── README.md # Project documentation
├── scripts/ # Bash and C++ scripts
│ ├── run_simulation.sh # Script to automate simulation setup
│ ├── setpoint_node1.cpp # Setpoint control script for Drone 1
│ ├── setpoint_node2.cpp # Setpoint control script for Drone 2
│ ├── setpoint_node3.cpp # Setpoint control script for Drone 3
│ ├── setpoint_node4.cpp # Setpoint control script for Drone 4
├── worlds/ # Gazebo world files
│ ├── iris_multiuav.world # Multi-drone simulation world
├── launch/ # Launch files for ROS
│ ├── multi.launch # Launch file for multi-drone Gazebo world
│ ├── mavros_apm.launch # MAVROS launch file template
├── docs/ # Documentation assets
│ ├── images/ # Screenshots and figures
├── LICENSE # Project license
└── .gitignore # Ignored files
![Watch the video demonstration]
Click here to watch the video directly on YouTube
- Fork the repository and create a feature branch for your changes.
- Commit changes with meaningful messages.
- Create a pull request for review.
This project is licensed under the MIT License. See the LICENSE file for details.