From 1800983f13df87d95e249e2dd071b013c939196d Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:34:32 +0100 Subject: [PATCH] Support QoS override parameters in depth_image_proc/register (backport #1043) (#1044) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR adds support to the `depth_image_proc` - `register` node for setting External QoS Configuration on topic _subscriptions_. Signed-off-by: Alejandro Hernández Cordero Co-authored-by: Stuart Alldritt Co-authored-by: Alejandro Hernández Cordero --- depth_image_proc/src/register.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/depth_image_proc/src/register.cpp b/depth_image_proc/src/register.cpp index e078beed..492e8575 100644 --- a/depth_image_proc/src/register.cpp +++ b/depth_image_proc/src/register.cpp @@ -133,14 +133,21 @@ RegisterNode::RegisterNode(const rclcpp::NodeOptions & options) sub_depth_info_.unsubscribe(); sub_rgb_info_.unsubscribe(); } else if (!sub_depth_image_.getSubscriber()) { + // Allow overriding QoS settings (history, depth, reliability) + rclcpp::SubscriptionOptions sub_options; + sub_options.qos_overriding_options = rclcpp::QosOverridingOptions::with_default_policies(); + // For compressed topics to remap appropriately, we need to pass a // fully expanded and remapped topic name to image_transport auto node_base = this->get_node_base_interface(); std::string topic = node_base->resolve_topic_or_service_name("depth/image_rect", false); image_transport::TransportHints hints(this, "raw", "depth_image_transport"); - sub_depth_image_.subscribe(this, topic, hints.getTransport()); - sub_depth_info_.subscribe(this, "depth/camera_info"); - sub_rgb_info_.subscribe(this, "rgb/camera_info"); + sub_depth_image_.subscribe(this, topic, hints.getTransport(), rmw_qos_profile_default, + sub_options); + auto qos = rmw_qos_profile_default; + qos.depth = 10; + sub_depth_info_.subscribe(this, "depth/camera_info", qos, sub_options); + sub_rgb_info_.subscribe(this, "rgb/camera_info", qos, sub_options); } }; // For compressed topics to remap appropriately, we need to pass a