-
Notifications
You must be signed in to change notification settings - Fork 521
Additional improvements to TypeAdapted intra-process comms #1860
Copy link
Copy link
Open
Labels
Description
When we merged in #1849 , we did it knowing that there were still improvements that could be made to the code. In particular, there are 2 outstanding issues with that code that we know about:
- There is a TODO in the code at . In particular, if we are calling
rclcpp/rclcpp/include/rclcpp/publisher.hpp
Lines 333 to 343 in 6b321ed
if (inter_process_publish_needed) { ROSMessageType ros_msg; // TODO(clalancette): This is unnecessarily doing an additional conversion // that may have already been done in do_intra_process_publish_and_return_shared(). // We should just reuse that effort. rclcpp::TypeAdapter<MessageT>::convert_to_ros_message(*msg, ros_msg); this->do_intra_process_publish(std::move(msg)); this->do_inter_process_publish(ros_msg); } else { this->do_intra_process_publish(std::move(msg)); } do_intra_process_publish, then it may be the case that as part of that call we are doing a conversion from PublishType -> ROSMessageType so that we can store the ROSMessageType in one or more of the subscribers. But if we did that indo_intra_process_publish, we are unnecessarily doing it again in thepublishcall directly. The answer is probably to make a new overload ofdo_intra_process_publish_and_return_sharedwhich always returns the ROSMessageType, and then use that directly when doing the inter-process publish. This probably requires plumbing all the way down to theIntraProcessManagerlayer. - There's a discussion in Add non transform capabilities for intra-process #1849 (comment) about simplifying the number of cases we need to handle in
AnySubscriptionCallback. Currently we allow the signature of the Subscription callback to be a different (though convertible) type from the template type we passed tocreate_subscription. However, if we force the two of them to be the same, then we can get rid of several case statements when dispatching data. That would help a lot in maintenance since there are a lot of cases handled during dispatch currently.
Reactions are currently unavailable