Backwards Compatibility for Variable-length Messages
Say I have the following message definition, with messages passed from a microcontroller to a single-board computer over rosserial
:
#RangeArray.msg
uint8 NUMBER_OF_SENSORS = 5
uint16[5] ranges
uint8[5] statuses
If I add/remove sensors and change the array size, I expect to lose any sort of backwards compatibility (any rosbags I've saved with these messages won't play nicely if I've changed to, say, uint16[3] ranges
).
I'm wondering if I change the message definition such that my arrays are of variable length, will this be backwards compatible even if NUMBER_OF_SENSORS
differs between the two message definitions?
#RangeArray_old.msg
uint8 NUMBER_OF_SENSORS = 5
uint16[] ranges
uint8[] statuses
#RangeArray_new.msg
uint8 NUMBER_OF_SENSORS = 7
uint16[] ranges
uint8[] statuses
I'd expect to use NUMBER_OF_SENSORS
to create a fixed-length array on the microcontroller side of rosserial
, then use the variable-length vectors on the single-board computer side. I don't know if there's anything I'm not taking into account. Is this a common pattern to ensure compatibility?