Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support zero-copy intra-process publishing (backport #306) #310

Merged
merged 1 commit into from
May 24, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented May 16, 2024

ROS2 supports intra-process communication when composing multiple nodes in a single process. It additionally can avoid doing any copies of the data when published using std::unique_ptr<MessageT> and subscribed using shared_ptr<const MessageT> or std::unique_ptr<MessageT> (at most 1 subscriber)

This PR is my attempt to add support for publishing using std::unique_ptr without breaking any of the existing APIs.

The idea is that:

  1. Each publisher plugin can decide whether they support publishing using unique ptr (for now I don't see how any other plugin than raw can take advantage of the ownership).
  2. The new Publisher::publish(sensor_msgs::msg::Image::UniquePtr message) method first publishes using the const reference to plugins that don't support std::unique_ptr, then moves the ownership of the message to (at most 1) plugin that supports it.
  3. If there is more than one plugin that supports std::unique_ptr and has subscriptions, we pass the ownership to only one such plugin (the first we find), and for the rest we still use const reference, delegating doing any extra copies to plugin implementations.

Related issues/prs:
#212
#215
#216 (kinda)


This is an automatic backport of pull request #306 done by Mergify.

@ahcorde
Copy link
Collaborator

ahcorde commented May 16, 2024

Holding off on this one for Jazzy patch release 1.

Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@ahcorde ahcorde merged commit a3c2cc6 into jazzy May 24, 2024
2 checks passed
@ahcorde ahcorde deleted the mergify/bp/jazzy/pr-306 branch May 24, 2024 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants