MAVLink or Micro Air Vehicle Link is a protocol for communicating with small unmanned vehicle. It is designed as a header-only message marshaling library. MAVLink was first released early 2009 [1] by Lorenz Meier under the LGPL license. [2]
It is used mostly for communication between a Ground Control Station (GCS) and Unmanned vehicles, and in the inter-communication of the subsystem of the vehicle. It can be used to transmit the orientation of the vehicle, its GPS location and speed.
In version 1.0 the packet structure is the following:
Field name | Index (Bytes) | Purpose |
---|---|---|
Start-of-frame | 0 | Denotes the start of frame transmission (v1.0: 0xFE) |
Payload-length | 1 | length of payload (n) |
Packet sequence | 2 | Each component counts up their send sequence. Allows for detection of packet loss. |
System ID | 3 | Identification of the SENDING system. Allows to differentiate different systems on the same network. |
Component ID | 4 | Identification of the SENDING component. Allows to differentiate different components of the same system, e.g. the IMU and the autopilot. |
Message ID | 5 | Identification of the message - the id defines what the payload “means” and how it should be correctly decoded. |
Payload | 6 to (n+6) | The data into the message, depends on the message id. |
CRC | (n+7) to (n+8) | Check-sum of the entire packet, excluding the packet start sign (LSB to MSB) |
After Version 2, the packet structure was expanded into the following: [3]
Field name | Index (Bytes) | Purpose |
---|---|---|
Start-of-frame | 0 | Denotes the start of frame transmission (v2: 0xFD) |
Payload-length | 1 | length of payload (n) |
incompatibility flags | 2 | Flags that must be understood for MAVLink compatibility |
compatibility flags | 3 | Flags that can be ignored if not understood |
Packet sequence | 4 | Each component counts up their send sequence. Allows for detection of packet loss. |
System ID | 5 | Identification of the SENDING system. Allows to differentiate different systems on the same network. |
Component ID | 6 | Identification of the SENDING component. Allows to differentiate different components of the same system, e.g. the IMU and the autopilot. |
Message ID | 7 to 9 | Identification of the message - the id defines what the payload “means” and how it should be correctly decoded. |
Payload | 10 to (n+10) | The data into the message, depends on the message id. |
CRC | (n+11) to (n+12) | Check-sum of the entire packet, excluding the packet start sign (LSB to MSB) |
Signature | (n+13) to (n+25) | Signature to verify that messages originate from a trusted source. (optional) |
To ensure message integrity a cyclic redundancy check (CRC) is calculated to every message into the last two bytes. Another function of the CRC field is to ensure the sender and receiver both agree in the message that is being transferred. It is computed using an ITU X.25/SAE AS-4 hash of the bytes in the packet, excluding the Start-of-Frame indicator (so 6+n+1 bytes are evaluated, the extra +1 is the seed value).
Additionally a seed value is appended to the end of the data when computing the CRC. The seed is generated with every new message set of the protocol, and it is hashed in a similar way as the packets from each message specifications. Systems using the MAVLink protocol can use a precomputed array to this purpose. [4]
The CRC algorithm of MAVLink has been implemented in many languages, like Python [5] and Java. [6] [7] [8]
The payload from the packets described above are MAVLink messages. Every message is identifiable by the ID field on the packet, and the payload contains the data from the message. An XML document in the MAVlink source [9] has the definition of the data stored in this payload.
Below is the message with ID 24 extracted from the XML document.
<messageid="24"name="GPS_RAW_INT"><description>Theglobalposition,asreturnedbytheGlobalPositioningSystem(GPS).ThisisNOTtheglobalpositionestimateofthesystem,butratheraRAWsensorvalue.SeemessageGLOBAL_POSITIONfortheglobalpositionestimate.Coordinateframeisright-handed,Z-axisup(GPSframe).</description><fieldtype="uint64_t"name="time_usec">Timestamp(microsecondssinceUNIXepochormicrosecondssincesystemboot)</field><fieldtype="uint8_t"name="fix_type">0-1:nofix,2:2Dfix,3:3Dfix.Someapplicationswillnotusethevalueofthisfieldunlessitisatleasttwo,soalwayscorrectlyfillinthefix.</field><fieldtype="int32_t"name="lat">Latitude(WGS84),indegrees*1E7</field><fieldtype="int32_t"name="lon">Longitude(WGS84),indegrees*1E7</field><fieldtype="int32_t"name="alt">Altitude(WGS84),inmeters*1000(positiveforup)</field><fieldtype="uint16_t"name="eph">GPSHDOPhorizontaldilutionofpositionincm(m*100).Ifunknown,setto:UINT16_MAX</field><fieldtype="uint16_t"name="epv">GPSVDOPverticaldilutionofpositionincm(m*100).Ifunknown,setto:UINT16_MAX</field><fieldtype="uint16_t"name="vel">GPSgroundspeed(m/s*100).Ifunknown,setto:UINT16_MAX</field><fieldtype="uint16_t"name="cog">Courseoverground(NOTheading,butdirectionofmovement)indegrees*100,0.0..359.99degrees.Ifunknown,setto:UINT16_MAX</field><fieldtype="uint8_t"name="satellites_visible">Numberofsatellitesvisible.Ifunknown,setto255</field></message>
Note: The XML document describes the logical ordering of the fields for the protocol. The actual wire format (and typical in-memory representation) has the fields reordered [10] to reduce Data structure alignment issues. This can be a source of confusion when reading the code generated from the message definitions.
MAVLink is used as the communication protocol in many projects, which may mean there is some compatibility between them. A tutorial explaining basics of MAVLink has been written. [11]
ping
is a computer network administration software utility used to test the reachability of a host on an Internet Protocol (IP) network. It is available for virtually all operating systems that have networking capability, including most embedded network administration software.
The Real-time Transport Protocol (RTP) is a network protocol for delivering audio and video over IP networks. RTP is used in communication and entertainment systems that involve streaming media, such as telephony, video teleconference applications including WebRTC, television services and web-based push-to-talk features.
The Transmission Control Protocol (TCP) is one of the main protocols of the Internet protocol suite. It originated in the initial network implementation in which it complemented the Internet Protocol (IP). Therefore, the entire suite is commonly referred to as TCP/IP. TCP provides reliable, ordered, and error-checked delivery of a stream of octets (bytes) between applications running on hosts communicating via an IP network. Major internet applications such as the World Wide Web, email, remote administration, and file transfer rely on TCP, which is part of the Transport layer of the TCP/IP suite. SSL/TLS often runs on top of TCP.
SOCKS is an Internet protocol that exchanges network packets between a client and server through a proxy server. SOCKS5 optionally provides authentication so only authorized users may access a server. Practically, a SOCKS server proxies TCP connections to an arbitrary IP address, and provides a means for UDP packets to be forwarded. A SOCKS server accepts incoming client connection on TCP port 1080, as defined in RFC 1928.
In computer programming, a value is said to be volatile if it can be read or modified asynchronously by something other than the current thread of execution. The value of a volatile
variable may spontaneously change for reasons such as: sharing values with other threads; sharing values with asynchronous signal handlers; accessing hardware devices via memory-mapped I/O . Support for these use cases varies considerably among the several programming language that have the volatile
keyword. Volatility can have implications regarding function calling conventions and how variables are stored, accessed and cached.
JSON is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of name–value pairs and arrays. It is a commonly used data format with diverse uses in electronic data interchange, including that of web applications with servers.
CRC-based framing is a kind of frame synchronization used in Asynchronous Transfer Mode (ATM) and other similar protocols.
Real-Time Messaging Protocol (RTMP) is a communication protocol for streaming audio, video, and data over the Internet. Originally developed as a proprietary protocol by Macromedia for streaming between Flash Player and the Flash Communication Server, Adobe has released an incomplete version of the specification of the protocol for public use.
Within communication protocols, TLV is an encoding scheme used for informational elements. A TLV-encoded data stream contains code related to the record type, the record value's length, and finally the value itself.
Action Message Format (AMF) is a binary format used to serialize object graphs such as ActionScript objects and XML, or send messages between an Adobe Flash client and a remote service, usually a Flash Media Server or third party alternatives. The Actionscript 3 language provides classes for encoding and decoding from the AMF format.
Protocol Buffers (Protobuf) is a free and open-source cross-platform data format used to serialize structured data. It is useful in developing programs that communicate with each other over a network or for storing data. The method involves an interface description language that describes the structure of some data and a program that generates source code from that description for generating or parsing a stream of bytes that represents the structured data.
This is a comparison of data serialization formats, various ways to convert complex objects to sequences of bits. It does not include markup languages used exclusively as document file formats.
Generic Stream Encapsulation, or GSE for short, is a Data link layer protocol defined by DVB. GSE provides means to carry packet oriented protocols such as IP on top of uni-directional physical layers such as DVB-S2, DVB-T2 and DVB-C2.
ISO 15765-2, or ISO-TP (Transport Layer), is an international standard for sending data packets over a CAN-Bus. The protocol allows for the transport of messages that exceed the eight byte maximum payload of CAN frames. ISO-TP segments longer messages into multiple frames, adding metadata (CAN-TP Header) that allows the interpretation of individual frames and reassembly into a complete message packet by the recipient. It can carry up to 232-1 (4294967295) bytes of payload per message packet starting from the 2016 version. Prior version were limited to a maximum payload size of 4095 bytes.
The Stream Control Transmission Protocol (SCTP) is a computer networking communications protocol in the transport layer of the Internet protocol suite. Originally intended for Signaling System 7 (SS7) message transport in telecommunication, the protocol provides the message-oriented feature of the User Datagram Protocol (UDP), while ensuring reliable, in-sequence transport of messages with congestion control like the Transmission Control Protocol (TCP). Unlike UDP and TCP, the protocol supports multihoming and redundant paths to increase resilience and reliability.
Universal Binary JSON (UBJSON) is a computer data interchange format. It is a binary form directly imitating JSON, but requiring fewer bytes of data. It aims to achieve the generality of JSON, combined with being much easier to process than JSON.
CAN FD is a data-communication protocol used for broadcasting sensor data and control information on 2 wire interconnections between different parts of electronic instrumentation and control system. This protocol is used in modern high performance vehicles.
This article provides information about the communications aspects of Universal Serial Bus (USB): Signaling, Protocols, Transactions. USB is an industry-standard used to specify cables, connectors, and protocols that are used for communication between electronic devices. USB ports and cables are used to connect hardware such as printers, scanners, keyboards, mice, flash drives, external hard drives, joysticks, cameras, monitors, and more to computers of all kinds. USB also supports signaling rates from 1.5 Mbit/s to 80 Gbit/s depending on the version of the standard. The article explains how USB devices transmit and receive data using electrical signals over the physical layer, how they identify themselves and negotiate parameters such as speed and power with the host or other devices using standard protocols such as USB Device Framework and USB Power Delivery, and how they exchange data using packets of different types and formats such as token, data, handshake, and special packets.
Pixhawk is a project responsible for creating open-source standards for the flight controller hardware that can be installed on various unmanned aerial vehicles. Additionally, any flight controller built to the open standards often includes "Pixhawk" in its name and may be referred to as such.