Add wait_for_message overload using node interfaces - #3230
Conversation
|
Tick the box to add this pull request to the merge queue (same as
|
Signed-off-by: Yadunund Vijay <yadunund@gmail.com>
bf353ac to
834930e
Compare
skyegalaxy
left a comment
There was a problem hiding this comment.
lgtm. surprised we didn't already have this in the API before
|
Pulls: #3230 |
fujitatomoya
left a comment
There was a problem hiding this comment.
lgtm with green CI.
|
this one is API-additive change, let's backport this to the latest LTS? |
|
@Mergifyio backport lyrical |
✅ Backports have been createdDetails
Cherry-pick of 5dd47aa has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
Description
Add a
rclcpp::wait_for_messageoverload that takesNodeParametersInterfaceandNodeTopicsInterfaceinstead ofrclcpp::Node::SharedPtr.The existing topic convenience overload requires a
Node::SharedPtr, so it cannot be used withrclcpp_lifecycle::LifecycleNode, or during node construction whenshared_from_this()is unavailable. The new overload uses the samerclcpp::create_subscriptioninterface path already used elsewhere in rclcpp. TheNode::SharedPtroverload now delegates to it.Also extend coverage with:
rclcpprclcpp_lifecyclethat waits via aLifecycleNodeheld in aunique_ptr(noshared_from_this)Related to #1953 (LifecycleNode / non-
Node::SharedPtrsupport from the original proposal). This does not address the still-open executor / wait-set concern discussed there (callingwait_for_messagefrom inside a node already managed by an executor).Is this user-facing behavior change?
Yes. Callers can wait for a topic message using node interfaces, which enables
LifecycleNodeand construction-time use withoutshared_from_this(). ExistingNode::SharedPtrand subscription+context overloads are unchanged in behavior.Did you use Generative AI?
Yes. Cursor (Grok) was used to help draft the overload, tests, and this PR description. Changes were reviewed, adjusted and tested manually.
Additional Information
Example:
Tested via: