I would like to use UAVCAN on a project that is nothing to do with drones or avionics, but does involve a lot of nodes on a CAN(FD) bus which need to be able to talk to each other in a flexible and reliable way.
In “big” control systems, I am used to the concept of Data-Centric Publish-Subscribe (DCPS), where nodes can publish arbitrary ‘topics’ (data structures) on the network, to which they can write ‘samples’ i.e. serialized data packets, which are replicated across the network. This is used by ROS 2.0 for example and there are several implementations e.g. OpenSplice, RTI OpenDDS etc which work over a UDP network.
However, I need something like this but suitable for an embedded (STM32) platform with limited RAM and Flash - I am running Zephyr RTOS. I have already got it to build libcanard and send a few test messages.
My requirements are:
- I want a hierarchical data structure of key/value pairs. This must be iterable and introspectable in the code.
- For example, if node0 has some data describing a temperature sensor, I would like that to be visible as node0.sensors.temperature
- I want a mixture of publish/subscribe and request/response. For example, names of objects, configuration objects etc would only be updated on request, while others would be periodically transmitted. If possible, it would be nice if any object could be requested to be periodically transmitted, or transmitted on update.
- Keys should be stored in flash where possible, e.g. local data structures in flash, subscriptions to remote topics in RAM.
- Internally to the firmware, I want to be able to use this data structure to pass data around between threads, like a shared memory. So it needs to be thread-safe.
- I don’t want to have to maintain incompatible versions of the protocol. If I add some data to a topic or make a new topic, i should still be able to see the values on nodes running old versions of the protocol. I understand this may not be possible with ROM-based data structures - so as a minimum I’d want to have a warning/error if a particular topic is incompatible.
- Nodes with more memory (e.g. running python) should be able to decode the protocol without any prior knowledge of the data structures.
Is UAVCAN a good fit for this? Am I asking too much?
From the specification, it seems as if UAVCAN can do most of this.
The part I am having trouble with is making a flexible tree of DSDL. Is it possible for DSDL structures to inherit from eachother?