Homepage GitHub

Arduino UAVCAN Library


As those of you which keep tabs on the Viper Quadcopter topic probably already know I’ve been working on libcanard-based Arduino library allowing the usage of the UAVCAN protocol via the Arduino platform. I’m happy to say this work has reached a stage where it can be presented to the wider public: 107-Arduino-UAVCAN. It’s currently only available via direct download from github but will be available shortly via the Library Manager.

A first idea on how to use the library can be gained from taking a look at the README of the repository. Examples demonstrating publishing and subscribing as well as service client/service server are available here. Taking a look at the test code compiled and executed upon every push to the repository gives further insight into the libraries usage and design philosophy.

Currently one message type (uavcan/node/Heartbeat.1.0) and one service type (/uavcan/node/ExecuteCommand.1.0) are available within the library although it should be fairly easy to add other types (and maybe this process can even be automated in some way? - that’s smth I’ve not looked at all yet).

Please keep in mind that this is an Arduino library and as such has been designed with simplicity in mind. Therefore certain choices where made that limit the power the programmer has compared to directly using libcanard without any abstraction layers. Nonetheless it should provide a smooth first start into the usage of UAVCAN without having to go through all the steps necessary with bringing any embedded project off the ground.

Edit: It’s now also available via Arduino IDE Library Manager.

1 Like

Hello :wave:
I’m looking at https://github.com/UAVCAN/public_regulated_data_types/blob/master/uavcan/node/430.GetInfo.1.0.uavcan#L41

uint64[<=1] software_image_crc

and I can’t help but wonder how an optional uint64_t would be serialised. Will it be prepended by an implicit length field that either says 0 or 8?

E.g. software_image_crc being encoded ->

uint8_t  | len                    | 8
uint64_t | software_image_crc_val | 0xDEADBEEFCAFE1337
/* Next entry ... */

or software_image_crc being NOT encoded ->

uint8_t | len | 0
/* Next entry ... */

0 or 1 (section Variable-length array types)

1 Like

Good morning @pavel.kirienko :coffee:

Thank you for getting back to me. Now that you write it it’s obvious to me that a optional data field is just a special array case, that is an array with a length of zero. I was led astray by the fact that it’s not advertised as an array type but rather as a optional field that’s either there or not.

But but, it is though: uint64[<=1] – that’s an array type.

Version 1.0.2 has just been released. Major changes are the replacement of the self-coded serialisation/deserialisation logic by the one generated via nnvg as well as support for uavcan/node/Version.1.0 and uavcan/node/ID.1.0.

1 Like