[原]MAVLink 2

发布时间 2024-01-05 16:43:55作者: 南水之源

mavlink官方文档入口

协议概述

MAVLink 是一种二进制遥测协议,专为资源受限的系统和带宽受限的链路而设计。MAVLink部署有两个主要版本:v1.0和v2.0,v2.0向后兼容(v2.0实现可以解析和发送v1.0数据包)。遥测数据流以多播设计发送,而改变系统配置并需要保证传输(如任务协议参数协议)的协议方面是点对点重传。

以下是MAVLink v2数据包的在线格式内存中的表示可能有所不同。

uint8_t magic;              ///< protocol magic marker
uint8_t len;                ///< Length of payload
uint8_t incompat_flags;     ///< flags that must be understood
uint8_t compat_flags;       ///< flags that can be ignored if not understood
uint8_t seq;                ///< Sequence of packet
uint8_t sysid;              ///< ID of message sender system/aircraft
uint8_t compid;             ///< ID of the message sender component
uint8_t msgid 0:7;          ///< first 8 bits of the ID of the message
uint8_t msgid 8:15;         ///< middle 8 bits of the ID of the message
uint8_t msgid 16:23;        ///< last 8 bits of the ID of the message
uint8_t payload[max 255];   ///< A maximum of 255 payload bytes
uint16_t checksum;          ///< CRC-16/MCRF4XX
uint8_t signature[13];      ///< Signature which allows ensuring that the link is tamper-proof (optional)