Skip to content

Additional improvements to TypeAdapted intra-process comms #1860

@clalancette

Description

@clalancette

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:

  1. There is a TODO in the code at
    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));
    }
    . In particular, if we are calling 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 in do_intra_process_publish, we are unnecessarily doing it again in the publish call directly. The answer is probably to make a new overload of do_intra_process_publish_and_return_shared which always returns the ROSMessageType, and then use that directly when doing the inter-process publish. This probably requires plumbing all the way down to the IntraProcessManager layer.
  2. 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 to create_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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions