Hi,
tl;dr:
What’s “the” solution to uniquely identifying message/node-combinations consistently over powercycles? I have some motivation, my own understanding and a proposed solution based off both using Allocatee-Allocator with Dynamic node ID allocation as fallback.
Motivation:
I am building STM32-based compute modules which then will be driving sensors, actuators, monitors etc. All STM32 will be in a CAN-transporation-layer Cyphal network as one Cyphal-Node, each subscribing/publishing multiple messages/services.
I will flash the same software on any given STM32+Peripherals combination. Example:
STM32 + H-Bridge + Motor (STM-H-M)
Now, if I build a robot/drone/whatever that has two of those Cyphal nodes (front-left and front-right), how do I make sure that even through powercycles I can identify all messages front-left and front-right? Remember: they run the same software, I will not hardcode e.g. Node-IDs.
My Understanding (Correct me if wrong, still learning):
related questions:
related documentation:
Cyphal currently supports Plug-and-Play node ID allocation, which will not be persistent (through powercycles), as well as Allocatee-Allocator exchange. For understanding, an analogy:
Allocator: DHCP-Server
Allocatee: DHCP-client
Allocatee-unique-ID: DHCP-client MAC-address
But using Allocatee-Allocator also means Cyphal will not be a decentralized network anymore, so there must be a fallback strategy.
My approach:
I would implement:
On Allocatee-Side:
- Set STM32 in anonymous state
- Request Node id as allocatee with STM32-hardware built in 96bit unique ID, where the preferred ID would be identical on all STM32 with the same peripherals (e.g. motor-node will prefer ID 20, IMU-nodes will prefer ID 30 etc.).
- If there is no allocator on the network after some time (What time is recommended?), fall back to dynamic PnP allocation.
On Allocator-Side (e.g. a Linux-machine)
- Start Allocator
- Look for a lookup-table of Node-ID/Unique-ID pairs, if it does not exist generate one
- Assign node IDs based on lookup-table, if unique-ID not in table write in table and save to file
Since the lookup-table will persist through powercycles, we have a solution.
Open Side-Quests:
A. Documentation asks for a 128bit unique ID. But that is max. length, so 96bit is fine? If not, just fill up the 96bit with zeros?
B. What time is recommended to wait for an allocator before falling back to dynamic node ID?