Skip to content

Commit df24688

Browse files
update 'create_publisher' API
1 parent f79b7e1 commit df24688

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

orbbec_camera/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ if(message_filters_VERSION VERSION_GREATER_EQUAL 5.0)
5757
add_compile_definitions(message_filters_QoS)
5858
endif()
5959

60+
if(image_transport_VERSION VERSION_GREATER_EQUAL 6.4)
61+
add_compile_definitions(image_transport_NODE_INTERFACE)
62+
endif()
63+
6064
if(USE_RK_HW_DECODER)
6165
pkg_search_module(RK_MPP REQUIRED rockchip_mpp)
6266
if(NOT RK_MPP_FOUND)

orbbec_camera/src/image_publisher.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,19 @@ image_transport_publisher::image_transport_publisher(rclcpp::Node& node,
3636
const std::string& topic_name,
3737
const rmw_qos_profile_t& qos) {
3838
image_publisher_impl = std::make_shared<image_transport::Publisher>(
39-
image_transport::create_publisher(&node, topic_name, qos));
39+
image_transport::create_publisher(
40+
#ifdef image_transport_NODE_INTERFACE
41+
image_transport::RequiredInterfaces{node},
42+
#else
43+
&node,
44+
#endif
45+
topic_name,
46+
#ifdef message_filters_QoS
47+
rclcpp::QoS{rclcpp::QoSInitialization::from_rmw(qos)}
48+
#else
49+
qos
50+
#endif
51+
));
4052
}
4153
void image_transport_publisher::publish(sensor_msgs::msg::Image::UniquePtr image_ptr) {
4254
image_publisher_impl->publish(*image_ptr);

0 commit comments

Comments
 (0)