update 'create_publisher' API

This commit is contained in:
Christian Rauch
2026-07-24 10:53:27 +02:00
parent 75636938cc
commit 4fa2c29fb2
2 changed files with 21 additions and 1 deletions
+8
View File
@@ -57,6 +57,14 @@ if(message_filters_VERSION VERSION_GREATER_EQUAL 5.0)
add_compile_definitions(message_filters_QoS)
endif()
if(image_transport_VERSION VERSION_GREATER_EQUAL 6.4)
add_compile_definitions(image_transport_NODE_INTERFACE)
endif()
if(image_transport_VERSION VERSION_GREATER_EQUAL 6.4)
add_compile_definitions(image_transport_QoS)
endif()
if(USE_RK_HW_DECODER)
pkg_search_module(RK_MPP REQUIRED rockchip_mpp)
if(NOT RK_MPP_FOUND)
+13 -1
View File
@@ -36,7 +36,19 @@ image_transport_publisher::image_transport_publisher(rclcpp::Node& node,
const std::string& topic_name,
const rmw_qos_profile_t& qos) {
image_publisher_impl = std::make_shared<image_transport::Publisher>(
image_transport::create_publisher(&node, topic_name, qos));
image_transport::create_publisher(
#ifdef image_transport_NODE_INTERFACE
image_transport::RequiredInterfaces{node},
#else
&node,
#endif
topic_name,
#ifdef image_transport_QoS
rclcpp::QoS{rclcpp::QoSInitialization::from_rmw(qos), qos}
#else
qos
#endif
));
}
void image_transport_publisher::publish(sensor_msgs::msg::Image::UniquePtr image_ptr) {
image_publisher_impl->publish(*image_ptr);