From deb9fe48e63fd1eca9b0e187fa0707b45ba33696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Sowa?= Date: Tue, 30 Jun 2026 17:28:56 +0000 Subject: [PATCH 1/6] fix: Remove usage of deprecated rclcpp API --- include/web_video_server/utils.hpp | 4 ++-- src/streamers/image_transport_streamer.cpp | 6 +++--- src/streamers/ros_compressed_streamer.cpp | 6 ++---- src/utils.cpp | 9 +++++---- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/web_video_server/utils.hpp b/include/web_video_server/utils.hpp index 1549e19..1f7429e 100644 --- a/include/web_video_server/utils.hpp +++ b/include/web_video_server/utils.hpp @@ -32,7 +32,7 @@ #include #include -#include "rmw/types.h" +#include "rclcpp/qos.hpp" namespace web_video_server { @@ -42,6 +42,6 @@ namespace web_video_server * @param name The name of the QoS profile name. * @return An optional containing the matching QoS profile. */ -std::optional get_qos_profile_from_name(std::string name); +std::optional get_qos_profile_from_name(std::string name); } // namespace web_video_server diff --git a/src/streamers/image_transport_streamer.cpp b/src/streamers/image_transport_streamer.cpp index 5369276..7e42778 100644 --- a/src/streamers/image_transport_streamer.cpp +++ b/src/streamers/image_transport_streamer.cpp @@ -118,7 +118,7 @@ void ImageTransportStreamerBase::start() return; } - const image_transport::TransportHints hints(node.get(), default_transport_); + const image_transport::TransportHints hints(*node.get(), default_transport_); auto tnat = node->get_topic_names_and_types(); inactive_ = true; for (auto topic_and_types : tnat) { @@ -139,7 +139,7 @@ void ImageTransportStreamerBase::start() qos_profile_name_.c_str()); auto qos_profile = get_qos_profile_from_name(qos_profile_name_); if (!qos_profile) { - qos_profile = rmw_qos_profile_default; + qos_profile = rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(rmw_qos_profile_default)); RCLCPP_ERROR( logger_, "Invalid QoS profile %s specified. Using default profile.", @@ -148,7 +148,7 @@ void ImageTransportStreamerBase::start() // Create subscriber image_sub_ = image_transport::create_subscription( - node.get(), topic_, + *node.get(), topic_, std::bind(&ImageTransportStreamerBase::image_callback, this, std::placeholders::_1), default_transport_, qos_profile.value()); } diff --git a/src/streamers/ros_compressed_streamer.cpp b/src/streamers/ros_compressed_streamer.cpp index 2e0ca14..95aaf27 100644 --- a/src/streamers/ros_compressed_streamer.cpp +++ b/src/streamers/ros_compressed_streamer.cpp @@ -84,12 +84,10 @@ rclcpp::QoS make_compressed_qos( logger, "Invalid QoS profile %s specified. Using default profile.", qos_profile_name.c_str()); - qos_profile = rmw_qos_profile_default; + qos_profile = rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(rmw_qos_profile_default)); } - return rclcpp::QoS( - rclcpp::QoSInitialization(qos_profile.value().history, 1), - qos_profile.value()); + return qos_profile.value(); } std::optional resolve_content_type( diff --git a/src/utils.cpp b/src/utils.cpp index 8005135..13ed821 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -32,22 +32,23 @@ #include #include +#include "rclcpp/qos.hpp" #include "rmw/qos_profiles.h" #include "rmw/types.h" namespace web_video_server { -std::optional get_qos_profile_from_name(const std::string name) +std::optional get_qos_profile_from_name(const std::string name) { if (name == "default") { - return rmw_qos_profile_default; + return rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(rmw_qos_profile_default)); } if (name == "system_default") { - return rmw_qos_profile_system_default; + return rclcpp::SystemDefaultsQoS(); } if (name == "sensor_data") { - return rmw_qos_profile_sensor_data; + return rclcpp::SensorDataQoS(); } return std::nullopt; } From e39699da0f4274ed6bc4a31349aa7d54bf998bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Sowa?= Date: Tue, 30 Jun 2026 17:42:48 +0000 Subject: [PATCH 2/6] Make the fix compatible with older distributions --- CMakeLists.txt | 4 ++++ src/streamers/image_transport_streamer.cpp | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e66e79..5c56ab3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,10 @@ if(${cv_bridge_VERSION} VERSION_LESS "3.3.0") add_compile_definitions(CV_BRIDGE_USES_OLD_HEADERS) endif() +if(${image_transport_VERSION} VERSION_LESS "6.4.0") + add_compile_definitions(IMAGE_TRANSPORT_USES_OLD_API) +endif() + ## Declare a cpp library add_library(${PROJECT_NAME} SHARED src/web_video_server.cpp diff --git a/src/streamers/image_transport_streamer.cpp b/src/streamers/image_transport_streamer.cpp index 7e42778..4c4d225 100644 --- a/src/streamers/image_transport_streamer.cpp +++ b/src/streamers/image_transport_streamer.cpp @@ -118,7 +118,11 @@ void ImageTransportStreamerBase::start() return; } +#ifdef IMAGE_TRANSPORT_USES_OLD_API + const image_transport::TransportHints hints(node.get(), default_transport_); +#else const image_transport::TransportHints hints(*node.get(), default_transport_); +#endif auto tnat = node->get_topic_names_and_types(); inactive_ = true; for (auto topic_and_types : tnat) { @@ -147,10 +151,17 @@ void ImageTransportStreamerBase::start() } // Create subscriber +#ifdef IMAGE_TRANSPORT_USES_OLD_API + image_sub_ = image_transport::create_subscription( + node.get(), topic_, + std::bind(&ImageTransportStreamerBase::image_callback, this, std::placeholders::_1), + default_transport_, qos_profile.get_rmw_qos_profile()); +#else image_sub_ = image_transport::create_subscription( *node.get(), topic_, std::bind(&ImageTransportStreamerBase::image_callback, this, std::placeholders::_1), default_transport_, qos_profile.value()); +#endif } #pragma GCC diagnostic pop From 5f6f6b874dd923a548972ed53e57d3828f1b3c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Sowa?= Date: Tue, 30 Jun 2026 17:47:00 +0000 Subject: [PATCH 3/6] Fix again --- src/streamers/image_transport_streamer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/streamers/image_transport_streamer.cpp b/src/streamers/image_transport_streamer.cpp index 4c4d225..b107eea 100644 --- a/src/streamers/image_transport_streamer.cpp +++ b/src/streamers/image_transport_streamer.cpp @@ -155,7 +155,7 @@ void ImageTransportStreamerBase::start() image_sub_ = image_transport::create_subscription( node.get(), topic_, std::bind(&ImageTransportStreamerBase::image_callback, this, std::placeholders::_1), - default_transport_, qos_profile.get_rmw_qos_profile()); + default_transport_, qos_profile.value().get_rmw_qos_profile()); #else image_sub_ = image_transport::create_subscription( *node.get(), topic_, From b7176ee5a72023592898917eba40ba4cfdf4db6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Sowa?= Date: Wed, 1 Jul 2026 04:33:16 +0000 Subject: [PATCH 4/6] Keep forcing QoS depth of 1 in ros_compressed streamer --- src/streamers/ros_compressed_streamer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/streamers/ros_compressed_streamer.cpp b/src/streamers/ros_compressed_streamer.cpp index 95aaf27..49205fc 100644 --- a/src/streamers/ros_compressed_streamer.cpp +++ b/src/streamers/ros_compressed_streamer.cpp @@ -87,7 +87,9 @@ rclcpp::QoS make_compressed_qos( qos_profile = rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(rmw_qos_profile_default)); } - return qos_profile.value(); + auto qos = qos_profile.value(); + qos.keep_last(1); + return qos; } std::optional resolve_content_type( From 0016e63c4bccd451c33b0b5b0c4c37a63b516ef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Sowa?= Date: Wed, 1 Jul 2026 04:33:35 +0000 Subject: [PATCH 5/6] Update get_qos_profile_from_name API --- include/web_video_server/utils.hpp | 4 ++-- src/utils.cpp | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/web_video_server/utils.hpp b/include/web_video_server/utils.hpp index 1f7429e..babbb7c 100644 --- a/include/web_video_server/utils.hpp +++ b/include/web_video_server/utils.hpp @@ -39,9 +39,9 @@ namespace web_video_server /** * @brief Gets a QoS profile given an input name, if valid. - * @param name The name of the QoS profile name. + * @param name The name of the QoS profile. * @return An optional containing the matching QoS profile. */ -std::optional get_qos_profile_from_name(std::string name); +std::optional get_qos_profile_from_name(const std::string & name); } // namespace web_video_server diff --git a/src/utils.cpp b/src/utils.cpp index 13ed821..1124b4e 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -34,12 +34,11 @@ #include "rclcpp/qos.hpp" #include "rmw/qos_profiles.h" -#include "rmw/types.h" namespace web_video_server { -std::optional get_qos_profile_from_name(const std::string name) +std::optional get_qos_profile_from_name(const std::string & name) { if (name == "default") { return rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(rmw_qos_profile_default)); From f5fadcbe78fe0ff97f13b65b8ba2133eb011e7d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Sowa?= Date: Wed, 1 Jul 2026 04:33:48 +0000 Subject: [PATCH 6/6] Remove unused transport hints --- src/streamers/image_transport_streamer.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/streamers/image_transport_streamer.cpp b/src/streamers/image_transport_streamer.cpp index b107eea..54baa3f 100644 --- a/src/streamers/image_transport_streamer.cpp +++ b/src/streamers/image_transport_streamer.cpp @@ -52,7 +52,6 @@ #include "async_web_server_cpp/http_connection.hpp" #include "async_web_server_cpp/http_request.hpp" #include "image_transport/image_transport.hpp" -#include "image_transport/transport_hints.hpp" #include "rclcpp/node.hpp" #include "rclcpp/logging.hpp" #include "rmw/qos_profiles.h" @@ -118,11 +117,6 @@ void ImageTransportStreamerBase::start() return; } -#ifdef IMAGE_TRANSPORT_USES_OLD_API - const image_transport::TransportHints hints(node.get(), default_transport_); -#else - const image_transport::TransportHints hints(*node.get(), default_transport_); -#endif auto tnat = node->get_topic_names_and_types(); inactive_ = true; for (auto topic_and_types : tnat) {