Subscriber and Service on the same topic

asked 2017-02-19 09:53:47 -0500

afsantos gravatar image

I was browsing some code and came across an example of a subscribe and an advertiseService under the same name. I.e.:

this->srv_joint_ = this->node_.advertiseService("joint_command", &jointCB, this);
this->sub_joint_ = this->node_.subscribe("joint_command", 0, &jointCB, this);

It is my understanding that there will be a name collision. There will be nodes publishing messages of some type under joint_command, while other nodes will be sending requests to joint_command.

What are the consequences of this? Does the subscriber simply ignore the requests, while the server ignores the normal messages? Isn't this considered bad practice?

edit retag flag offensive close merge delete