这一篇我们来聊一下PX4和APM使用的CAN通信协议框架 UAVCAN。

为什么聊这个话题呢?最近PX4固件做了一个关于UAVCAN的更新,调整了src/drivers/uavcan/libuavcan子模块的仓库,并且启用了新的名称为dronecan和新的主页 dronecan.org。

commit id:c73a1b4c:update UAVCAN-v0 dsdl to DroneCAN

借着这个更改我们来聊一下UAVCAN的一些事情。

关注PX4项目进展的同学可能会发现,从v1.12版本开始,在src/drivers目录下多了一个模块,名为uavcan_v1,而这个模块并没有几个board配置中使用了它,即使是最新的master分支也没有在的default配置中使用。

关注uavcan的官方网站,得知uavcan正在进行重大的更改,协议由v0.9升级到v1版本,src/drivers/uavcan/libuavcan目录下为当前使用的v0.9版本,而新增加的uavcan_v1为新的v1版本

v0.9与v1版本的区别

那么这两个版本有什么区别呢?这里我们不做特别深入的讨论,仅从can拓展帧id的定义上对比,

从https://legacy.uavcan.org/Specification/4._CAN_bus_transport_layer/可以获取v0.9版本的id定义

图片

由https://uavcan.org/specification/UAVCAN_Specification_v1.0-beta.pdf文档中可以找到v1.0版本的id结构

图片

可以发现这两个版本的协议在Priority、Message type ID、Service not message、Source node ID等字段的定义上有很大的不同,并不兼容。

DroneCAN:UAVCAN v0.9版本的继承者

UAVCAN在https://legacy.uavcan.org/主页中也强调v0.9版本不再维护且不推荐在新的设计使用。

This website is dedicated to the experimental version of the protocol, otherwise known as UAVCAN v0. This version is now obsolete and should not be used in new designs. Existing deployments will benefit from our commitment to provide long-term support and maintenance of UAVCAN v0-based systems.

很早就看到这个网站的消息,以为PX4和APM的can框架即将发生较大的更改,虽然不是很理解这个更改有什么明显的优化和改进。

直到最近关注到文章开头提到的libuavcan仓库路径的变化,在新的dronecan主页https://dronecan.github.io/中提到了这个变化的原因:

DroneCAN is the primary CAN protocol used by the ArduPilot and PX4  projects for communication with CAN peripherals. It is an open protocol  with open communication, specification and multiple open  implementations.

DroneCAN was created to continue the development of the widely used UAVCAN v0 protocol. This protocol has  proven itself as robust and feature rich and has been widely deployed in the commercial drone industry and enjoys broad support among industry partners. The proposed introduction of the UAVCAN v1 protocol involved changes to UAVCAN that increased complexity and did not offer a smooth  migration path for existing deployments. After extended discussions  within the UAVCAN consortium it was decided that the best solution was  to continue development of UAVCAN v0 under the name DroneCAN.

PX4和APM开源飞控项目认为v0.9版本是健壮的、功能丰富的,已在商用无人机行业中广泛部署,并在行业合作伙伴中得到广泛支持,因此决定继续维护这个版本的协议,重新命名为DroneCAN v1。

总结

这次UAVCAN v1与DroneCAN v1(UAVCAN v0.9)的分离对于未来开源飞控与UAVCAN有何影响我们持续关注。这种重大的协议更改对于整个开源飞控产业链而言影响是巨大的,会使本就分散的UAV各个组件之间的兼通性问题更加凸显。基于这样的原因开源飞控社区没有作出这样的更改。

对于飞控的学习爱好者,UAVCAN也是一个非常不错的学习项目,其两个主要的库libcanard(c语言实现)、libuavcan(C++实现),我们在后续的分享中探讨它们的代码框架。

往期分享:

AcmeROS-1-系统架构

PX4-7-飞控参数

AcmeGCS-9-目标框选跟踪

AcmeIot-2-基于PX4硬件的Nuttx开发环境


 

这里会不定期更新一些我整理的无人机相关知识,欢迎关注。

在公众号的主页菜单中有所有分享的分类整理。

 

Logo

鸿蒙生态一站式服务平台。

更多推荐