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

NodeHandle effect on advertise

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

Miguel Prada gravatar image

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

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
0

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

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: http://wiki.ros.org/roscpp/Overview/C... , 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

4 followers

Stats

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

Seen: 959 times

Last updated: Jul 07 '17