1
$\begingroup$

I was reading this tutorial: https://docs.ros.org/en/humble/Tutorials/Demos/Intra-Process-Communication.html

Is it possible to have multiple subscribers to the published message? How does the unique pointers work then. I assume it isn't because then there would be multiple unique pointers to the same message. If it is possible is there any examples showcasing it?

$\endgroup$

1 Answer 1

0
$\begingroup$

If you have multiple subscriptions which each require a unique pointer the data will be copied the requisite number of times to give the subscribers each unique pointers.

If you want to have highly optimized transfer of data to multiple subscribers you can use const shared_ptr in your subscription which will allow the same pointer to be accessed by multiple subscribers, but with the caveat that it's read only. There's more on that near the end of the page referenced.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.