Homepage GitHub

Libcanard v0 dsdl_compiler .uavcan to .h

What is the command to generate .h for libcanard v0?

There is no DSDL compiler for Libcanard v0.

I found it in ardupilot.

If you are using DSDL types with @union, pay attention to a small bug in the compiler that I found. In init.py. Se below. I noticed this because the tag size was not calculated correctly…

Row 330:
t.union = len(t.fields).bit_length()

I needed to change to
t.union = (len(t.fields)-1).bit_length()

Row 341-344:

if t.request_union:
        t.request_union = len(t.request_fields).bit_length()
  if t.response_union:
       t.response_union = len(t.response_fields).bit_length()

I changed to

if t.request_union:
    t.request_union = (len(t.request_fields)-1).bit_length()
if t.response_union:
    t.response_union = (len(t.response_fields)-1).bit_length()

While we’re at it, there is far more than one bug in that compiler, which is why we pulled it from upstream wholesale.