Robotics StackExchange | Archived questions

Subscriber and Service on the same topic

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?

Asked by afsantos on 2017-02-19 10:53:47 UTC

Comments

Answers