how can I implement efficient intra-process communication with message filters

asked 2019-06-10 04:00:27 -0600

xhuan28 gravatar image

I once tried out the tutorial of intra process communication which impressed me that it can improve communication performance with zero-copy. Afterwards, I tried to adopt this best practice in my application, but I met an issue. I need to synchronize messages from two topics with message filters. As mentioned in the tutorial, we have to use std::unique_ptrs to implement zero-copy.

This is because we’re publishing and subscribing with std::unique_ptrs which allow ownership of a message to be moved around the system safely. You can also publish and subscribe with const & and std::shared_ptr, but zero-copy will not occur in that case.

However, the callback of message filters only accept std::shared_ptr as its parameters. Does it mean we cannot take benefits from zero-copy if we use message filters, unless some code changes need to be done from message filter side?

edit retag flag offensive close merge delete


Cross posting your question in multiple locations ( is against the etiquette:

Dirk Thomas gravatar image Dirk Thomas  ( 2019-06-10 11:24:46 -0600 )edit

Sorry, I didn't realize this is against the etiquette of ROS community. However, I think it is more suitable to ask this question here than the github of message filters, so I close that one in github. Could you please reopen this one? Thanks.

xhuan28 gravatar image xhuan28  ( 2019-06-10 20:50:26 -0600 )edit

Actually, I would like to know whether it is a limitation to implement zero-copy with message filters currently and is it feasible to expose a new API from message filters to break the limitation.

xhuan28 gravatar image xhuan28  ( 2019-06-10 20:59:08 -0600 )edit

I've re-opened this as the GH issue has been closed, but please keep the etiquette in mind @xhuan28.

I didn't realize this is against the etiquette of ROS community.

nt accepting cross-posting support requests is not necessarily something specific to the ROS community: it leads to split discussions and wasted effort on the part of the people responding to your questions. That would not be a good thing in any community.

gvdhoorn gravatar image gvdhoorn  ( 2019-06-11 02:20:21 -0600 )edit