This is an example page. It’s different from a blog post because it will stay in one place and will
The Micro Air Vehicle Link (MAVlink) is a light-weight serialization communication protocol for bidirectional communication between unmanned aerial vehicles/drone and GCS for bi-direction communication. The MAVlink protocol defines a complete set of messages that are exchanged between drone and ground stations. The generated libraries in this protocol are MIT-licensed and can be used without limits in any open or closed-source application without the need for publishing the source code. MAVLink was first released in 2009 by Lorenz Meier and is being supported by a large community of developers. This protocol is utilized by most widely used ArduPilot and PX4. The most popular autopilot software Ardupilot actively supported by a battery of enthusiasts all across for world for over a decade has seamless integration with this communication protocol.
The binary serialization makes it lightweight with minimal overhead. Due to its small size, it can be reliably utilized over wireless links including Wifi, low data rate telemetry links and even on internet. MAVlink protocol defines the mechanism on the structure of messages, how to serialize them at the application layer and way to forward to the lower layers (i.e., transport layer, physical layer) which can be transmitted on the network. As a result ,it can be transmitted through WiFi, Ethernet (i.e., TCP/IP Networks) or low-bandwidth serial telemetry links (namely 433 MHz, 868 MHz or 915 MHz). The use of these low-data rate frequencies allow for higher range of operations. MAVLink protocol ensures the reliability and integrity of messages by double checksum verification in its packet header.
MAVLink follows the latest hybrid publish-subscribe and point-to-point design pattern
- Data streams are sent or published as topics
- All configuration sub-protocols adopted in MAVlink protocol (e.g mission protocol) or parameter protocol are defined as point-to-point with retransmission.
Messages are defined in XML files. The message set supported by a particular MAVLink system referred as a “dialect”. The reference message set implemented by GCS and autopilots is defined in common.xml upon which most dialects are built upon. Code generators create software libraries for specific programming languages from XML message definitions. This is utilized by drones, ground control stations, and other MAVLink systems to communicate. All these features make MAVLink protocol the most utilized protocol.
In our drone setup, I have utilized IP Network to stream MAVlink messages. The IP network utilizes the private VPN over internet which will be explained in detail in next chapter. MAVLink protocol typically supports both UDP and TCP connections at the transport layer between the ground station and the drone. The choice between the two depends upon the reliability of the network link end to end. UDP is a connectionless datagram protocol which requires no connection between the client and server. It has no acknowledgement mechanism between sender and receiver ,making it less tolerant to errors. However, it is light-weight, fast and real time. On the other hand TCP protocol which adopts a connection oriented approach leading to multiple retransmissions and overheads leading to congestion. As a result, I have preferred UDP over TCP protocol for MAVlink over private VPN through 4G LTE Modem.
MAVLink being a binary telemetry protocol is designed for resource-constrained systems including bandwidth. It is deployed in two major versions: v1.0 and v2.0. v2.0 is backwards-compatible. The telemetry data streams are sent in a multicast design. The protocol aspects which change the system configuration requiring guaranteed delivery such as mission protocol or parameter protocol are point-to-point with retransmission capability.
A Ground Control Station (GCS) is a software application which communicates with the drone through a serial or network interface by exchanging MAVLink messages. The communication either takes place over serial port through a telemetry device or via a network interface using UDP or TCP over Wifi (Local Area Network or internet) or 4G Communication module like in our case. The aspect of MAVlink over internet is explained in detail subsequently. Various types of GCS are as below:-
Mission Planner is one of the most popular GCS which allows a number of customizations and is completely open source. It was created and is regularly supported by Michael Oborne. It runs on Windows platforms only. It has host of features from planning an autonomous mission to taking full control of the drone. It provides support for video streaming and changing the internal parameters of the autopilot along with the ability for calibration of the sensors of the autopilot. We can download logs and analyze flight performance post mission with support for simulations to improve piloting. All configurations of drone (FCU) can be done from here and is stored in log files for analysis. I have used Mission Planner as GCS for doing the project and dedicated a chapter to understanding and utilizing Mission Planner later in the thesis. Any reference to GCS from hereon will mean Mission Planner for the purpose of my thesis. Also I am using UDP over network interface established over private VPN over 4G LTE modem. 
QGroundControl is also a very famous QGC which supports both Ardupilot and PX4 autopilot applications. It supports the MAVLink protocol and has several functionalities, including defining and planning autonomous missions, complete control of the drone, graphical visualization of the map and location tracking of the drone through its GPS coordinates. It provides support for video streaming and changing the internal parameters of the autopilot along with the ability for calibration of the sensors of the autopilot. QGroundControl can run on different platforms, namely, Windows, Mac OS, IOS, and Android devices . However. QGroundControl has a lot of automated functions providing little less options than Mission Planner to customize drone settings. Hence, I preferred Mission Planner as GCS though the concept of utilization remains the same for both.
In Small Drones the MAVlink will be established directly between Beagle Bone Blue (BBB) which is a Linux based Flight Controller Unit (FCU) and Mission Planner which is the Ground Control Station (GCS) over UDP protocol. The link can be engineered over wifi (Local LAN) or over internet (VPN). This setup was tested with X-Type Drone as Beagle Bone Blue as acting like FCU and also onboard computer running Linux. The MAVlink is over private VPN using UDP protocol and 4G LTE Modem as hardware. This configuration is only possible with drones having Beagle Bone Blue as FCU.
In Medium and Large Drones the MAVlink is established indirectly between the FCU (in my case Beagle Bone Blue) and Mission Planner which is the Ground Control Station (GCS) via companion computer (Raspberry Pi 4 or Jetson Nano). The Flight controller Unit (FCU) is Beagle Bone Blue (BBB) but the configuration suggested is equally applicable to any other FCU (STM based running RTOS). The link between FCU and Companion computer will be through UART and companion computer to GCS over private VPN using UDP protocol and 4G LTE Modem. This setup was tested on both V-Type and Hexacopter. The difference was that V-Type has Raspberry Pi 4 as companion computer while Hexacopter has Jetson Nano as companion computer.
In order to be able to communicate with drone from ground station using MAVlink, we want to utilize the internet over 4G LTE Modem to achieve unlimited range of communication link. However, to be able to establish point to point link over internet we need to be able to route data packets over internet. This is possible with below mentioned options:-
Option 1 If we have dedicated IP addresses over internet purchased from Internet Service Provider (ISP) for each component namely FCU, Companion computer, GCS and any other networked station. Then we can route packets over internet between the FCU (in our case its Beagle Bone Blue) to GCS (in our case Mission Planner) either directly using MAVlink or indirectly through companion computer using MAVPROXY. MAVPROXY is a command line GCS and we will see the configuration of companion computer in later chapters. The advantage of this setup is its very simple and anybody can implement it. The disadvantage is that this setup requires purchase of IP Addresses which has monetary implications, the MAVlink is not encrypted and this setup results in dependency on a particular internet service provider.
Option II In the second option we have two variations. One is to use Dynamic DNS and a dedicated VPN Server to create own private network over Internet. This ensures encryption (MAVlink security) but requires dedicated infrastructure. The second variation of this option is to utilize VPN from a service provider through cloud-based services. i.e VPN as a service over cloud. This option allows the benefit of VPN (encrypted MAVlink between Drone and Ground Control Station) without any dedicated infrastructure needed to implement. Hence, I chose this option to implement my setup or rather demonstrate this proof of concept. I am utilizing cloud-based VPN services offered by OpenVPN. This website allows a registered user to create as many VPN clients but simultaneous use is restricted to three free clients. Beyond three one has to pay to avail services. The X Type quadcopter was used to demonstrate the small drone implementation while V Type quadcopter and Hexacopter were utilized to demonstrate medium/large drone setup to validate the proof of concept.
Step 1 Creating profile on OpenVPN cloud website https://myaccount.openvpn.com/ using email address.
Step 2 Create host profile like the one below for each of the client i.eBeagle Bone Blue based Flight Controller Unit (FCU), ground station, one for companion computer and one for Ground Control Station.
Step 3 Download the profile in .ovpn format for each client profile on your machine. I have created a VPN Folder where I have downloaded all the .ovpn files. These files give all the configuration details for the device to auto connect with VPN cloud.
Installation 4G LTE communication modem and running VPN as a service on Beagle Bone Blue (BBB) FCU for small drones
4G LTE Modem integration with Beagle Bone Blue Flight Controller Unit (FCU) Preparing Beagle Bone Blue to integrate with 4G LTE Modem over USB Connection.
Step 1 We need to prepare Beagle Bone Blue for connecting to 4G USB based dongle for internet access. Beagle Bone Blue does not connect to internet through 4G module via USB port but wifi as default option. But I don’t trust wifi of Beagle Bone Blue, hence prefer to connect to internet via USB port. Hence, we need to do the below steps to enable that. This is one reason why in all drones irrespective of companion computer being present on drone or not, I have connected 4G Module to Beagle Bone Blue so that I can take remote ssh reliably at any time. Companion computer connected to 4G Module over wifi. We need usb mode switch to enable networking through usb port. Thereafter, we enable DHCP so that IP allotted by 4G LTE modem can be utilized by Beagle Bone Blue.
sudo apt-get update
sudo apt-get install usb-modeswitch
ip addr show usb1
sudo nano /etc/network/interfaces
Add the following lines
#USB data dongle w/ onboard device (dynamic IP).
iface usb1 inet dhcp
Ctrl+O and then Ctrl+X. The config gets saved. Now Beagle Bone Blue can connect to internet via USB 4G LTE modem connected to it directly through USB port.
Step 2 Install Open VPN application on Beagle Bone Blue This step is required incase we want Beagle Bone Blue to connect to Ground Control Station (GCS) directly without companion computer. This is recommended for smaller drones only. In.order to establish MAVlink between Beagle Blue as FCU and Mission Planner as GCS over internet using VPN we need to install OpenVPN on Beagle Bone Blue. I do this step irrespective to be able to take remote ssh of Beagle Bone Blue over internet for any remote configuration check or troubleshooting.
sudo apt-get install openvpn
Use WinSCP application on windows to transport the folder VPN_Folder that contains all my .ovpn files. Let me remind you that the VPN_Folder contains .ovpn files for FCU, Companion computer and GCS. I only need .ovpn file that I created for Beagle Bone Blue from the folder. However, I am transporting the entire folder just for the ease of it. I will do the same process for Companion computer too later in the document to maintain uniformity. Please note the relevant file in VPN_Folder for me is bbbhexa_ssh.ovpn which I renamed after download from OpenVPN website as above. The folder was first copied to location /home/debian being default directory as shown below:-
Now move the folder from /home/debian to /etc/openvpn for execution
sudo mv /home/debian/VPN_Folder /etc/openvpn/
Step 3 Create systemd file for startup of VPN services at boot
sudo nano /lib/systemd/system/vpn.service
Add the following lines
sudo systemctl enable vpn.service
sudo systemctl start vpn.service
sudo systemctl status vpn.service
Now Beagle Bone Blue will connect to internet through 4G LTE Modem on startup and will be accessible over internet over VPN network. We need to find the IP Address of Beagle Bone Blue allotted to it over VPN Network. This will remain the defacto…………….. IP Address for taking ssh over internet or connecting to Ground Control Station (GCS) like mission planner explained later.
sudo systemctl daemon-reload (only to reload service incase some changes are made)
Its important to note that VPN as a service on Beagle Bone Blue is required only in small drones where Beagle Bone Blue which is the FCU also acts as onboard computer running Linux and establishes MAVlink with GCS. However, incase of medium and larger drones this work of MAVlink over VPN is done by Companion computers like Raspberry Pi 4 or Jetson Nano which will be explained in subsequent chapters. However, if we have a VPN profile to spare, its always a good idea to install VPN on Beagle Bone Blue too so that remote ssh can be taken to troubleshoot any errors on FCU. Also, the choice of 4G LTE Modem location is totally on user. I have proposed the idea of 4G LTE Modem being connected to USB port of Beagle Bone Blue meaning the modem gets powered by Beagle Bone Blue and internet is accessed over USB. The companion computer utilizes the wifi to connect to internet. You can always reverse the order of plugging 4G LTE Modem to companion computer and Beagle Bone Blue can connect to internet on wifi (medium or large drones). The choice is entirely on user. However, from experience I find the wifi reliability of Companion computer is much better than that of Beagle Bone Blue, hence I connect 4G LTE Modem to Beagle Bone Blue