Ask Your Question
1

Backwards Compatibility for Variable-length Messages

asked 2017-02-27 11:21:21 -0500

nckswt gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-02-27 12:13:01 -0500

ahendrix gravatar image

If you just want compatibility with old logs, maybe you can use bag migration rules.

edit flag offensive delete link more

Comments

That'll make things a lot easier. Thanks!

nckswt gravatar imagenckswt ( 2017-02-27 13:19:45 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-02-27 11:21:21 -0500

Seen: 177 times

Last updated: Feb 27 '17