# Structure of libcanard publisher

**URL:** <https://forum.opencyphal.org/t/structure-of-libcanard-publisher/609>\
**Category:** Libcanard\
**Created:** [September 3, 2019, 1:12pm UTC](https://forum.opencyphal.org/t/structure-of-libcanard-publisher/609 "2019-09-03T13:12:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![VladKost](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/v/898d66/32.png) [@VladKost](https://forum.opencyphal.org/u/VladKost)\
**Post date:** [September 3, 2019, 1:12pm UTC](https://forum.opencyphal.org/t/structure-of-libcanard-publisher/609/1 "2019-09-03T13:12:46Z")

</div>

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](https://kb.zubax.com/display/MAINKB/3.+Publisher+tutorial) and [https://github.com/UAVCAN/public\_regulated\_data\_types](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](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](https://github.com/E-scorpio/libcanard_test/blob/master/uavcan.c). Their names are TestFixMsg(), TestFixMsg2(), TestAuxMsg().

Best regards and sorry for bothering you.

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [September 6, 2019, 8:50am UTC](https://forum.opencyphal.org/t/structure-of-libcanard-publisher/609/2 "2019-09-06T08:50:58Z")

</div>

> [@VladKost](#):
>
> 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.

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

> [@VladKost](#):
>
> 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.

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