ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

NodeHandle effect on advertise

asked 2013-03-18 04:12:52 -0500

Miguel Prada gravatar image

updated 2015-11-26 03:07:05 -0500

tfoote gravatar image

I'm working on a node with several callback queues, which I'm handling through separate NodeHandles, in order to process time critical callbacks separately from longer running callbacks. I think I understand the consequences this has on the subscription side , but I don't quite see the implications on publishers.

The documentation I've been able to find hits at internal roscpp threads handling the actual publishing of the messages, but it is unclear on how this is done and on the effects of having multiple NodeHandles.

Aside of the obvious namespace managing performed by the different NodeHandles, how does using one NodeHandle or another to advertise a subscriber affect the publishing of the messages? Does it matter at all which of the NodeHandles I use for advertising a publisher given they all lay in the same namespace?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-07-07 22:55:24 -0500

Ed Venator gravatar image

Multiple Nodehandles will not give you multiple callback queues. Nodehandles are just "handles" to a global singleton that manages the ROS publish/subscribe interface. For what you're trying to do, you should check out this article on the ROS wiki: , specifically the section called Advanced: Using Different Callback Queues.

In this situation, I usually use a "thin" callback that just pushes the message onto a work queue and a standard producer/consumer threading model to do the long-running work. If your callback uses the message pointer signature and your work queue is also just a queue of shared pointers, you can push the message to the work queue without copying any data.

edit flag offensive delete link more

Question Tools



Asked: 2013-03-18 04:12:52 -0500

Seen: 937 times

Last updated: Jul 07 '17