Skip to content

Add qos parameter for wait_for_message function#2903

Merged
ahcorde merged 9 commits intoros2:rollingfrom
ghanta1996:feat/qos-profile-for-wait_for_message
Jul 16, 2025
Merged

Add qos parameter for wait_for_message function#2903
ahcorde merged 9 commits intoros2:rollingfrom
ghanta1996:feat/qos-profile-for-wait_for_message

Conversation

@ghanta1996
Copy link
Copy Markdown
Contributor

Description

A small change to include the QoS settings as one of the parameters for rclcpp::wait_for_message. This is useful in cases where we want just to get the last published message on the topic, rather than always waiting for a new message.

Fixes # (issue)

Is this user-facing behavior change?

Did you use Generative AI?

No

Additional Information

@ghanta1996 ghanta1996 force-pushed the feat/qos-profile-for-wait_for_message branch from 9e72fbc to 68ed3dd Compare July 12, 2025 02:33
Copy link
Copy Markdown
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

Can you also add the test for QoS optional argument?

@ghanta1996 ghanta1996 force-pushed the feat/qos-profile-for-wait_for_message branch 2 times, most recently from acb459f to 3b88d28 Compare July 13, 2025 07:53
@fujitatomoya
Copy link
Copy Markdown
Collaborator

@ghanta1996 there is another thing i should have mentioned before, can your retarget this PR against rolling? that is our development branch and if that fix can keep the API/ABI compatibility, we can consider the backport to the downstream distros. sorry i should have mentioned this 1st.

@ghanta1996 ghanta1996 changed the base branch from jazzy to rolling July 13, 2025 23:15
@ghanta1996 ghanta1996 force-pushed the feat/qos-profile-for-wait_for_message branch from 3b88d28 to 22b6109 Compare July 13, 2025 23:21
@ghanta1996
Copy link
Copy Markdown
Contributor Author

@fujitatomoya No worries. I have rebased my branch to rolling and updated the PR accordingly. Thanks

Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Sriharsha Ghanta <harsha@lionsbot.com>
Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>

Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Sriharsha Ghanta <harsha@lionsbot.com>
Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Add test case for using QoS

Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Sriharsha Ghanta <harsha@lionsbot.com>
Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Sriharsha Ghanta <harsha@lionsbot.com>
Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Sriharsha Ghanta <harsha@lionsbot.com>
Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
@ghanta1996 ghanta1996 force-pushed the feat/qos-profile-for-wait_for_message branch 2 times, most recently from a31cd3c to 87bc402 Compare July 14, 2025 02:00
Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
@ghanta1996 ghanta1996 force-pushed the feat/qos-profile-for-wait_for_message branch from 87bc402 to 117d00f Compare July 14, 2025 02:16
@ghanta1996 ghanta1996 requested a review from fujitatomoya July 14, 2025 02:35
Copy link
Copy Markdown
Contributor

@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.

Copy link
Copy Markdown
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

just a minor nitpick, and lgtm with @ahcorde 's comment resolved. thanks 👍

* Wait for the next incoming message to arrive on a specified topic before the specified timeout.
*
* \param[out] out is the message to be filled when a new message is arriving.
* Specify the QoS settings for the subscription to control how messages are received.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

i would remove this comment, it is pretty much the duplication of qos parameter explanation in the main body.

Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
@ghanta1996 ghanta1996 requested a review from ahcorde July 14, 2025 16:06
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
@ahcorde
Copy link
Copy Markdown
Contributor

ahcorde commented Jul 14, 2025

Pulls: #2903
Gist: https://gist.githubusercontent.com/ahcorde/ed15e9d8cb0ee699f0da4c2e779588d4/raw/1e21fb39d53a36fc56f61494a103fab3e9d7b2bd/ros2.repos
BUILD args: --packages-above-and-dependencies rclcpp
TEST args: --packages-above rclcpp
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/16493

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

@ahcorde ahcorde merged commit 2fcef70 into ros2:rolling Jul 16, 2025
2 of 3 checks passed
@fujitatomoya
Copy link
Copy Markdown
Collaborator

The added parameter in the function signature is given a default value.
This means existing code that calls wait_for_message without specifying the qos parameter will continue to work exactly as before.
The function’s usage, binary compatibility (ABI), and source compatibility (API) are preserved.

I am gonna try to backport this fix to downstream distros.

@fujitatomoya
Copy link
Copy Markdown
Collaborator

@Mergifyio backport kilted jazzy humble

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jul 16, 2025

backport kilted jazzy humble

✅ Backports have been created

Details

mergify bot pushed a commit that referenced this pull request Jul 16, 2025
Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Co-authored-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
(cherry picked from commit 2fcef70)
mergify bot pushed a commit that referenced this pull request Jul 16, 2025
Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Co-authored-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
(cherry picked from commit 2fcef70)
mergify bot pushed a commit that referenced this pull request Jul 16, 2025
Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Co-authored-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
(cherry picked from commit 2fcef70)
fujitatomoya pushed a commit that referenced this pull request Jul 16, 2025
(cherry picked from commit 2fcef70)

Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Co-authored-by: Sriharsha Ghanta <ghanta_sriharsha@mymail.sutd.edu.sg>
Co-authored-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
fujitatomoya pushed a commit that referenced this pull request Jul 16, 2025
(cherry picked from commit 2fcef70)

Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Co-authored-by: Sriharsha Ghanta <ghanta_sriharsha@mymail.sutd.edu.sg>
Co-authored-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
fujitatomoya pushed a commit that referenced this pull request Jul 17, 2025
(cherry picked from commit 2fcef70)

Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Co-authored-by: Sriharsha Ghanta <ghanta_sriharsha@mymail.sutd.edu.sg>
Co-authored-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
@ghanta1996 ghanta1996 deleted the feat/qos-profile-for-wait_for_message branch July 18, 2025 06:37
skyegalaxy pushed a commit to irobot-ros/rclcpp that referenced this pull request Jul 25, 2025
(cherry picked from commit 2fcef70)

Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Co-authored-by: Sriharsha Ghanta <ghanta_sriharsha@mymail.sutd.edu.sg>
Co-authored-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
skyegalaxy added a commit to irobot-ros/rclcpp that referenced this pull request Jul 28, 2025
* QoSInitialization::from_rmw does not validate invalid history policy values, leading to silent failures (ros2#2841) (ros2#2845)

(cherry picked from commit 73e9bfb)

Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

* get_all_data_impl() does not handle null pointers properly, causing segmentation fault (backport ros2#2840) (ros2#2851)

Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

* Added missing chrono includes (ros2#2854) (ros2#2856)

(cherry picked from commit 373a63c)

Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

* Fix for memory leaks in rclcpp::SerializedMessage (ros2#2861) (ros2#2864)

(cherry picked from commit 8d44b95)

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
Co-authored-by: Michael Orlov <morlovmr@gmail.com>
Co-authored-by: kylemarcey <marcey.kyle@gmail.com>

* Replace std::default_random_engine with std::mt19937 (humble) (ros2#2847) (ros2#2867)

(cherry picked from commit a0e2240)

Signed-off-by: keeponoiro <keeeeeeep@gmail.com>
Co-authored-by: keeponoiro <keeeeeeep@gmail.com>

* Changelog

Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>

* 28.1.10

* fix test_publisher_with_system_default_qos. (ros2#2881) (ros2#2883)

(cherry picked from commit e6577c6)

Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
Co-authored-by: Tomoya Fujita <Tomoya.Fujita@sony.com>

* Shutdown deadlock fix jazzy (ros2#2887)

* fix: Don't deadlock if removing shutdown callbacks in a shutdown callback

Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>

* refactor: Made fix API compatible

Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>

---------

Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>
Co-authored-by: Janosch Machowinski <J.Machowinski@cellumation.com>

* Event exec timer fix for ros2#2889 (ros2#2890)

Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>
Signed-off-by: Janosch Machowinski <jmachowinski@users.noreply.github.com>
Co-authored-by: Janosch Machowinski <J.Machowinski@cellumation.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

* Add overload of `append_parameter_override` (ros2#2891) (ros2#2895)

(cherry picked from commit fa0cf2d)

Signed-off-by: Patrick Roncagliolo <ronca.pat@gmail.com>
Co-authored-by: Patrick Roncagliolo <ronca.pat@gmail.com>

* Fujitatomoya/test append parameter override (ros2#2896) (ros2#2900)

(cherry picked from commit 84c6fb1)

Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
Co-authored-by: Tomoya Fujita <Tomoya.Fujita@sony.com>

* [jazzy] Expose `typesupport_helpers` API needed for the Rosbag2 (backport ros2#2858) (ros2#2902)

* Expose `typesupport_helpers` API needed for the Rosbag2 (ros2#2858)

* Expose extract_type_identifier and get_typesupport_library_path API

- Rationale: We need to use this API in the Rosbag2
- Reference PR ros2/rosbag2#2017 in the Rosbag2

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

* Use C++ style in doxygen documentation

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

---------

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
(cherry picked from commit 448287b)

# Conflicts:
#	rclcpp/include/rclcpp/typesupport_helpers.hpp

* Address merge conflicts

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

---------

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
Co-authored-by: Michael Orlov <morlovmr@gmail.com>

* Add qos parameter for wait_for_message function (ros2#2903) (ros2#2906)

(cherry picked from commit 2fcef70)

Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Co-authored-by: Sriharsha Ghanta <ghanta_sriharsha@mymail.sutd.edu.sg>
Co-authored-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>

* Fix `start_type_description_service` param handling (ros2#2897) (ros2#2909)

* Fix `start_type_description_service` param handling



* Add test



* Demonstrate different exceptions depending on node options



* Same exact exception and `what()` message in both cases



* Uncrustify



---------


(cherry picked from commit 4fb558a)

Signed-off-by: Patrick Roncagliolo <ronca.pat@gmail.com>
Co-authored-by: Patrick Roncagliolo <ronca.pat@gmail.com>

---------

Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Signed-off-by: Michael Orlov <morlovmr@gmail.com>
Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
Signed-off-by: keeponoiro <keeeeeeep@gmail.com>
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>
Signed-off-by: Janosch Machowinski <jmachowinski@users.noreply.github.com>
Signed-off-by: Patrick Roncagliolo <ronca.pat@gmail.com>
Signed-off-by: Sriharsha Ghanta <ghanta1996@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
Co-authored-by: Michael Orlov <morlovmr@gmail.com>
Co-authored-by: kylemarcey <marcey.kyle@gmail.com>
Co-authored-by: keeponoiro <keeeeeeep@gmail.com>
Co-authored-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
Co-authored-by: Janosch Machowinski <jmachowinski@users.noreply.github.com>
Co-authored-by: Janosch Machowinski <J.Machowinski@cellumation.com>
Co-authored-by: Patrick Roncagliolo <ronca.pat@gmail.com>
Co-authored-by: Sriharsha Ghanta <ghanta_sriharsha@mymail.sutd.edu.sg>
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.

3 participants