Incorrect RX CanardTransfer.payload_size

Hi.

When sending both single- and multi-frame CanardTransfers, I’ve found that the value of payload_size on the receiving node differs from its value on the sending node. For example, here is an excerpt from my logger output on the receiving node. The parenthesized value is the value of CanardTransfer.payload_size on the sending node.

“incorrect length: 147 (144)”
“incorrect length: 108 (100)”
“incorrect length: 124 (115)”
“incorrect length: 92 (86)”
“incorrect length: 15 (14)”
“incorrect length: 31 (25)”

The reported size is always larger than the expected size, and the difference to the correct value appear to be consistent for a given length, but varies from 1 to 9.
Is this expected behavior?

Version info:

#define CANARD_VERSION_MAJOR 1
#define CANARD_VERSION_MINOR 0

#define CANARD_UAVCAN_SPECIFICATION_VERSION_MAJOR 1
#define CANARD_UAVCAN_SPECIFICATION_VERSION_MINOR 0

Thanks,

-Nick

If you are using CAN FD, yes. Related sections of the Specification:

  • 3.7.1.3 Implicit truncation of excessive data
  • 4.2.2.3 Transfer payload decomposition

Hi @pavel.kirienko.

Yes, we’re using CAN FD. It’s easy enough to deal with now that I know to expect that behavior.
Thanks much,

-Nick

Why do you need to deal with it? DSDL (auto-generated deserialization code) handles it for you.

Hi @pavel.kirienko.

One thing at a time. :slight_smile: Besides, I’m not sure how to describe unformatted, variable-length binary data using DSDL. Not that I’ve had any time to look into it.

-Nick

Okay. To save you time:

uint32 CAPACITY = 1024 ** 2
uint8[<=CAPACITY] unformatted_data
@extent CAPACITY * 8 * 2

If the required capacity is under 256 bytes you can just use uavcan.primitive.Unstructured.1.0.

Thanks - it’s on my to-do list. :slight_smile:

-Nick