UAVCAN v1.0 and ArduPilot

I do hope not. As I described earlier, the v0 types for common sensors are a complete mess. Copying that mess into the v1 space would not be a good way to start.

Thank you, Tridge, I think we are on the same page. I have already filed two issues derived from this conversation, they are linked in my previous post. I am going to publish my proposal how to address the v0/v1 coexistence problem tomorrow. Barring the message extensibility problem, that would appear to be the last sticking point that has to be addressed among those that we discussed here.

I really appreciate the valuable insights shared in this thread.

and I very much appreciate your patience with my questions and your willingness to consider the issues I’ve raised. Thanks!

2 Likes

Please review the changeset derived from this discussion:

Thanks!

Fantastic, thanks! The v0/v1 compatibility is a major relief and I appreciate the foundation you are laying for extensions.
I should also mention an idea I have been thinking of implementing at the API level to make MAVLink2 extensions easier to use. Right now it just uses zero-fill when a sender is not aware of an extension and the recipient is. That is very easy at the transport level, but for some data types zero is not a great value. I’m thinking of adding an API that allows the recipient to ask if a specific field was provided. Something like this for C:

bool mavlink_msg_extension_available(const mavlink_message_t *msg, uint8_t field_offset);

used like this:

bool freemem32_available = mavlink_msg_extension_available(msg, offsetof(mavlink_meminfo_t, freemem32));

the basic idea is that the mavlink_message_t does already have the information needed to tell the caller if a particular field came from zero-fill or not, we just don’t have a convenient API for consumers of the extensions at the moment.

I think the same idea could work for extensions in UAVCAN v1.

Thank you. This is not quite about compatibility though. A v0 node still can’t communicate with a v1 node, I don’t think we can fix this without undoing much of the progress we’ve made for v1. Instead, this change ensures that v0 and v1 can be used on the same physical bus concurrently – as we’ve been discussing here, this should enable ArduPilot to adopt v1 and eventually see all v0 hardware migrated to v1.

Concerning the extension API: thank you for the idea. I am still hopeful though that we may be able to come up with a more type-safe solution, but this is not something we should be concerned about right now. The important thing right now is that the core provisions that will enable extensibility, in whatever way we chose to implement it, will be built into the spec with the above change.

that is true for the v1 part of the node, but with a dual stack node it should be able to communicate fine with v0 nodes. It will mean some extra work for the flight controller authors who want to support dual stack, but that is unavoidable I think.

ok, though I think we should make sure that the implementations are tested with extensions, by deliberately sending some ‘extension’ bytes in test suites and make sure the base packet is accepted.
What sort of test infrastructure do you have in mind for v0/v1 compatibility? For MAVLink2 I created a test suite which generated pseudo-random (but predictable) field values for all messages in the protocol, then the test suite tries sending all messages back and forth and checks the resulting fields. The compiler was extended to generate the test suite as part of the binding generation (for C bindings). Something similar would be worthwhile. Or perhaps there is something equivalent already?
The mavlink test generator is here:


it generates a testsuite.h header covering all messages in the XML. A example of the generated output is here:
http://uav.tridgell.net/tmp/testsuite.h
Then there is a test harness that uses that to test MAVLink1, MAVLink2, signing etc.
I like making protocol test suites as “full coverage” as possible as it tends to find the corner cases more easily, and is good for running tools like valgrind.

Validation of implementations is a completely separate activity that is not related to Specification. We have separate test suites for Libuavcan and PyUAVCAN that validate that the implementation conforms to Specification and the library API contracts. That involves unit and integration testing. PyUAVCAN, in particular, contains a rather extensive fuzzy testing logic for DSDL-generated classes that will probably be extended in the future. Naturally, it doesn’t yet test the truncation and zero-extension logic, but I do intend to add that functionality once the change request is accepted.

When will support for UAVCAN 1.0 appear in Ardupilot for motors and ESC?

1 Like

ArduPilot UAVCAN v0.1 support for motors and ESCs is available now.

Hi, do you mean v1.0? If so, is Ardupilot dual-stack, that is, v0 and v1?

Is there documentation anywhere on this subject? In particular, are all types defined by DS-015 / reg.drone PRDTs currently supported? If not, what is supported and not?

Is there a github issue or other forum thread I could use to track support for v1 implementation and datatype support?

2 Likes

Hello.

Is it possible to broadcast uavcan.protocol.debug.LogMessage messages to the Mavlink console?

yes, in ArduPilot 4.1 set CAN_LOGLEVEL=1 and LogMessage messages will be sent as MAVLink STATUSTEXT.
With any CAN_LOGLEVEL they will be logged into the onboard log MSG log messages with a CAN[xxx] prefix where xxx is the source node number.