ros2 / ros2/rclcpp

Add take_loaned() method in Subscription class

Open
#1,699 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
C++
Stars
805
Forks
564
Avg merge
1d 17h
Merged PRs (30d)
27

Description

Currently, there is no rclcpp API exposed in the subscription class to take a loaned message. The only way to use zero-copy on the subscription side is through an executor which uses rcl_take_loaned_message directly. See: https://github.com/ros2/rclcpp/blob/7d8b2690ff188672bfe3703d8b3c074b87303931/rclcpp/src/rclcpp/executor.cpp#L598-L633

We should have a take_loaned() method or similar to support those cases where the user wants to take a loaned message directly. This is required for example to support zero-copy using a rclcpp::waitset in performance_test.

Once this method is implemented I think we should update the zero-copy article to add the new APIs: https://design.ros2.org/articles/zero_copy.html

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with rclcpp/src/rclcpp/executor.cpp around the referenced rcl_take_loaned_message call and inspect the Subscription class API. Add a direct loaned-message-taking entry point suitable for waitset use, then verify the relevant tests; update the zero-copy article only if the new API is implemented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api, robotics
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.