0
$\begingroup$

Rosanswers logo

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?


Originally posted by Miguel Prada on ROS Answers with karma: 1071 on 2013-03-18

Post score: 8

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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/Callbacks%20and%20Spinning, 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.


Originally posted by Ed Venator with karma: 1185 on 2017-07-07

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.