That would be great. I’m not sure how the STM32 is setup for can, but the ESP32 has an inbuilt “SJA1000 compatible” CAN controller - but it’s API calls completely hide it. If you were to use an external can controller through SPI/I2C- then we could even have CAN controller specific implementations - that work across all MCUs…
This was my thinking for splitting the command into Global Command / Command / Subcommand. Each one corresponds to a level used in the commander interface:
But I agree with you - it’s tree structured, and thus not efficient.
I’ll work on flattening the commands, and splitting the motor identifier.
Do you think 6 motors is not enough. Are any MCUs capable of this? I thought you would have 1 or 2 (in a dual controller). The motor identifier is only unique to the Node ID. So each node on the bus could potentially have 6 motors.
How would you route the CAN bus? it needs a termination resistor on each end. If you have 1 bus, you would have to loop the bus down a limb and back, so that you only have 1 start and end point. (Unless the bus can be a star shape?) I thought you would have had more than 1 bus (this also increases bandwidth). Anyway, I will add more node IDs.
Oh yes - I forgot about “long long” I’ll add it.
Boolean can be represented by unsigned char. The CAN data payload is minimum is 1 byte right? So they would both use the same bandwidth for transmission. And when doing the printf back to the commander format - bool prints as 0/1 - the same as the unsigned char.
This is a good point. Maybe one of the motor IDs can be “ALL” and then whatever the command is gets issued to all motors.
I think saving/loading might be one of the hardest parts - as there’s not just 1 data structure we can save/load. The other method would be issuing lots of commands. Also it is controller specific.