Welcome to the MDS Simulation Server Setup Guide. This document aims to provide a comprehensive set of instructions to set up your own drone simulation server, based on the mavsdk_drone_show GitHub repository. The repository was created in Nov 2024 and is based on version 2.0 of the original project.
For a step-by-step walkthrough from version 0.1, you can follow our YouTube tutorial playlist. Links to these tutorials are available in the GitHub repository.
| Check out our detailed **100-Drone SITL Test in Clustered Cloud Servers | MDS Mavsdk Drone Show Version 2** video for a visual guide on setting up and running the simulation. |
The minimum resource allocation required for running two drone instances is 2 CPU cores and 4 GB of RAM.
Create a Virtual Machine (VM) based on your requirements. For example, using Linode, choose sufficient resources based on the number of drones you want to simulate.
Recommended OS: Ubuntu 22.04.
Although optional, it’s highly recommended to point a domain or subdomain to your drone server for ease of access and identification. You can use your existing domain or purchase a new one. If you are running on a local system, it is not needed.
Setting Up Cloudflare:
How to Add an A Record in Cloudflare:
drone.yourdomain.com.Tip: If you prefer, you can also continue to use the IP address of the server or Reverse DNS URLs.
ssh root@your_server_ip
First, ensure that your system package list and Python3 pip package are up-to-date by running the following commands:
sudo apt update
sudo apt install -y python3 python3-venv python3-pip tmux lsof
Install the Mediafire downloader to fetch the specialized drone image:
pip3 install git+https://github.com/Juvenal-Yescas/mediafire-dl
In your home directory, download the latest image:
mediafire-dl
If the script failed to download automatically from Mediafire (Mediafire Limitation), open this link in your browser, start downloading the file. Then pause the download and copy the download link. Now you can use wget to download the file as a workaround.
cd ~
wget https://www.mediafire.com/file/dw3kp5oxswr2c9g/drone-template_v2.tar/file
Install Docker:
sudo apt install docker.io
Load the downloaded image into Docker:
docker load < drone-template-v2.0.tar
This custom image is a plug-and-play solution built on Ubuntu 22.04. It includes:
Moreover, it has an auto hardware ID detection and instance creation system for automated drone instance creation.
If you wish to customize this image, you’ll need to load it into a Docker container and access its terminal bash for modifications. Follow these steps:
sudo docker run -it --name my-drone drone-template:latest /bin/bash
mavsdk_drone_show repository.mavsdk_drone_show repository in container home directory based on your own forked repository.
docker commit -m "Updated custom drone image" my-drone drone-template:v2.1
docker tag drone-template:v2.1 drone-template:latest
docker save -o ~/drone-template_v2.1.tar drone-template:v2.1
This will save your customizations into the Docker image. You can now proceed to use this customized image for your drone instances.
Install Portainer:
docker volume create portainer_data
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always \
-v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
YoAccess Portainer via the browser using your domain, IP address, or the reverse DNS provided by your hosting service like Linode. e.g., https://drone.YOUR_DOMAIN.com:9443
cd ~
git clone https://github.com/alireza787b/mavsdk_drone_show
cd mavsdk_drone_show
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
MDS’s swarm dashboard requires Node.js and npm. Install them by following the instructions for your operating system on the official Node.js website (version 20 using nvm is recommended).
Run the automated webserver setup and run script:
bash ~/mavsdk_drone_show/app/linux_dashboard_start.sh --sitl
.env file or use the --overwrite-ip "YOUR_SERVER_IP" argument.You should now be able to access the GUI via a browser using your domain, IP, or reverse DNS (if set). E.g., http://drone.YOUR_DOMAIN.com:3030
Note: If you can’t access the page, make sure your firewall rules allow communication on ports 3030, 7070, 5000 (defined in
paramsand.env).
You can configure your mission, swarm design, or drone show using SkyBrush or similar tools.
Remember, if you want to make any changes to these configurations, you should push those changes to your own forked GitHub repo; otherwise, none of these settings will take effect and will be overwritten (pulled) from the main MDS repo.
Certainly! Below is the updated Run Drone Instances section for your README. It is structured to cater to both novice users and advanced users who wish to deploy drones across multiple servers (VPS). The section includes clear instructions, detailed explanations, and links to additional resources for advanced configurations.
SSH into Your Server:
Open a terminal and connect to your server via SSH:
ssh root@Your_Server_IP
Navigate to the Repository Directory:
Once connected, navigate to the project directory:
cd ~/mavsdk_drone_show
Create Drone Instances:
Use the create_dockers.sh script to create the desired number of drone instances. Replace <number_of_instances> with the number of drones you wish to deploy.
bash multiple_sitl/create_dockers.sh <number_of_instances>
Example: To create 2 drone instances:
bash multiple_sitl/create_dockers.sh 2
Explanation: The script create_dockers.sh initializes Docker containers representing your simulated drones. The number “2” specifies how many drones to create. Ensure your server has sufficient resources (CPU, memory, disk space) to handle the specified number of drones. The created instances will appear in your Portainer container list, where you can manage, monitor, and remove them as needed.
Hints: For debugging purposes, use the
--verboseflag to create a single drone and view detailed logs.
sudo bash multiple_sitl/create_dockers.sh 1 --verbose
For advanced users aiming to deploy drones across multiple servers (VPS) to scale up the simulation, follow these guidelines:
Each server should operate within a distinct Docker network subnet to prevent IP conflicts. By default, the script uses 172.18.0.0/24. Subsequent servers can utilize 172.19.0.0/24, 172.20.0.0/24, etc. (We will keep the GCS centralized on first VPS)
bash multiple_sitl/create_dockers.sh 50 --subnet 172.18.0.0/24 --start-id 1 --start-ip 2 # On server 1
bash multiple_sitl/create_dockers.sh 50 --subnet 172.19.0.0/24 --start-id 51 --start-ip 2 # On server 2
--subnet SUBNET: (Optional) Specify a custom Docker network subnet. Defaults to 172.18.0.0/24 if not provided.--start-id START_ID: (Optional) Define the starting drone ID. Defaults to 1 if not specified.--start-ip START_IP: (Optional) Set the starting IP address’s last octet within the subnet. Defaults to 2 to avoid reserved IPs.Note: Ensure that each server’s subnet does not overlap with others to prevent network conflicts. To enable communication between drones across different subnets (i.e., different servers), set up a network routing solution such as Netbird managed routing.
Netbird is a zero-config VPN solution that allows you to easily and securely connect your devices, including your server and local PC. This is especially useful if you want to set up a Ground Control Station (e.g., QGroundControl) on your local PC or smartphone and monitor your drone’s data in real-time. Netbird is recommended for this setup to ensure efficient and secure data transmission.
While you have the option to use port forwarding, ZeroTier, or even VNC for a server remote desktop (not recommended), Netbird stands out for its ease of use, reliability, security, and ability to self-host.
Netbird is primarily needed if you are running your GCS and webserver on a remote server (like in this example in the cloud). If you are running everything locally, you won’t need to set up Netbird.
Open a new terminal tab and SSH into your server:
ssh root@Your_Server_IP
Once connected, run the following command:
curl -fsSL https://pkgs.netbird.io/install.sh | sh
Run:
sudo netbird up
If you are running your own self-hosted Netbird server, add --management-url YOUR_NETBIRD_SERVER_URL to the above command.
On your server terminal, you will be provided with a join request link. Copy this link and open it on your local PC or smartphone, logging in with the same account you used to set up Netbird on your PC. This ensures both the server and your local PC are on the same network with assigned Netbird IPs.
To receive MAVLink packets on your local machine and use a GCS like QGroundControl, you will need to install Netbird on your local device. Netbird is available for a wide range of platforms including Windows, macOS, Linux, Android, and iOS.
Follow the installation guidelines for your specific platform from the Netbird official download page.
After installation, open Netbird and hit “connect”. You might need to login using the same account credentials you used for the server-side installation. This action will automatically join your device to your Netbird network and assign a unique Netbird IP address to your device.
You can manage your devices, check their statuses, and even revoke access via the Netbird admin panel or your own domain if you self-hosted Netbird.
To access each drone container node, you can create a route on Docker subnet “172.17.0.0/16” on the server node from the Netbird management panel.
# On the local system
ping SERVER_GCS_NETBIRD_IP
# On the server
ping LOCAL_GCS_NETBIRD_IP
Running these ping tests ensures that both the server and local machines are connected within the Netbird network. If the pings are successful, you can proceed to set up the MAVLink routing.
MAVLink Router serves as a middleware to forward MAVLink packets between different endpoints. In this setup, it’s essential for routing MAVLink data from your server GCS to your local GCS.
When your drones are being managed by a GCS on the server, the MAVLink data packets they generate are initially sent to that server-side GCS. However, you may also want this data to be accessible on a local GCS for easier monitoring and control. MAVLink Router allows you to achieve this by routing these data packets to another GCS located on your local machine or your smartphone.
Before we proceed with the MAVLink routing, we first need to ensure MAVLink Router is installed on the server. Follow these steps to install MAVLink Router:
cd ~/mavsdk_drone_show
sudo bash tools/mavlink-router-install.sh
This script will handle the installation process for MAVLink Router. Once completed, you can proceed with configuring the router.
mavlink-routerd -e LOCAL_GCS_NETBIRD_IP:24550 0.0.0.0:34550
Here’s what each parameter means:
-e LOCAL_GCS_NETBIRD_IP:24550: This specifies the endpoint where MAVLink messages will be forwarded. Replace LOCAL_GCS_NETBIRD_IP with the Netbird IP of your local machine. The port 24550 is where your local GCS is listening for incoming MAVLink messages.0.0.0.0:34550: This is the port on the server where the MAVLink messages are received from the drones. In this example, it’s port 34550.
Note: You might need to open these ports in your firewall (eg. ufw or iptables):
sudo ufw allow 14550/udp sudo ufw allow 24550/udp sudo ufw allow 34550/udp sudo ufw allow 5000or
sudo iptables -A INPUT -p udp --dport 14550 -j ACCEPT sudo iptables -A INPUT -p udp --dport 24550 -j ACCEPT sudo iptables -A INPUT -p udp --dport 34550 -j ACCEPT sudo iptables -A INPUT -p udp --dport 5000 -j ACCEPT sudo iptables -A INPUT -p tcp --dport 5000 -j ACCEPT sudo iptables-save | sudo tee /etc/iptables/rules.v4
In the given command, MAVLink messages are being sent initially on port 34550 to the first GCS (server-side), and then routed to port 24550 for the second GCS (local). These port numbers can be modified in the params.py file as per your requirements.
On your local GCS, open QGroundControl and navigate to ‘Application Settings’ > ‘Comm Links’. Create a new comm link, name it (e.g., ‘server1’), check the ‘High Latency’ mode, set the connection type to ‘UDP’, set the port to 24550, and add the server (SERVER_GCS_NETBIRD_IP). Save and select this comm link to connect. All your drones should now be auto-detected.
While its not yet fully implemented, soon MDS will rely more on MAVLink2REST. If you setup the routing and Netbird network, you should be able to access each drone via REST API on port 8088 eg. http://172.18.0.2:8088 . visit MAVLINK2REST documentation for more.
Once you are done, head over to the Portainer container menu and remove the drone instances you created. This will help save disk resources.
If you encounter any issues during this setup, here are some common troubleshooting steps:
Congratulations, you’ve successfully set up a drone swarm SITL on a remote server! You’re now able to:
Please note that this project is still in its early development phases. Many aspects have not been designed with security or performance in mind. Your contributions to improve these aspects are welcome. Feel free to collaborate, post recommendations, or report issues.
While SITL simulations are great for testing, they are not a substitute for real-world validation. Do not use this software in real-world applications unless you have conducted extensive tests in SITL and are confident about the network, drone hardware, and environment you’re operating in. Even then, proceed with the utmost caution and at your own risk and be prepared with failsafe scenarios.
We are committed to regularly updating this project to make it a reliable product soon. Thank you for your interest, and happy flying!
For more detailed information, you can consult the following:
For more tutorials, code samples, and ways to contact me, check out the following resources:
© 2024 Alireza Ghaderi
mavsdk_drone_show - Alireza Ghaderi
This documentation is licensed under CC BY-SA 4.0. Feel free to reuse or modify according to the terms. Please attribute and link back to the original repository.