topics for control?

asked 2015-12-06 23:43:54 -0500

Sam Bishop gravatar image

updated 2015-12-07 07:36:18 -0500

There have been a few questions asked before about when to use topics, services, or actions, but I haven't seen this particular question asked. My question is about which to use for "immediate" control messages--not "move here" messages that should obviously be action messages, but "do X, now".

The wiki currently says that topics are for "data [that] might be published and subscribed at any time independent of any senders/receivers. Many to many connection[s]". So they don't sound like a good fit.

Service messages initially look promising. The wiki says that they "should be used for remote procedure calls that terminate quickly" and not for "longer running processes", but it goes on to say that "they should never change ... state".

And finally, action messages seem to be overkill, as these control messages are intended to take effect immediately, so they couldn't be preempted.

It looks like topics are used in practice. The control code for "normal" robots seems to use twist messages over topics to move the robot base, and the example code I've seen for Ackermann-style robots (like I'm working with) also uses topics. Is my conclusion correct? And if so, why are topics used like this?

I've switched from service messages to topic messages for the code I'm working on, assuming that there must be a good reason that topics have been used by others. But part of why I'm asking is so that I can update the wiki, so that others won't make the same mistake I made and start down the wrong path.

edit retag flag offensive close merge delete