MAVLink.io(4)--MAVLlink Version

MAVLink Version (版本)

MAVLink发展处几个版本:

  • MAVLink 2.0:目前推荐的主要版本,2017被大部分用户接受。
  • MAVLink v1.0: 2013年被广泛接受,一直被大批设备采用。

MAVLink 2.0 C/C++ 和 Python 库兼容1.0版本。其中Version Handshaking(版本握手)以及Negotiating Versions(沟通版本)解释了如何使用版本。

Determinging Protocol/Message Version(分辨协议/消息版本)

有几种办法分辨MAVLink版本

  • AUTOPIOT_VERSION .capabilities 检查MAV_PROTOCOL_CAPABILITY_MAVLINK2的标志位。
  • PROTOCOL_VERSION .version 包含MAVLink版本号乘以100,例如v1.0是100,v2.3是203。
  • HEARTBEAT .mavlink_version 部分包含最小的版本号。域中包含消息定义(在 common.xml文件中定义)。
  • 最简单的办法是查看报文的起始字节
    • MAVLink 1: 0xFE
    • MAVLink 2: 0xFD
Version Handshaking(版本握手)

对于MAVLink 2的支持在AUTOPILOT_VERSION消息中的MAV_PROTOCOL_CAPABILITY_MAVLINK2 标志。
无人机与地面站信道的透明传输使用MAVLink是足够的。因为,大多数信道不是完全透明传输(包含路由或者帧长度限制的无线传输)。为了测试信道,MAVLink2握手协议发送一个MAVLink2帧来测试信道完整性。
为了达到上诉目标,地面站使用消息ID MAV_CMD_REQUEST_PROTOCOL_VERSION发送一个COMMAND_LONG或者一个COMMAND_INT包。
如果系统支持MAVLink2,其使用MAVLink 2组包回复PROTOCOL_VERSION,如果不支持则NACK,地面站将超时,那么命令接口将不能正确工作。

sequenceDiagram
GCS->>Drone: MAV_CMD_REQUEST_PROTOCOL_VERSION
GCS->>GCS: Start timeout
Drone->>GCS: PROTOCOL_VERSION in MAVLink 2 frameing
GCS->>Drone: If ACK: Switches to MAVLink2
Drone->>GCS: Switches to MAVLink 2 on receive
Semi-Transparent Lagacy Radios(半透明传输数传)

某些流行的数传(Sik 数传系列)使用半透明模式传输,会添加RADIO_STATUS信息到MAVLink数据包中。每一个MAVLink包会实际上发送一个固定系统ID的心跳和一个部件ID不同的包头。因此,增加的心跳可以用来部署系统。这些电台能够可选择的确认MAVLink 2 ,通过在收到第一针MAVLink v2包后发送RADIO_STATUS包格式。

Version and Signing

MAVLink库支持不同通道使用不同的协议版本, 一个通道使用特殊的输入输出MAVLink系统或者部件(例如 串口或UDP端口)。
因此,所有连接到特定同道的部件必须使用相同的MAVLink版本。如果一个系统使用签名,那么通过相同通道的所有连接也必须使用相同的密钥对消息进行签名。

Negotiating Versions(协商版本) 稍后翻译

Vehicle and GCS implementations will support both MAVLink 1 and MAVLink 2 for quite some time. We would like most users to receive the benefit of MAVLink 2, while still supporting implementations that don’t yet support MAVLink 2.

The following is meant to capture best practice for vehicle firmware and GCS authors:

  • Vehicle implementations should have a way to enable/disable the sending of MAVLink 2 messages. This should preferably be on a per-link (channel) basis to allow for some peripherals to be MAVLink 1 while others are MAVLink 2. It is acceptable for this option to require a reboot of the flight controller to take effect.
  • If signing is enabled then the vehicle should immediately start sending signed MAVLink 2 on startup.
  • If signing is not enabled and MAVLink 2 is enabled then the vehicle may choose to start by sending MAVLink 1 and switch to MAVLink 2 on a link when it first receives a MAVLink 2 message on the link.
  • Vehicles should set the MAV_PROTOCOL_CAPABILITY_MAVLINK2 capability flag in the AUTOPILOT_VERSION message if MAVLink 2 is available on a link. This should be set in the case where the link is currently sending MAVLink 1 packets but MAVLink 2 packets will be accepted and will cause a switch to MAVLink 2.
  • GCS implementations can choose to either automatically switch to MAVLink 2 where available or to have a configuration option for MAVLink 2.
  • If the GCS chooses to use a configuration option then when the option is enabled it should send MAVLink 2 on starting the link.
  • If the GCS chooses to use automatic switching then it should switch to sending MAVLink 2 if either it receives a MAVLink 2 message on the link or by asking for the AUTOPILOT_VERSION message to be sent and seeing the MAV_PROTOCOL_CAPABILITY_MAVLINK2 flag is set.

MAVLink 2

MAVLink 2 反向兼容MAVLink 协议,协议设计提高通讯灵活性和安全性。MAVLink2 绑定使用C、C++11和Python。
本话题说明MAVLink2的新特性和如何使用。

Features(特性)

关键的新特性如下:

  • 24bit 消息ID —支持多达16 milion种的消息定义(MAVLink 1支持256种)
  • 数据包包签名 —确认消息发自于被信任的系统
  • 消息扩展 —增加了消息定义的新域,不影响接收的兼容性
  • 空字节截断 —串行包中尾部空字节(填0)在发送前被删除(MAVLink1中会全部发送)
  • 兼容标志/不兼容标志 —支持反向兼容的协议改造,可利用自定义非标准包。

Upgrading to MAVLink 2(升级到MAVLink 2)

Version HandShaking/Negotiation

C Implementation

MAVLink 2 C 库反向兼容MAVLink 1。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值