[DRAFT] GenericSubscription support in IntraProcessManager#3083
[DRAFT] GenericSubscription support in IntraProcessManager#3083roncapat wants to merge 1 commit intoros2:rollingfrom
GenericSubscription support in IntraProcessManager#3083Conversation
…anager Signed-off-by: Patrick Roncagliolo <ronca.pat@gmail.com>
|
@roncapat great you started the draft, I will give it a better look ASAP. From a first look I see that it uses a callback with rclcpp::SerializedMessage but the issue is that this would require to receive serialized messages, therefore we miss the IPC requirements. With IPC, smart pointers are passed and no serialization takes place. Thank you for setting up the draft, I will give it a try and have a look as soon as I can. |
|
Hi @mcp-ats , thanks for the feedback! Yes, this patch favours serialization during publishing - before adding the messages to the buffers. Still, this should be partially beneficial. At some point, you will need to serialize anyway. This patch helps serializing just one time even in presence of multiple GenericSubscriber. We may figure out what may be a draft implementation that serializes on the subscription side. |
Description
GenericSubscriptionis extensively used byrosbag2. However, this means that currently, intra-process communication is not leveraged. Even when composingrosbag2::Recorder, topics are subscribed in the traditional way -IntraProcessManagerdoes not handle the data exchange towards the recorder's subscribers, as theGenericSubscritiondoes not register itself as capable of intra-process comms (noSubscriptionIntraProcessis created).Of course, at some point serialization needs to happen. So there will always some cost in using a
GenericSubscription. This gets even more valid when dealing withrosbag2, that currently stores data in serialized format. The point here is to avoid RMW / data transmission on loopback when not needed.This PR allows
GenericSubscriptionto create aSubscriptionIntraProcesswhose template type isrclcpp::SerializedMessage.IntraProcessManagergets new internal collections and methods specifically used to track and manage these new subscribers - instead of mixing them in existing structures, they are collected in separate collections so that the added logic can easily treat normal subscribers and generic subscribers in different ways (if needed).See ros2/rosbag2#2267 for motivation & further context.
Is this user-facing behavior change?
No outstanding changes in API - in theory stuff like
rosbag2needs just to be rebuilt against this branch ofrclcpp. Everything happens "under the hood" in the constructor ofGenericSubscritionand theIntraProcessManager.Did you use Generative AI?
No
Additional Information
rosbag2on top of this.test_generic_pubsubhas been modified to run with intra-process enabled and two additional test cases. It runs green!Feel free to provide your feedbacks on this - I'll may let sink this here for a while before polishing in greater detail.