11th of January, 2024

Setting up Skybrush for more than 250 drones

Setting up Skybrush for more than 250 drones
Skybrush Team
Skybrush Team

Most outdoor show drones use MAVLink as their communication protocol towards the ground station. MAVLink has a built-in limitation that a single MAVLink network can only have 255 systems connected to it, and the ground station itself also counts as a system, so the typical recommendation is that one MAVLink network is inherently limited to about 250 drones. Typically, the access points (APs) that are used to set up the wifi network between drones are also set up by default in a way that they can handle at most 254 devices, including the ground station and any other devices that you may connect to the drone network. However, it is easy to get around this limitation by using multiple APs, one for each group of 250 drones, and by defining multiple MAVLink networks in the Skybrush Server configuration file. If you are lucky enough to own industry-grade access points and routers that can easily cope with more than 250 devices, you can also get around with using one wifi network, but you would still need to create multiple MAVLink networks and ensure that the MAVLink networks do not interfere with each other.

Since most people start out small and then try to scale up to larger shows without buying new network equipment, we will describe the multiple-AP option first.

Imagine that you would like to create a show that uses 500 drones. As said above, you cannot have more than 250 drones in a single /24 IP network so you will need two routers, two network interfaces in your ground station (so you can connect to both routers at the same time), and two groups of 250 drones. You can follow the instructions of the Skybrush documentation to set up the two groups as if you were dealing with two entirely separate drone swarms – the only thing you need to watch out for is to use different IP networks for them. If you use the 192.168.0.0/16 class C private network block (as described in the documentation), pick two independent /24 networks like 192.168.10.0/24 and 192.168.11.0/24. Drones in the first network can then be assigned to IP addresses 192.168.10.1, 192.168.10.2 and so on, while drones in the second network can be assigned to 192.168.11.1, 192.168.11.2 and so on. The ground station must have an allocated IP address in both networks as you will be connecting to both networks from your laptop at the same time. The UDP ports used by the drones and the GCS can be left at 14550 and 14555, just as described in the documentation.

Then, once the drones are configured, you will need to modify the default Skybrush server configuration file (skybrush.jsonc) that comes with the server to define two MAVLink networks instead of a single network. The default configuration file looks similar to this (comments omitted):

{
  "EXTENSIONS": {
    "http_server": {
      "host": ""
    },
    "rtk": {
      "add_serial_ports": [9600, 57600]
    },
    "mavlink": {
      "enabled": true,
      "networks": {
        "mav": {
          "connections": ["default"]
        }
      }
    }
  }
}

The important part here is the "networks" section, which contains a single network specification. The "default" value in "connections" means that Skybrush will listen for incoming MAVLink heartbeat packets on all network interfaces, and then latch on to the first network interface where such a heartbeat packet is seen. This is clearly not what we want here; we need two networks instead. One should listen for MAVLink heartbeat packets on the first network interface of the GCS, and the other one should listen for MAVLink heartbeat packets on the second network interface. Suppose that your laptop is assigned to IP addresses 192.168.10.254 and 192.168.11.254 on the two networks. Then you need to modify the "mavlink" section of the configuration file like this (other sections are omitted):

    "mavlink": {
      "enabled": true,
      "networks": {
        "mav1": {
          "connections": ["udp-listen://192.168.10.254:14550?broadcast_port=14555"]
        },
        "mav2": {
          "connections": ["udp-listen://192.168.11.254:14550?broadcast_port=14555"],
          "id_offset": 250
        },
      }
    }

There are two key changes to the configuration file: we have two MAVLink networks instead of one, and the second network also has an ID offset of 250. This means that 250 is added to the MAVLink system ID of each drone in the second network when its Skybrush ID is derived – this way we can achieve that drones in the second network are numbered from 251 (the lowest valid MAVLink system ID is 1) instead of from 1.

If you are fortunate enough to own network equipment that can easily handle more than 250 devices, you can get around with using one network interface in the ground station as you will only have one AP to connect to. However, you will still need to set up the drones in groups of 250 and configure the MAVLink networks accordingly. Here is how to do this.

The trick that we are going to use is that we separate the MAVLink networks by UDP port numbers. In the default Skybrush setup, drones and the GCS communicate via UDP ports 14550 and 14555, and the drones ignore UDP packets that are sent to any other UDP port. One can thus easily define multiple MAVLink networks by using different UDP port combinations; for instance, you can keep on using 14550 and 14555 for MAVLink network 1 and 14650 and 14655 for MAVLink network 2. You need to set up the wifi modules of the drones accordingly by changing the port numbers in the configuration screen of the wifi module, and then you should use the following "mavlink" section in the Skybrush server configuration file:

    "mavlink": {
      "enabled": true,
      "networks": {
        "mav1": {
          "connections": ["udp-listen://192.168.10.254:14550?broadcast_port=14555"]
        },
        "mav2": {
          "connections": ["udp-listen://192.168.10.254:14650?broadcast_port=14655"],
          "id_offset": 250
        },
      }
    }

Note that the IP address of the GCS is still hardcoded, but now it is the same IP address in both sections – but the port numbers are different!

Going beyond 500 drones #

Needless to say, both of the above methods can be extended for more than two MAVLink networks so you could easily scale up to thousands of drones if you have the resources and the appropriate network equipment. Note that at this scale, the drones themselves can generate quite a lot of network traffic, so make sure that your network equipment is able to cope with it. If you use multiple APs, it makes sense to configure the APs to different wifi channels (say, 1, 6 and 11 if you have 3 APs) to reduce inteference between networks.

As always, feel free to contact us on Discord for feedback. We also offer commercial support for people with a Pro license if you need help with setting up a large swarm with more than 250 drones.

Cover photo by Brian Suh on Unsplash

essential