Homepage GitHub

Structure of libcanard publisher


#1

Good day.

I’m new in UAVCAN and trying to understand how to create Publishers in libcanard. For now I have 3 test publishers: for 1060.Fix, 1061.Auxiliary and 1063.Fix2. For them I used “show_data_type_info.py” inside lib for ID, signature and size and this tutorial for Publisher structure https://kb.zubax.com/display/MAINKB/3.+Publisher+tutorial and https://github.com/UAVCAN/public_regulated_data_types for packet data fields. As base example I used code from here: https://github.com/geosmall/UAVCAN-for-STM32-Arduino

My biggest problem is to understand what fields are in the packet and how many place they occupied. For example: 1060.Fix packet has size 628 bits(in “show_data_type_info.py” ). But if look into public_regulated_data_types and manually count field sizes, I’ll get 620 bits. Or 1063.Fix2 where script size is 1769 bits, but on manual count I get 1756 bits.

I tested my examples in UAVCAN GUI Tool and on stm32 connected to PixHawk Cube(Arducopter 3.6.10 firmware). For now my test examples are working next way: Auxiliary is visible and parsed in GUI Tool and Cube; Fix is visible and parsed in GUI Tool, but Cube doesn’t see it; Fix2 is visible in GUI Tool with EOT error and not visible in Cube.

Can you explain me what I’m doing wrong with all of this and how correctly create Publishers? You can see my code here: https://github.com/E-scorpio/libcanard_test/blob/master/uavcan.c. Their names are TestFixMsg(), TestFixMsg2(), TestAuxMsg().

Best regards and sorry for bothering you.


(Pavel Kirienko) #2

Sounds like you forgot to consider the implicit array length fields. If you add those, you should arrive at the correct numbers.

A quick glance at your code seems to indicate that you are not treating the array length fields properly. Check that, please.