Add get_non_local_subscription_count to PublisherBase#2338
Add get_non_local_subscription_count to PublisherBase#2338MiguelCompany wants to merge 2 commits intoros2:rollingfrom
get_non_local_subscription_count to PublisherBase#2338Conversation
Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>
Signed-off-by: JLBuenoLopez-eProsima <joseluisbueno@eprosima.com>
get_non_local_subscription_count to PublisherBase
|
Can we add a couple of unit-tests? |
| size_t | ||
| get_subscription_count() const; | ||
|
|
||
| /// Get non local subscription count |
There was a problem hiding this comment.
I think this means that Not in the same context for the ROS 2 user (precisely for DDS-RTPS, GUID prefix is not the same), that would be nicer to add the description explains?
| if (RCL_RET_OK != status) { | ||
| rclcpp::exceptions::throw_from_rcl_error( | ||
| status, | ||
| "failed to get get non local subscription count"); |
There was a problem hiding this comment.
| "failed to get get non local subscription count"); | |
| "failed to get non local subscription count"); |
|
@MiguelCompany Friendly ping. Would you be willing to address @fujitatomoya's feedback? |
|
I've been testing the new feature enabled by: This not only fixes the "double delivery" issue (local subscription receiving intra & inter process message), but also reduces CPU at startup and destruction of subscriptions. When creating a subscription, there is a short time gap in which the intra-process subscription has not yet been created, so messages come through inter-process (serialization/deserialization/etc) causing high CPU utillization. This is particularly noticeable for |
|
Correction about my statement above:
This PR doesn't fix the double delivery issue. It does avoid getting inter-process messages at creation/destruction of subscriptions. Is there anything missing to avoid the double delivery issue @MiguelCompany ? Or is that a separate effort?
|
Adds a method in
PublisherBasethat returns the number of matched subscriptions that are not in the same context as the publisher.It also makes inter-process publishing depend on this new method.
Depends on ros2/rcl#1111
Part of #2202
full repos file here