Skip to content

Commit deb9fe4

Browse files
committed
fix: Remove usage of deprecated rclcpp API
1 parent 4b5f4e3 commit deb9fe4

4 files changed

Lines changed: 12 additions & 13 deletions

File tree

include/web_video_server/utils.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include <string>
3333
#include <optional>
3434

35-
#include "rmw/types.h"
35+
#include "rclcpp/qos.hpp"
3636

3737
namespace web_video_server
3838
{
@@ -42,6 +42,6 @@ namespace web_video_server
4242
* @param name The name of the QoS profile name.
4343
* @return An optional containing the matching QoS profile.
4444
*/
45-
std::optional<rmw_qos_profile_t> get_qos_profile_from_name(std::string name);
45+
std::optional<rclcpp::QoS> get_qos_profile_from_name(std::string name);
4646

4747
} // namespace web_video_server

src/streamers/image_transport_streamer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void ImageTransportStreamerBase::start()
118118
return;
119119
}
120120

121-
const image_transport::TransportHints hints(node.get(), default_transport_);
121+
const image_transport::TransportHints hints(*node.get(), default_transport_);
122122
auto tnat = node->get_topic_names_and_types();
123123
inactive_ = true;
124124
for (auto topic_and_types : tnat) {
@@ -139,7 +139,7 @@ void ImageTransportStreamerBase::start()
139139
qos_profile_name_.c_str());
140140
auto qos_profile = get_qos_profile_from_name(qos_profile_name_);
141141
if (!qos_profile) {
142-
qos_profile = rmw_qos_profile_default;
142+
qos_profile = rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(rmw_qos_profile_default));
143143
RCLCPP_ERROR(
144144
logger_,
145145
"Invalid QoS profile %s specified. Using default profile.",
@@ -148,7 +148,7 @@ void ImageTransportStreamerBase::start()
148148

149149
// Create subscriber
150150
image_sub_ = image_transport::create_subscription(
151-
node.get(), topic_,
151+
*node.get(), topic_,
152152
std::bind(&ImageTransportStreamerBase::image_callback, this, std::placeholders::_1),
153153
default_transport_, qos_profile.value());
154154
}

src/streamers/ros_compressed_streamer.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,10 @@ rclcpp::QoS make_compressed_qos(
8484
logger,
8585
"Invalid QoS profile %s specified. Using default profile.",
8686
qos_profile_name.c_str());
87-
qos_profile = rmw_qos_profile_default;
87+
qos_profile = rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(rmw_qos_profile_default));
8888
}
8989

90-
return rclcpp::QoS(
91-
rclcpp::QoSInitialization(qos_profile.value().history, 1),
92-
qos_profile.value());
90+
return qos_profile.value();
9391
}
9492

9593
std::optional<std::string> resolve_content_type(

src/utils.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,23 @@
3232
#include <optional>
3333
#include <string>
3434

35+
#include "rclcpp/qos.hpp"
3536
#include "rmw/qos_profiles.h"
3637
#include "rmw/types.h"
3738

3839
namespace web_video_server
3940
{
4041

41-
std::optional<rmw_qos_profile_t> get_qos_profile_from_name(const std::string name)
42+
std::optional<rclcpp::QoS> get_qos_profile_from_name(const std::string name)
4243
{
4344
if (name == "default") {
44-
return rmw_qos_profile_default;
45+
return rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(rmw_qos_profile_default));
4546
}
4647
if (name == "system_default") {
47-
return rmw_qos_profile_system_default;
48+
return rclcpp::SystemDefaultsQoS();
4849
}
4950
if (name == "sensor_data") {
50-
return rmw_qos_profile_sensor_data;
51+
return rclcpp::SensorDataQoS();
5152
}
5253
return std::nullopt;
5354
}

0 commit comments

Comments
 (0)