From 4ce7d99a52574524e6042fd9f70a363c8f241fc4 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Tue, 26 May 2026 11:14:39 +0200 Subject: [PATCH 01/21] colcon workflow --- .github/workflows/colcon.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/colcon.yml diff --git a/.github/workflows/colcon.yml b/.github/workflows/colcon.yml new file mode 100644 index 00000000..ad1f1d18 --- /dev/null +++ b/.github/workflows/colcon.yml @@ -0,0 +1,28 @@ +name: colcon + +on: [push, pull_request] + +jobs: + # build on Ubuntu docker images + build: + name: "${{ matrix.image }} (${{ matrix.ros }})" + + runs-on: ubuntu-latest + + strategy: + matrix: + include: + - {image: "ubuntu:22.04", ros: humble} + - {image: "ubuntu:24.04", ros: jazzy} + + container: + image: ${{ matrix.image }} + + steps: + - uses: actions/checkout@v6 + + - uses: ros-tooling/setup-ros@v0.7 + + - uses: ros-tooling/action-ros-ci@v0.4 + with: + target-ros2-distro: ${{ matrix.ros }} From a157ad20ee538bd18e8672c19c34584528504c57 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Tue, 26 May 2026 11:14:39 +0200 Subject: [PATCH 02/21] colcon workflow --- .github/workflows/colcon.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/colcon.yml diff --git a/.github/workflows/colcon.yml b/.github/workflows/colcon.yml new file mode 100644 index 00000000..ad1f1d18 --- /dev/null +++ b/.github/workflows/colcon.yml @@ -0,0 +1,28 @@ +name: colcon + +on: [push, pull_request] + +jobs: + # build on Ubuntu docker images + build: + name: "${{ matrix.image }} (${{ matrix.ros }})" + + runs-on: ubuntu-latest + + strategy: + matrix: + include: + - {image: "ubuntu:22.04", ros: humble} + - {image: "ubuntu:24.04", ros: jazzy} + + container: + image: ${{ matrix.image }} + + steps: + - uses: actions/checkout@v6 + + - uses: ros-tooling/setup-ros@v0.7 + + - uses: ros-tooling/action-ros-ci@v0.4 + with: + target-ros2-distro: ${{ matrix.ros }} From 842ab626712f62caf5c791f45384eed9aae627ce Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Tue, 26 May 2026 11:35:08 +0200 Subject: [PATCH 03/21] update CMake requirements to 3.22 --- orbbec_camera/CMakeLists.txt | 2 +- orbbec_camera_msgs/CMakeLists.txt | 2 +- orbbec_description/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/orbbec_camera/CMakeLists.txt b/orbbec_camera/CMakeLists.txt index 9bde88d9..e702fe84 100644 --- a/orbbec_camera/CMakeLists.txt +++ b/orbbec_camera/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.22) project(orbbec_camera) set(CMAKE_CXX_STANDARD 17) diff --git a/orbbec_camera_msgs/CMakeLists.txt b/orbbec_camera_msgs/CMakeLists.txt index 347f4ed7..fd229bb6 100644 --- a/orbbec_camera_msgs/CMakeLists.txt +++ b/orbbec_camera_msgs/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.22) project(orbbec_camera_msgs) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/orbbec_description/CMakeLists.txt b/orbbec_description/CMakeLists.txt index 7fd8a452..8310ce57 100644 --- a/orbbec_description/CMakeLists.txt +++ b/orbbec_description/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.22) project(orbbec_description) find_package(ament_cmake REQUIRED) From 7b34a8d9523cc93641a9939a5c9574c0301c6e10 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Tue, 26 May 2026 13:29:15 +0200 Subject: [PATCH 04/21] add 'lyrical' to CI --- .github/workflows/colcon.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/colcon.yml b/.github/workflows/colcon.yml index ad1f1d18..c8afe194 100644 --- a/.github/workflows/colcon.yml +++ b/.github/workflows/colcon.yml @@ -14,6 +14,7 @@ jobs: include: - {image: "ubuntu:22.04", ros: humble} - {image: "ubuntu:24.04", ros: jazzy} + - {image: "ubuntu:26.04", ros: lyrical} container: image: ${{ matrix.image }} From c5f744869b1d60377949658d63c72d13537acd80 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Fri, 24 Jul 2026 10:15:37 +0200 Subject: [PATCH 05/21] update deprecated header --- .../multi_camera_time_sync/image_sync_example_node.cpp | 6 +++--- orbbec_camera/include/orbbec_camera/d2c_viewer.h | 8 ++++---- orbbec_camera/include/orbbec_camera/ob_camera_node.h | 10 +++++----- orbbec_camera/include/orbbec_camera/ob_lidar_node.h | 10 +++++----- orbbec_camera/include/orbbec_camera/utils.h | 2 +- orbbec_camera/tools/multi_save_rgbir.cpp | 6 +++--- orbbec_camera/tools/ob_benchmark.cpp | 6 +++--- orbbec_camera/tools/start_benchmark.cpp | 6 +++--- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/orbbec_camera/examples/multi_camera_time_sync/image_sync_example_node.cpp b/orbbec_camera/examples/multi_camera_time_sync/image_sync_example_node.cpp index b919592d..cc27f357 100644 --- a/orbbec_camera/examples/multi_camera_time_sync/image_sync_example_node.cpp +++ b/orbbec_camera/examples/multi_camera_time_sync/image_sync_example_node.cpp @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include #include diff --git a/orbbec_camera/include/orbbec_camera/d2c_viewer.h b/orbbec_camera/include/orbbec_camera/d2c_viewer.h index 8912e113..1bb366a2 100644 --- a/orbbec_camera/include/orbbec_camera/d2c_viewer.h +++ b/orbbec_camera/include/orbbec_camera/d2c_viewer.h @@ -14,10 +14,10 @@ * limitations under the License. *******************************************************************************/ #pragma once -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/orbbec_camera/include/orbbec_camera/ob_camera_node.h b/orbbec_camera/include/orbbec_camera/ob_camera_node.h index 366b65d9..68a3c319 100644 --- a/orbbec_camera/include/orbbec_camera/ob_camera_node.h +++ b/orbbec_camera/include/orbbec_camera/ob_camera_node.h @@ -31,11 +31,11 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include diff --git a/orbbec_camera/include/orbbec_camera/ob_lidar_node.h b/orbbec_camera/include/orbbec_camera/ob_lidar_node.h index 06da6341..93205155 100644 --- a/orbbec_camera/include/orbbec_camera/ob_lidar_node.h +++ b/orbbec_camera/include/orbbec_camera/ob_lidar_node.h @@ -31,11 +31,11 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include diff --git a/orbbec_camera/include/orbbec_camera/utils.h b/orbbec_camera/include/orbbec_camera/utils.h index 51af52e7..b1b6da8d 100644 --- a/orbbec_camera/include/orbbec_camera/utils.h +++ b/orbbec_camera/include/orbbec_camera/utils.h @@ -17,7 +17,7 @@ #pragma once #include #include -#include +#include #include #include "libobsensor/ObSensor.hpp" diff --git a/orbbec_camera/tools/multi_save_rgbir.cpp b/orbbec_camera/tools/multi_save_rgbir.cpp index 5efa13be..6496787a 100644 --- a/orbbec_camera/tools/multi_save_rgbir.cpp +++ b/orbbec_camera/tools/multi_save_rgbir.cpp @@ -5,9 +5,9 @@ #include #include "orbbec_camera/ob_camera_node.h" #include "orbbec_camera_msgs/msg/metadata.hpp" -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/orbbec_camera/tools/ob_benchmark.cpp b/orbbec_camera/tools/ob_benchmark.cpp index afc514d0..52022503 100644 --- a/orbbec_camera/tools/ob_benchmark.cpp +++ b/orbbec_camera/tools/ob_benchmark.cpp @@ -3,9 +3,9 @@ #include #include #include "orbbec_camera_msgs/msg/metadata.hpp" -#include -#include -#include +#include +#include +#include #include namespace orbbec_camera { diff --git a/orbbec_camera/tools/start_benchmark.cpp b/orbbec_camera/tools/start_benchmark.cpp index 7295c205..9b474080 100644 --- a/orbbec_camera/tools/start_benchmark.cpp +++ b/orbbec_camera/tools/start_benchmark.cpp @@ -3,9 +3,9 @@ #include #include #include "orbbec_camera_msgs/msg/metadata.hpp" -#include -#include -#include +#include +#include +#include #include namespace orbbec_camera { From e01836930480db44110a0daee8540ffcbca04a14 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Wed, 27 May 2026 13:32:34 +0200 Subject: [PATCH 06/21] ignore 'deprecated-declarations' --- orbbec_camera/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/orbbec_camera/CMakeLists.txt b/orbbec_camera/CMakeLists.txt index e702fe84..e1bf8b7d 100644 --- a/orbbec_camera/CMakeLists.txt +++ b/orbbec_camera/CMakeLists.txt @@ -13,6 +13,7 @@ option(INSTALL_UDEV_RULES "Install udev rule for Orbbec cameras" ON) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Werror -Wno-pedantic -Wno-array-bounds) + add_compile_options(-Wno-error=deprecated-declarations) endif() # find dependencies From 75636938cc1b2fc3c0f31c744c8c978d881f95d0 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Fri, 24 Jul 2026 10:18:42 +0200 Subject: [PATCH 07/21] use newer 'message_filters::Subscriber' constructor API --- orbbec_camera/CMakeLists.txt | 4 ++++ .../image_sync_example_node.cpp | 8 +++++++- orbbec_camera/src/d2c_viewer.cpp | 16 ++++++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) mode change 100644 => 100755 orbbec_camera/examples/multi_camera_time_sync/image_sync_example_node.cpp diff --git a/orbbec_camera/CMakeLists.txt b/orbbec_camera/CMakeLists.txt index e1bf8b7d..f497f989 100644 --- a/orbbec_camera/CMakeLists.txt +++ b/orbbec_camera/CMakeLists.txt @@ -53,6 +53,10 @@ endforeach() find_package(PkgConfig REQUIRED) find_package(OpenSSL REQUIRED) +if(message_filters_VERSION VERSION_GREATER_EQUAL 5.0) + add_compile_definitions(message_filters_QoS) +endif() + if(USE_RK_HW_DECODER) pkg_search_module(RK_MPP REQUIRED rockchip_mpp) if(NOT RK_MPP_FOUND) diff --git a/orbbec_camera/examples/multi_camera_time_sync/image_sync_example_node.cpp b/orbbec_camera/examples/multi_camera_time_sync/image_sync_example_node.cpp old mode 100644 new mode 100755 index cc27f357..aa8e838c --- a/orbbec_camera/examples/multi_camera_time_sync/image_sync_example_node.cpp +++ b/orbbec_camera/examples/multi_camera_time_sync/image_sync_example_node.cpp @@ -79,13 +79,19 @@ class ImageSyncNode : public rclcpp::Node { rclcpp::QoS qos{rclcpp::KeepLast(queue_size_)}; qos.reliable(); +#ifdef message_filters_QoS + const rclcpp::QoS qos_prof = qos; +#else + const rmw_qos_profile_t qos_prof = qos.get_rmw_qos_profile(); +#endif + if (sync_topics_.size() == 1) { single_sub_ = this->create_subscription( sync_topics_.front(), qos, [this](const ImageConstPtr msg) { this->handle_synced_images({msg}); }); } else { for (size_t i = 0; i < sync_topics_.size(); ++i) { - subscribers_[i].subscribe(this, sync_topics_[i], qos.get_rmw_qos_profile()); + subscribers_[i].subscribe(this, sync_topics_[i], qos_prof); } create_synchronizer(); } diff --git a/orbbec_camera/src/d2c_viewer.cpp b/orbbec_camera/src/d2c_viewer.cpp index d8a52802..0637f3f5 100644 --- a/orbbec_camera/src/d2c_viewer.cpp +++ b/orbbec_camera/src/d2c_viewer.cpp @@ -30,9 +30,21 @@ D2CViewer::D2CViewer(rclcpp::Node* const node, rmw_qos_profile_t rgb_qos, rmw_qos_profile_t depth_qos, bool use_intra_process) : node_(node), logger_(rclcpp::get_logger("d2c_viewer")), is_active_(true) { rgb_sub_ = std::make_shared>( - node_, "color/image_raw", rgb_qos); + node_, "color/image_raw", +#ifdef message_filters_QoS + rclcpp::QoS{rclcpp::QoSInitialization::from_rmw(rgb_qos), rgb_qos} +#else + rgb_qos +#endif + ); depth_sub_ = std::make_shared>( - node_, "depth/image_raw", depth_qos); + node_, "depth/image_raw", +#ifdef message_filters_QoS + rclcpp::QoS{rclcpp::QoSInitialization::from_rmw(depth_qos), depth_qos} +#else + depth_qos +#endif + ); sync_ = std::make_shared>(MySyncPolicy(10), *rgb_sub_, *depth_sub_); sync_->setMaxIntervalDuration(rclcpp::Duration::from_seconds(1.0)); // 1s From 4fa2c29fb20ac5af4165ad6d51a864b33bcfaf70 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Wed, 27 May 2026 13:08:33 +0200 Subject: [PATCH 08/21] update 'create_publisher' API --- orbbec_camera/CMakeLists.txt | 8 ++++++++ orbbec_camera/src/image_publisher.cpp | 14 +++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/orbbec_camera/CMakeLists.txt b/orbbec_camera/CMakeLists.txt index f497f989..79ef7880 100644 --- a/orbbec_camera/CMakeLists.txt +++ b/orbbec_camera/CMakeLists.txt @@ -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) diff --git a/orbbec_camera/src/image_publisher.cpp b/orbbec_camera/src/image_publisher.cpp index a68d1513..7283cb8d 100644 --- a/orbbec_camera/src/image_publisher.cpp +++ b/orbbec_camera/src/image_publisher.cpp @@ -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::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); From 9837dfb024dbb74a86c59265d8060594c0624d17 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Wed, 27 May 2026 16:34:38 +0200 Subject: [PATCH 09/21] remove unused header --- orbbec_camera/include/orbbec_camera/ob_camera_node.h | 1 - orbbec_camera/include/orbbec_camera/ob_lidar_node.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/orbbec_camera/include/orbbec_camera/ob_camera_node.h b/orbbec_camera/include/orbbec_camera/ob_camera_node.h index 68a3c319..a665be23 100644 --- a/orbbec_camera/include/orbbec_camera/ob_camera_node.h +++ b/orbbec_camera/include/orbbec_camera/ob_camera_node.h @@ -52,7 +52,6 @@ #include "libobsensor/ObSensor.hpp" #include "orbbec_camera_msgs/msg/device_info.hpp" -#include "orbbec_camera_msgs/msg/depth_filter_param.hpp" #include "orbbec_camera_msgs/msg/depth_filter_state.hpp" #include "orbbec_camera_msgs/msg/depth_filters_status.hpp" #include "orbbec_camera_msgs/srv/get_device_config.hpp" diff --git a/orbbec_camera/include/orbbec_camera/ob_lidar_node.h b/orbbec_camera/include/orbbec_camera/ob_lidar_node.h index 93205155..80115989 100644 --- a/orbbec_camera/include/orbbec_camera/ob_lidar_node.h +++ b/orbbec_camera/include/orbbec_camera/ob_lidar_node.h @@ -48,10 +48,8 @@ #include #include "libobsensor/ObSensor.hpp" -#include "orbbec_camera_msgs/msg/device_info.hpp" #include "orbbec_camera_msgs/srv/get_device_info.hpp" #include "orbbec_camera_msgs/msg/extrinsics.hpp" -#include "orbbec_camera_msgs/msg/metadata.hpp" #include "orbbec_camera_msgs/msg/imu_info.hpp" #include "orbbec_camera_msgs/srv/get_int32.hpp" #include "orbbec_camera_msgs/srv/get_string.hpp" From 217f4abee4d8564727af0724472dfced559c6702 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Thu, 28 May 2026 11:29:47 +0200 Subject: [PATCH 10/21] require 'orbbec_camera_msgs' at version 2.8.6 or later --- orbbec_camera/package.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orbbec_camera/package.xml b/orbbec_camera/package.xml index b38780e1..b0899b76 100644 --- a/orbbec_camera/package.xml +++ b/orbbec_camera/package.xml @@ -17,7 +17,7 @@ rclcpp_components cv_bridge camera_info_manager - orbbec_camera_msgs + orbbec_camera_msgs builtin_interfaces rclcpp sensor_msgs From 293cd7bbb0c32a8087578ed3ed272ceaab1bb79e Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Wed, 10 Jun 2026 14:24:22 +0200 Subject: [PATCH 11/21] enable 'relro', 'now', and 'defs' to ensure that all symbols are resolved --- orbbec_camera/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/orbbec_camera/CMakeLists.txt b/orbbec_camera/CMakeLists.txt index 79ef7880..907c8a5c 100644 --- a/orbbec_camera/CMakeLists.txt +++ b/orbbec_camera/CMakeLists.txt @@ -14,6 +14,7 @@ option(INSTALL_UDEV_RULES "Install udev rule for Orbbec cameras" ON) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Werror -Wno-pedantic -Wno-array-bounds) add_compile_options(-Wno-error=deprecated-declarations) + add_link_options("-Wl,-z,relro,-z,now,-z,defs") endif() # find dependencies From 8d34a65f8201bb6a6ecca4c3f7995687e4792c73 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Tue, 26 May 2026 13:04:39 +0200 Subject: [PATCH 12/21] replace 'ament_target_dependencies' macro --- orbbec_camera/CMakeLists.txt | 110 ++++++++++++++++++++++++----------- 1 file changed, 76 insertions(+), 34 deletions(-) diff --git a/orbbec_camera/CMakeLists.txt b/orbbec_camera/CMakeLists.txt index 907c8a5c..15fc98b6 100644 --- a/orbbec_camera/CMakeLists.txt +++ b/orbbec_camera/CMakeLists.txt @@ -114,26 +114,8 @@ set(COMMON_INCLUDE_DIRS $ ${ORBBEC_INCLUDE_DIR} ${OpenCV_INCLUDED_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/tools ) -set(COMMON_LIBRARIES - ${ORBBEC_SDK_LIBRARIES} - ${OpenCV_LIBS} - Eigen3::Eigen - -lOrbbecSDK - -L${ORBBEC_LIBS_DIR} - Threads::Threads - -lrt - -ldw - yaml-cpp - OpenSSL::Crypto +set(EXTRA_TARGETS ) -if(USE_RK_HW_DECODER) - list(APPEND COMMON_LIBRARIES ${RK_MPP_LIBRARIES} ${RGA_LIBRARIES}) - -endif() - -if(USE_NV_HW_DECODER) - list(APPEND COMMON_LIBRARIES ${NV_LIBRARIES}) -endif() set(SOURCE_FILES src/d2c_viewer.cpp @@ -154,15 +136,16 @@ if(USE_RK_HW_DECODER) add_definitions(-DUSE_RK_HW_DECODER) list(APPEND SOURCE_FILES src/rk_mpp_decoder.cpp) list(APPEND COMMON_INCLUDE_DIRS ${RK_MPP_INCLUDE_DIRS} ${RGA_INCLUDE_DIRS}) - list(APPEND COMMON_LIBRARIES ${RGA_LIBRARIES} ${RK_MPP_LIBRARIES}) + list(APPEND EXTRA_TARGETS ${RGA_LIBRARIES} ${RK_MPP_LIBRARIES}) if(NOT RGA_FOUND) - list(APPEND COMMON_LIBRARIES -lyuv) + list(APPEND EXTRA_TARGETS yuv) endif() endif() if(USE_NV_HW_DECODER) list(APPEND SOURCE_FILES src/jetson_nv_decoder.cpp) list(APPEND COMMON_INCLUDE_DIRS ${JETSON_MULTI_MEDIA_API_INCLUDE_DIR} ${LIBJPEG8B_INCLUDE_DIR}) + list(APPEND EXTRA_TARGETS ${NV_LIBRARIES}) # append jetson_multimedia_api source files list( APPEND @@ -185,16 +168,42 @@ endif() macro(add_orbbec_executable TARGET SOURCE) add_executable(${TARGET} ${SOURCE}) target_include_directories(${TARGET} PUBLIC ${COMMON_INCLUDE_DIRS}) - target_link_libraries(${TARGET} ${COMMON_LIBRARIES} ${PROJECT_NAME}) - ament_target_dependencies(${TARGET} ${dependencies}) + target_link_directories(${TARGET} PRIVATE + ${ORBBEC_LIBS_DIR} + ) + target_link_libraries(${TARGET} + ${OpenCV_LIBS} + ${PROJECT_NAME} + OrbbecSDK + yaml-cpp + ) endmacro() # Define library and nodes add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES}) -ament_target_dependencies(${PROJECT_NAME} ${dependencies}) -target_include_directories(${PROJECT_NAME} PUBLIC ${COMMON_INCLUDE_DIRS}) -target_link_libraries(${PROJECT_NAME} ${COMMON_LIBRARIES}) +target_include_directories(${PROJECT_NAME} PUBLIC ${COMMON_INCLUDE_DIRS} ${image_publisher_INCLUDE_DIRS}) +target_link_directories(${PROJECT_NAME} PRIVATE ${ORBBEC_LIBS_DIR}) +target_link_libraries(${PROJECT_NAME} + ${OpenCV_LIBS} + ${orbbec_camera_msgs_TARGETS} + ${sensor_msgs_TARGETS} + ${std_srvs_TARGETS} + ament_index_cpp::ament_index_cpp + camera_info_manager::camera_info_manager + cv_bridge::cv_bridge + diagnostic_updater::diagnostic_updater + Eigen3::Eigen + image_transport::image_transport + message_filters::message_filters + OpenSSL::Crypto + OrbbecSDK + rclcpp::rclcpp + rclcpp_components::component + tf2::tf2 + tf2_ros::tf2_ros + ${EXTRA_TARGETS} +) rclcpp_components_register_node( ${PROJECT_NAME} PLUGIN "orbbec_camera::OBCameraNodeDriver" EXECUTABLE orbbec_camera_node @@ -221,24 +230,57 @@ install( add_library(frame_latency SHARED tools/frame_latency.cpp) target_include_directories(frame_latency PUBLIC ${COMMON_INCLUDE_DIRS}) -target_link_libraries(frame_latency ${COMMON_LIBRARIES}) -ament_target_dependencies(frame_latency ${dependencies}) +target_link_libraries(frame_latency + ${orbbec_camera_msgs_TARGETS} + ${sensor_msgs_TARGETS} + ${tf2_msgs_TARGETS} + diagnostic_updater::diagnostic_updater + rclcpp::rclcpp + rclcpp_components::component +) rclcpp_components_register_node(frame_latency PLUGIN "orbbec_camera::FrameLatencyNode" EXECUTABLE frame_latency_node) add_library(start_benchmark SHARED tools/start_benchmark.cpp) -target_include_directories(start_benchmark PUBLIC ${COMMON_INCLUDE_DIRS}) -target_link_libraries(start_benchmark ${COMMON_LIBRARIES}) -ament_target_dependencies(start_benchmark ${dependencies}) +target_include_directories(start_benchmark PUBLIC ${COMMON_INCLUDE_DIRS} ${image_publisher_INCLUDE_DIRS}) +target_link_libraries(start_benchmark + ${OpenCV_LIBS} + ${orbbec_camera_msgs_TARGETS} + ${sensor_msgs_TARGETS} + ${std_srvs_TARGETS} + camera_info_manager::camera_info_manager + diagnostic_updater::diagnostic_updater + Eigen3::Eigen + image_transport::image_transport + rclcpp::rclcpp + rclcpp_components::component + tf2_ros::tf2_ros +) rclcpp_components_register_node( start_benchmark PLUGIN "orbbec_camera::tools::StartBenchmark" EXECUTABLE start_benchmark_node ) add_library(multi_save_rgbir SHARED tools/multi_save_rgbir.cpp src/utils.cpp) -target_include_directories(multi_save_rgbir PUBLIC ${COMMON_INCLUDE_DIRS}) -target_link_libraries(multi_save_rgbir ${COMMON_LIBRARIES}) -ament_target_dependencies(multi_save_rgbir ${dependencies}) +target_include_directories(multi_save_rgbir PUBLIC ${COMMON_INCLUDE_DIRS} ${image_publisher_INCLUDE_DIRS}) +target_link_directories(multi_save_rgbir PRIVATE ${ORBBEC_LIBS_DIR}) +target_link_libraries(multi_save_rgbir + ${OpenCV_LIBS} + ${orbbec_camera_msgs_TARGETS} + ${sensor_msgs_TARGETS} + ${std_srvs_TARGETS} + camera_info_manager::camera_info_manager + cv_bridge::cv_bridge + diagnostic_updater::diagnostic_updater + Eigen3::Eigen + image_transport::image_transport + OpenSSL::Crypto + OrbbecSDK + rclcpp::rclcpp + rclcpp_components::component + tf2::tf2 + tf2_ros::tf2_ros +) rclcpp_components_register_node( multi_save_rgbir PLUGIN "orbbec_camera::tools::MultiCameraSubscriber" EXECUTABLE multi_save_rgbir_node From b34de79e0d71dac36f6ad6e82fe98938e2f1a034 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Mon, 29 Jun 2026 09:54:43 +0200 Subject: [PATCH 13/21] add 'message_filters' to list of dependencies --- orbbec_camera/CMakeLists.txt | 1 + orbbec_camera/package.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/orbbec_camera/CMakeLists.txt b/orbbec_camera/CMakeLists.txt index 15fc98b6..3386c741 100644 --- a/orbbec_camera/CMakeLists.txt +++ b/orbbec_camera/CMakeLists.txt @@ -28,6 +28,7 @@ set(dependencies camera_info_manager image_transport image_publisher + message_filters OpenCV orbbec_camera_msgs rclcpp diff --git a/orbbec_camera/package.xml b/orbbec_camera/package.xml index b0899b76..8cf3d733 100644 --- a/orbbec_camera/package.xml +++ b/orbbec_camera/package.xml @@ -14,6 +14,7 @@ backward_ros image_transport image_publisher + message_filters rclcpp_components cv_bridge camera_info_manager From 55ded4ec2e81705d7ae10969286baf859ea81097 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Tue, 7 Jul 2026 08:34:22 +0200 Subject: [PATCH 14/21] remove references to 'foxy' from documentation --- .github/ISSUE_TEMPLATE/issue_template.md | 4 ++-- README.MD | 5 +---- README_CN.MD | 5 +---- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/issue_template.md b/.github/ISSUE_TEMPLATE/issue_template.md index 028465ee..c67fc88f 100644 --- a/.github/ISSUE_TEMPLATE/issue_template.md +++ b/.github/ISSUE_TEMPLATE/issue_template.md @@ -12,8 +12,8 @@ assignees: '' - CPU model (e.g., `13th Gen Intel® Core™ i7-13700 × 24`, `NVIDIA Jetson Orin`) - Memory size (e.g., `16GB`, `32GB`) - GPU model if available (e.g., `NVIDIA RTX 3060`, `Integrated GPU`) -- **Ubuntu Version**: Please provide the ubuntu version you are using (e.g., `ubuntu20.04`, `ubuntu22.04`, etc.) -- **ROS Version**: Please provide the version of ROS you are using (e.g., `ROS Noetic`, `ROS 2 Foxy`, etc.) +- **Ubuntu Version**: Please provide the ubuntu version you are using (e.g., `ubuntu22.04`, `ubuntu24.04`, etc.) +- **ROS Version**: Please provide the version of ROS you are using (e.g., `ROS 2 Humble`, etc.) - **Camera Model**: Please provide the model of camera you are using (e.g., `Femto Bolt`, `Gemini 335`, etc.) - **Firmware Version**: Please provide the firmware version you are using. - **Branch**: Please provide the branch you are using (e.g., `main`, `v2-main`) diff --git a/README.MD b/README.MD index 986b68e2..246d1109 100644 --- a/README.MD +++ b/README.MD @@ -12,9 +12,6 @@ - - ROS Foxy - ROS Humble @@ -41,7 +38,7 @@ ## Introduction The **OrbbecSDK ROS2 Wrapper** provides seamless integration of Orbbec cameras with the ROS 2 ecosystem. - It supports ROS2 **Foxy**, **Humble**, and **Jazzy** distributions. + It supports ROS2 **Humble**, **Jazzy**, and **Lyrical** distributions. - Default branch: **v2-main** - For legacy **OpenNI** devices: use the **main** branch diff --git a/README_CN.MD b/README_CN.MD index 3bfd3190..c2d661d9 100644 --- a/README_CN.MD +++ b/README_CN.MD @@ -12,9 +12,6 @@ - - ROS Foxy - ROS Humble @@ -40,7 +37,7 @@ ## 简介 -OrbbecSDK ROS2 Wrapper 提供 Orbbec 相机与 ROS 2 环境的无缝集成,支持 **ROS2 Foxy、Humble 和 Jazzy** 发行版。 +OrbbecSDK ROS2 Wrapper 提供 Orbbec 相机与 ROS 2 环境的无缝集成,支持 **ROS2 Humble 和 Jazzy** 发行版。 - 默认推荐使用 **v2-main** 分支。 - 对于旧的 **OpenNI** 设备(v2-main 不支持),请使用 **main** 分支。 From b7f967a24b456b68854301ddaffc3ce07d2b7a75 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Fri, 24 Jul 2026 10:19:39 +0200 Subject: [PATCH 15/21] move 'magic_enum.hpp' to source files where required --- orbbec_camera/include/orbbec_camera/ob_camera_node.h | 1 - orbbec_camera/include/orbbec_camera/ob_lidar_node.h | 1 - orbbec_camera/include/orbbec_camera/utils.h | 1 - orbbec_camera/src/ob_camera_node.cpp | 1 + orbbec_camera/src/ob_lidar_node.cpp | 1 + orbbec_camera/src/rk_mpp_decoder.cpp | 1 - 6 files changed, 2 insertions(+), 4 deletions(-) diff --git a/orbbec_camera/include/orbbec_camera/ob_camera_node.h b/orbbec_camera/include/orbbec_camera/ob_camera_node.h index a665be23..5562c6f6 100644 --- a/orbbec_camera/include/orbbec_camera/ob_camera_node.h +++ b/orbbec_camera/include/orbbec_camera/ob_camera_node.h @@ -72,7 +72,6 @@ #include "orbbec_camera/constants.h" #include "orbbec_camera/dynamic_params.h" #include "orbbec_camera/d2c_viewer.h" -#include "magic_enum/magic_enum.hpp" #include "orbbec_camera/image_publisher.h" #include "orbbec_camera/fps_counter.hpp" #include "orbbec_camera/fps_delay_status.hpp" diff --git a/orbbec_camera/include/orbbec_camera/ob_lidar_node.h b/orbbec_camera/include/orbbec_camera/ob_lidar_node.h index 80115989..9f870638 100644 --- a/orbbec_camera/include/orbbec_camera/ob_lidar_node.h +++ b/orbbec_camera/include/orbbec_camera/ob_lidar_node.h @@ -61,7 +61,6 @@ #include "orbbec_camera/constants.h" #include "orbbec_camera/dynamic_params.h" #include "orbbec_camera/d2c_viewer.h" -#include "magic_enum/magic_enum.hpp" #include "orbbec_camera/image_publisher.h" #include #include diff --git a/orbbec_camera/include/orbbec_camera/utils.h b/orbbec_camera/include/orbbec_camera/utils.h index b1b6da8d..84f94f41 100644 --- a/orbbec_camera/include/orbbec_camera/utils.h +++ b/orbbec_camera/include/orbbec_camera/utils.h @@ -24,7 +24,6 @@ #include "sensor_msgs/distortion_models.hpp" #include "sensor_msgs/msg/camera_info.hpp" #include "orbbec_camera_msgs/msg/extrinsics.hpp" -#include "magic_enum/magic_enum.hpp" #include #include #include diff --git a/orbbec_camera/src/ob_camera_node.cpp b/orbbec_camera/src/ob_camera_node.cpp index d54bfec8..4fc5726f 100644 --- a/orbbec_camera/src/ob_camera_node.cpp +++ b/orbbec_camera/src/ob_camera_node.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include "orbbec_camera/utils.h" #include diff --git a/orbbec_camera/src/ob_lidar_node.cpp b/orbbec_camera/src/ob_lidar_node.cpp index 1fbb8257..0f3d2baa 100644 --- a/orbbec_camera/src/ob_lidar_node.cpp +++ b/orbbec_camera/src/ob_lidar_node.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include "orbbec_camera/utils.h" #include diff --git a/orbbec_camera/src/rk_mpp_decoder.cpp b/orbbec_camera/src/rk_mpp_decoder.cpp index 353e149d..42bd2e86 100644 --- a/orbbec_camera/src/rk_mpp_decoder.cpp +++ b/orbbec_camera/src/rk_mpp_decoder.cpp @@ -16,7 +16,6 @@ #include "orbbec_camera/rk_mpp_decoder.h" #include -#include namespace orbbec_camera { From b7a1392bac9d9f5d02e8998cd663f91c1b5d4744 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Tue, 7 Jul 2026 11:35:58 +0200 Subject: [PATCH 16/21] only install the 'orbbec_camera' headers --- orbbec_camera/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orbbec_camera/CMakeLists.txt b/orbbec_camera/CMakeLists.txt index 3386c741..de2119b6 100644 --- a/orbbec_camera/CMakeLists.txt +++ b/orbbec_camera/CMakeLists.txt @@ -292,7 +292,7 @@ install(TARGETS ${PROJECT_NAME} frame_latency start_benchmark multi_save_rgbir A LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) -install(DIRECTORY include/ DESTINATION include) +install(DIRECTORY include/orbbec_camera DESTINATION include/orbbec_camera) install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}/) install(DIRECTORY config DESTINATION share/${PROJECT_NAME}/) install(DIRECTORY examples DESTINATION share/${PROJECT_NAME}/) From 5c8051fb94163af5edf7571149a3cec312dec488 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Fri, 24 Jul 2026 10:40:26 +0200 Subject: [PATCH 17/21] remove unused 'this' capture --- orbbec_camera/src/ob_camera_node.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) mode change 100644 => 100755 orbbec_camera/src/ob_camera_node.cpp diff --git a/orbbec_camera/src/ob_camera_node.cpp b/orbbec_camera/src/ob_camera_node.cpp old mode 100644 new mode 100755 index 4fc5726f..0f9ca2a4 --- a/orbbec_camera/src/ob_camera_node.cpp +++ b/orbbec_camera/src/ob_camera_node.cpp @@ -452,8 +452,7 @@ void OBCameraNode::publishDepthFiltersStatus() { depth_filters_snapshot = depth_filter_list_; } - auto find_depth_filter = [&depth_filters_snapshot, - this](const std::string &filter_name) -> std::shared_ptr { + auto find_depth_filter = [&depth_filters_snapshot](const std::string &filter_name) -> std::shared_ptr { const auto normalized_name = normalizeDepthFilterName(filter_name); auto it = std::find_if(depth_filters_snapshot.begin(), depth_filters_snapshot.end(), [&normalized_name](const auto &filter) { From 10a40ce3145195944219f9c4624158000ebc1826 Mon Sep 17 00:00:00 2001 From: slz Date: Tue, 28 Jul 2026 21:06:41 +0800 Subject: [PATCH 18/21] feat: support multiple ROS 2 distributions --- .github/rosdep/orbbec-camera-msgs.yaml | 5 + .github/workflows/colcon.yml | 50 +++- .github/workflows/debian-packages.yml | 222 ++++++++++++++++++ README.MD | 13 +- README_CN.MD | 12 +- orbbec_camera/.make_deb.sh | 7 +- orbbec_camera/CMakeLists.txt | 125 +++++++--- .../camera_example_node.cpp | 6 +- .../image_sync_example_node.cpp | 15 +- .../include/orbbec_camera/d2c_viewer.h | 14 +- .../include/orbbec_camera/ob_camera_node.h | 25 +- .../include/orbbec_camera/ob_lidar_node.h | 25 +- orbbec_camera/include/orbbec_camera/utils.h | 8 +- orbbec_camera/package.xml | 19 +- orbbec_camera/src/d2c_viewer.cpp | 4 +- orbbec_camera/src/image_publisher.cpp | 12 +- orbbec_camera/src/ob_camera_node.cpp | 33 ++- orbbec_camera/src/ob_camera_node_driver.cpp | 37 ++- orbbec_camera/src/ob_lidar_node.cpp | 4 +- orbbec_camera/tools/multi_save_rgbir.cpp | 5 +- orbbec_camera/tools/ob_benchmark.cpp | 3 - orbbec_camera/tools/start_benchmark.cpp | 3 - orbbec_camera_msgs/CMakeLists.txt | 2 +- orbbec_description/CMakeLists.txt | 2 +- orbbec_description/package.xml | 7 + 25 files changed, 554 insertions(+), 104 deletions(-) create mode 100644 .github/rosdep/orbbec-camera-msgs.yaml create mode 100644 .github/workflows/debian-packages.yml diff --git a/.github/rosdep/orbbec-camera-msgs.yaml b/.github/rosdep/orbbec-camera-msgs.yaml new file mode 100644 index 00000000..97aa85ab --- /dev/null +++ b/.github/rosdep/orbbec-camera-msgs.yaml @@ -0,0 +1,5 @@ +orbbec_camera_msgs: + ubuntu: + jammy: [ros-humble-orbbec-camera-msgs] + noble: [ros-jazzy-orbbec-camera-msgs] + resolute: [ros-lyrical-orbbec-camera-msgs] diff --git a/.github/workflows/colcon.yml b/.github/workflows/colcon.yml index c8afe194..1beb8a77 100644 --- a/.github/workflows/colcon.yml +++ b/.github/workflows/colcon.yml @@ -1,20 +1,30 @@ -name: colcon +name: CI -on: [push, pull_request] +on: + push: + pull_request: + workflow_dispatch: + +permissions: read-all jobs: - # build on Ubuntu docker images build: - name: "${{ matrix.image }} (${{ matrix.ros }})" + name: "ROS2 ${{ matrix.ros }} (${{ matrix.os }})" - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.ros == 'rolling' }} + env: + ROS_DISTRO: ${{ matrix.ros }} strategy: + fail-fast: false matrix: include: - - {image: "ubuntu:22.04", ros: humble} - - {image: "ubuntu:24.04", ros: jazzy} - - {image: "ubuntu:26.04", ros: lyrical} + - {image: "ros:foxy-ros-core-focal", os: ubuntu-22.04, ros: foxy} + - {image: "ros:humble-ros-core-jammy", os: ubuntu-22.04, ros: humble} + - {image: "ros:jazzy-ros-core-noble", os: ubuntu-24.04, ros: jazzy} + - {image: "ros:lyrical-ros-core-resolute", os: ubuntu-26.04, ros: lyrical} + - {image: "ros:rolling-ros-core-resolute", os: ubuntu-26.04, ros: rolling} container: image: ${{ matrix.image }} @@ -22,8 +32,24 @@ jobs: steps: - uses: actions/checkout@v6 - - uses: ros-tooling/setup-ros@v0.7 + - name: Install build tools + shell: bash + run: | + set -euo pipefail + apt-get update + apt-get install --no-install-recommends --yes \ + build-essential \ + cmake \ + git \ + python3-colcon-common-extensions \ + python3-rosdep + rosdep init || true + rosdep update --rosdistro "${ROS_DISTRO}" --include-eol-distros - - uses: ros-tooling/action-ros-ci@v0.4 - with: - target-ros2-distro: ${{ matrix.ros }} + - name: Install dependencies and build + shell: bash + run: | + set -eo pipefail + source "/opt/ros/${ROS_DISTRO}/setup.bash" + rosdep install --from-paths . --ignore-src --rosdistro "${ROS_DISTRO}" -y + colcon build --symlink-install --event-handlers console_direct+ diff --git a/.github/workflows/debian-packages.yml b/.github/workflows/debian-packages.yml new file mode 100644 index 00000000..8acaa6e3 --- /dev/null +++ b/.github/workflows/debian-packages.yml @@ -0,0 +1,222 @@ +name: Build Debian packages + +on: + workflow_dispatch: + inputs: + ros_distro: + description: ROS 2 distribution to package + required: true + default: all + type: choice + options: + - all + - humble + - jazzy + - lyrical + architecture: + description: CPU architecture to package + required: true + default: all + type: choice + options: + - all + - amd64 + - arm64 + +permissions: + contents: read + +jobs: + prepare: + name: Prepare build matrix + runs-on: ubuntu-24.04 + outputs: + matrix: ${{ steps.matrix.outputs.matrix }} + + steps: + - name: Generate selected build matrix + id: matrix + shell: bash + env: + SELECTED_ROS_DISTRO: ${{ inputs.ros_distro }} + SELECTED_ARCHITECTURE: ${{ inputs.architecture }} + run: | + set -euo pipefail + + architectures=(amd64 arm64) + if [[ "${SELECTED_ARCHITECTURE}" != "all" ]]; then + architectures=("${SELECTED_ARCHITECTURE}") + fi + + entries=() + while IFS='|' read -r ros_distro ubuntu_codename ubuntu_version; do + if [[ "${SELECTED_ROS_DISTRO}" != "all" && + "${SELECTED_ROS_DISTRO}" != "${ros_distro}" ]]; then + continue + fi + + for architecture in "${architectures[@]}"; do + runner="ubuntu-${ubuntu_version}" + if [[ "${architecture}" == "arm64" ]]; then + runner="${runner}-arm" + fi + + printf -v entry \ + '{"ros":"%s","arch":"%s","runner":"%s","image":"ros:%s-ros-core-%s"}' \ + "${ros_distro}" \ + "${architecture}" \ + "${runner}" \ + "${ros_distro}" \ + "${ubuntu_codename}" + entries+=("${entry}") + done + done <<'EOF' + humble|jammy|22.04 + jazzy|noble|24.04 + lyrical|resolute|26.04 + EOF + + matrix=$(IFS=,; printf '{"include":[%s]}' "${entries[*]}") + echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}" + + build: + name: ROS 2 ${{ matrix.ros }} (${{ matrix.arch }}) + needs: prepare + runs-on: ${{ matrix.runner }} + container: + image: ${{ matrix.image }} + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }} + env: + DEBIAN_FRONTEND: noninteractive + ROS_DISTRO: ${{ matrix.ros }} + + steps: + - uses: actions/checkout@v6 + + - name: Install packaging tools and dependencies + shell: bash + run: | + set -euo pipefail + apt-get update + apt-get install --no-install-recommends --yes \ + build-essential \ + cmake \ + debhelper \ + fakeroot \ + git \ + python3-bloom \ + python3-rosdep + + rosdep init || true + + local_rosdep_dir="${RUNNER_TEMP}/orbbec-rosdep" + mkdir -p "${local_rosdep_dir}" + printf 'yaml file://%s/.github/rosdep/orbbec-camera-msgs.yaml\n' \ + "${GITHUB_WORKSPACE}" \ + > "${local_rosdep_dir}/10-orbbec-camera-msgs.list" + export ROSDEP_SOURCE_PATH="${local_rosdep_dir}:/etc/ros/rosdep/sources.list.d" + echo "ROSDEP_SOURCE_PATH=${ROSDEP_SOURCE_PATH}" >> "${GITHUB_ENV}" + + rosdep update --rosdistro "${ROS_DISTRO}" + + set +u + source "/opt/ros/${ROS_DISTRO}/setup.bash" + set -u + rosdep install \ + --from-paths orbbec_camera_msgs orbbec_camera \ + --ignore-src \ + --rosdistro "${ROS_DISTRO}" \ + -y + + - name: Build and install message package + shell: bash + run: | + set -euo pipefail + set +u + source "/opt/ros/${ROS_DISTRO}/setup.bash" + set -u + + ( + cd orbbec_camera_msgs + bash .make_deb.sh + ) + + mapfile -t message_packages < <( + find . -maxdepth 1 -type f \ + -name "ros-${ROS_DISTRO}-orbbec-camera-msgs_*.deb" \ + -print + ) + if [[ "${#message_packages[@]}" -ne 1 ]]; then + echo "Expected one orbbec_camera_msgs Debian package, found ${#message_packages[@]}" >&2 + exit 1 + fi + + apt-get install --yes "${message_packages[0]}" + + - name: Build camera package + shell: bash + run: | + set -euo pipefail + set +u + source "/opt/ros/${ROS_DISTRO}/setup.bash" + set -u + + ( + cd orbbec_camera + bash .make_deb.sh + ) + + - name: Validate and install generated packages + shell: bash + env: + EXPECTED_ARCHITECTURE: ${{ matrix.arch }} + run: | + set -euo pipefail + + mapfile -t camera_packages < <( + find . -maxdepth 1 -type f \ + -name "ros-${ROS_DISTRO}-orbbec-camera_*.deb" \ + -print + ) + if [[ "${#camera_packages[@]}" -ne 1 ]]; then + echo "Expected one orbbec_camera Debian package, found ${#camera_packages[@]}" >&2 + exit 1 + fi + + actual_architecture=$(dpkg --print-architecture) + if [[ "${actual_architecture}" != "${EXPECTED_ARCHITECTURE}" ]]; then + echo "Runner architecture ${actual_architecture} does not match ${EXPECTED_ARCHITECTURE}" >&2 + exit 1 + fi + + for package in ./*.deb ./*.ddeb; do + [[ -e "${package}" ]] || continue + package_architecture=$(dpkg-deb --field "${package}" Architecture) + if [[ "${package_architecture}" != "${EXPECTED_ARCHITECTURE}" && + "${package_architecture}" != "all" ]]; then + echo "Package ${package} has unexpected architecture ${package_architecture}" >&2 + exit 1 + fi + done + + apt-get install --yes "${camera_packages[0]}" + + - name: Collect packages + shell: bash + run: | + set -euo pipefail + mkdir -p artifacts + find . -maxdepth 1 -type f \ + \( -name '*.deb' -o -name '*.ddeb' \) \ + -exec cp --target-directory artifacts {} + + + - name: Upload Debian packages + uses: actions/upload-artifact@v7 + with: + name: orbbec-ros2-debs-${{ matrix.ros }}-${{ matrix.arch }} + path: artifacts/ + if-no-files-found: error + retention-days: 14 + compression-level: 0 diff --git a/README.MD b/README.MD index 246d1109..2e9c865e 100644 --- a/README.MD +++ b/README.MD @@ -12,15 +12,25 @@ + + ROS Foxy + ROS Humble ROS Jazzy + + ROS Lyrical + + + ROS Rolling (experimental) + Ubuntu 20.04 Ubuntu 22.04 Ubuntu 24.04 + Ubuntu 26.04
@@ -37,8 +47,7 @@ ## Introduction -The **OrbbecSDK ROS2 Wrapper** provides seamless integration of Orbbec cameras with the ROS 2 ecosystem. - It supports ROS2 **Humble**, **Jazzy**, and **Lyrical** distributions. +The **OrbbecSDK ROS2 Wrapper** provides seamless integration of Orbbec cameras with the ROS 2 ecosystem and supports the **ROS2 Foxy**, **Humble**, **Jazzy**, and **Lyrical** distributions, with experimental support for **Rolling**. - Default branch: **v2-main** - For legacy **OpenNI** devices: use the **main** branch diff --git a/README_CN.MD b/README_CN.MD index c2d661d9..04827a1f 100644 --- a/README_CN.MD +++ b/README_CN.MD @@ -12,15 +12,25 @@ + + ROS Foxy + ROS Humble ROS Jazzy + + ROS Lyrical + + + ROS Rolling (experimental) + Ubuntu 20.04 Ubuntu 22.04 Ubuntu 24.04 + Ubuntu 26.04
@@ -37,7 +47,7 @@ ## 简介 -OrbbecSDK ROS2 Wrapper 提供 Orbbec 相机与 ROS 2 环境的无缝集成,支持 **ROS2 Humble 和 Jazzy** 发行版。 +OrbbecSDK ROS2 Wrapper 提供 Orbbec 相机与 ROS 2 环境的无缝集成,支持 **ROS2 Foxy、Humble、Jazzy 和 Lyrical** 发行版,并提供对 **Rolling** 的实验性支持。 - 默认推荐使用 **v2-main** 分支。 - 对于旧的 **OpenNI** 设备(v2-main 不支持),请使用 **main** 分支。 diff --git a/orbbec_camera/.make_deb.sh b/orbbec_camera/.make_deb.sh index 1261a2b7..d84db41a 100644 --- a/orbbec_camera/.make_deb.sh +++ b/orbbec_camera/.make_deb.sh @@ -11,11 +11,14 @@ sed -i '/^override_dh_shlibdeps:/,/^$/d' debian/rules cat >> debian/rules << 'EOF' +ORBBEC_PACKAGE := ros-$(ROS_DISTRO)-orbbec-camera +ORBBEC_LIB_DIR := $(CURDIR)/debian/$(ORBBEC_PACKAGE)/opt/ros/$(ROS_DISTRO)/lib + override_dh_shlibdeps: - dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info + dh_shlibdeps -Xlibengine_infer_encry.so -l$(ORBBEC_LIB_DIR) -- --ignore-missing-info EOF PARALLEL=$(nproc) if [ "$PARALLEL" -gt 3 ]; then PARALLEL=3; fi export DEB_BUILD_OPTIONS="parallel=$PARALLEL" -fakeroot debian/rules binary \ No newline at end of file +fakeroot debian/rules binary diff --git a/orbbec_camera/CMakeLists.txt b/orbbec_camera/CMakeLists.txt index de2119b6..555112fe 100644 --- a/orbbec_camera/CMakeLists.txt +++ b/orbbec_camera/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.22) +cmake_minimum_required(VERSION 3.10) project(orbbec_camera) set(CMAKE_CXX_STANDARD 17) @@ -26,13 +26,16 @@ set(dependencies cv_bridge backward_ros camera_info_manager + geometry_msgs image_transport image_publisher message_filters OpenCV orbbec_camera_msgs + rcl_interfaces rclcpp rclcpp_components + rmw sensor_msgs std_msgs std_srvs @@ -55,18 +58,49 @@ endforeach() find_package(PkgConfig REQUIRED) find_package(OpenSSL REQUIRED) -if(message_filters_VERSION VERSION_GREATER_EQUAL 5.0) - add_compile_definitions(message_filters_QoS) +set(ORBBEC_MESSAGE_FILTERS_USES_RCLCPP_QOS OFF) +if(DEFINED message_filters_VERSION AND message_filters_VERSION VERSION_GREATER_EQUAL 5.0) + set(ORBBEC_MESSAGE_FILTERS_USES_RCLCPP_QOS ON) endif() -if(image_transport_VERSION VERSION_GREATER_EQUAL 6.4) - add_compile_definitions(image_transport_NODE_INTERFACE) +set(ORBBEC_IMAGE_TRANSPORT_USES_REQUIRED_INTERFACES OFF) +if(DEFINED image_transport_VERSION AND image_transport_VERSION VERSION_GREATER_EQUAL 6.4) + set(ORBBEC_IMAGE_TRANSPORT_USES_REQUIRED_INTERFACES ON) endif() -if(image_transport_VERSION VERSION_GREATER_EQUAL 6.4) - add_compile_definitions(image_transport_QoS) +set(ORBBEC_CAMERA_INFO_MANAGER_USES_NODE_INTERFACES OFF) +if(DEFINED camera_info_manager_VERSION AND + camera_info_manager_VERSION VERSION_GREATER_EQUAL 4.1.0) + set(ORBBEC_CAMERA_INFO_MANAGER_USES_NODE_INTERFACES ON) endif() +set(ORBBEC_CAMERA_INFO_MANAGER_USES_RCLCPP_QOS OFF) +if(DEFINED camera_info_manager_VERSION AND + camera_info_manager_VERSION VERSION_GREATER_EQUAL 7.0.0) + set(ORBBEC_CAMERA_INFO_MANAGER_USES_RCLCPP_QOS ON) +endif() + +function(orbbec_target_dependencies target) + if(COMMAND ament_target_dependencies) + ament_target_dependencies(${target} ${ARGN}) + return() + endif() + + set(dependency_targets) + foreach(dependency IN LISTS ARGN) + if(dependency STREQUAL "rclcpp_components") + list(APPEND dependency_targets rclcpp_components::component) + elseif(dependency STREQUAL "sensor_msgs") + list(APPEND dependency_targets sensor_msgs::sensor_msgs_library) + elseif(TARGET "${dependency}::${dependency}") + list(APPEND dependency_targets "${dependency}::${dependency}") + else() + message(FATAL_ERROR "No CMake target exported by ${dependency}") + endif() + endforeach() + target_link_libraries(${target} ${dependency_targets}) +endfunction() + if(USE_RK_HW_DECODER) pkg_search_module(RK_MPP REQUIRED rockchip_mpp) if(NOT RK_MPP_FOUND) @@ -112,7 +146,7 @@ endif() set(COMMON_INCLUDE_DIRS $ $ - $ ${ORBBEC_INCLUDE_DIR} ${OpenCV_INCLUDED_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/tools + $ ${ORBBEC_INCLUDE_DIR} ${OpenCV_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/tools ) set(EXTRA_TARGETS @@ -182,29 +216,51 @@ endmacro() # Define library and nodes add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES}) +if(ORBBEC_MESSAGE_FILTERS_USES_RCLCPP_QOS) + target_compile_definitions(${PROJECT_NAME} PRIVATE ORBBEC_MESSAGE_FILTERS_USES_RCLCPP_QOS) +endif() +if(ORBBEC_IMAGE_TRANSPORT_USES_REQUIRED_INTERFACES) + target_compile_definitions(${PROJECT_NAME} PRIVATE ORBBEC_IMAGE_TRANSPORT_USES_REQUIRED_INTERFACES) +endif() +if(ORBBEC_CAMERA_INFO_MANAGER_USES_NODE_INTERFACES) + target_compile_definitions(${PROJECT_NAME} + PRIVATE ORBBEC_CAMERA_INFO_MANAGER_USES_NODE_INTERFACES) +endif() +if(ORBBEC_CAMERA_INFO_MANAGER_USES_RCLCPP_QOS) + target_compile_definitions(${PROJECT_NAME} + PRIVATE ORBBEC_CAMERA_INFO_MANAGER_USES_RCLCPP_QOS) +endif() target_include_directories(${PROJECT_NAME} PUBLIC ${COMMON_INCLUDE_DIRS} ${image_publisher_INCLUDE_DIRS}) target_link_directories(${PROJECT_NAME} PRIVATE ${ORBBEC_LIBS_DIR}) target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} ${orbbec_camera_msgs_TARGETS} - ${sensor_msgs_TARGETS} ${std_srvs_TARGETS} ament_index_cpp::ament_index_cpp - camera_info_manager::camera_info_manager - cv_bridge::cv_bridge - diagnostic_updater::diagnostic_updater Eigen3::Eigen - image_transport::image_transport - message_filters::message_filters OpenSSL::Crypto OrbbecSDK + Threads::Threads + ${BACKWARD_LIBRARIES} rclcpp::rclcpp - rclcpp_components::component + rt tf2::tf2 tf2_ros::tf2_ros ${EXTRA_TARGETS} ) +orbbec_target_dependencies(${PROJECT_NAME} + camera_info_manager + cv_bridge + diagnostic_updater + geometry_msgs + image_transport + message_filters + rcl_interfaces + rclcpp_components + rmw + sensor_msgs +) rclcpp_components_register_node( ${PROJECT_NAME} PLUGIN "orbbec_camera::OBCameraNodeDriver" EXECUTABLE orbbec_camera_node @@ -221,6 +277,10 @@ add_orbbec_executable(ob_benchmark_node tools/ob_benchmark.cpp) add_orbbec_executable(435le_example_node examples/Gemini_435Le_example_node/camera_example_node.cpp) add_orbbec_executable(service_benchmark_node scripts/service_benchmark_node.cpp) add_orbbec_executable(image_sync_example_node examples/multi_camera_time_sync/image_sync_example_node.cpp) +orbbec_target_dependencies(topic_statistics_node statistics_msgs) +if(ORBBEC_MESSAGE_FILTERS_USES_RCLCPP_QOS) + target_compile_definitions(image_sync_example_node PRIVATE ORBBEC_MESSAGE_FILTERS_USES_RCLCPP_QOS) +endif() install( PROGRAMS @@ -233,11 +293,14 @@ add_library(frame_latency SHARED tools/frame_latency.cpp) target_include_directories(frame_latency PUBLIC ${COMMON_INCLUDE_DIRS}) target_link_libraries(frame_latency ${orbbec_camera_msgs_TARGETS} - ${sensor_msgs_TARGETS} ${tf2_msgs_TARGETS} - diagnostic_updater::diagnostic_updater rclcpp::rclcpp - rclcpp_components::component +) +orbbec_target_dependencies(frame_latency + diagnostic_updater + geometry_msgs + rclcpp_components + sensor_msgs ) rclcpp_components_register_node(frame_latency PLUGIN "orbbec_camera::FrameLatencyNode" EXECUTABLE frame_latency_node) @@ -247,16 +310,18 @@ target_include_directories(start_benchmark PUBLIC ${COMMON_INCLUDE_DIRS} ${image target_link_libraries(start_benchmark ${OpenCV_LIBS} ${orbbec_camera_msgs_TARGETS} - ${sensor_msgs_TARGETS} ${std_srvs_TARGETS} - camera_info_manager::camera_info_manager - diagnostic_updater::diagnostic_updater Eigen3::Eigen - image_transport::image_transport rclcpp::rclcpp - rclcpp_components::component tf2_ros::tf2_ros ) +orbbec_target_dependencies(start_benchmark + camera_info_manager + diagnostic_updater + image_transport + rclcpp_components + sensor_msgs +) rclcpp_components_register_node( start_benchmark PLUGIN "orbbec_camera::tools::StartBenchmark" EXECUTABLE start_benchmark_node @@ -268,20 +333,22 @@ target_link_directories(multi_save_rgbir PRIVATE ${ORBBEC_LIBS_DIR}) target_link_libraries(multi_save_rgbir ${OpenCV_LIBS} ${orbbec_camera_msgs_TARGETS} - ${sensor_msgs_TARGETS} ${std_srvs_TARGETS} - camera_info_manager::camera_info_manager - cv_bridge::cv_bridge - diagnostic_updater::diagnostic_updater Eigen3::Eigen - image_transport::image_transport OpenSSL::Crypto OrbbecSDK rclcpp::rclcpp - rclcpp_components::component tf2::tf2 tf2_ros::tf2_ros ) +orbbec_target_dependencies(multi_save_rgbir + camera_info_manager + cv_bridge + diagnostic_updater + image_transport + rclcpp_components + sensor_msgs +) rclcpp_components_register_node( multi_save_rgbir PLUGIN "orbbec_camera::tools::MultiCameraSubscriber" EXECUTABLE multi_save_rgbir_node diff --git a/orbbec_camera/examples/Gemini_435Le_example_node/camera_example_node.cpp b/orbbec_camera/examples/Gemini_435Le_example_node/camera_example_node.cpp index 0a99ad6d..0986ae40 100644 --- a/orbbec_camera/examples/Gemini_435Le_example_node/camera_example_node.cpp +++ b/orbbec_camera/examples/Gemini_435Le_example_node/camera_example_node.cpp @@ -139,9 +139,9 @@ class CameraExampleNode : public rclcpp::Node { "/camera/device_status", 10, std::bind(&CameraExampleNode::deviceStatusCallback, this, std::placeholders::_1)); - while (rclcpp::ok()) { - rclcpp::spin_some(shared_from_this()); - } + rclcpp::executors::SingleThreadedExecutor executor; + executor.add_node(shared_from_this()); + executor.spin(); } // Feature 7: Set Color AE ROI diff --git a/orbbec_camera/examples/multi_camera_time_sync/image_sync_example_node.cpp b/orbbec_camera/examples/multi_camera_time_sync/image_sync_example_node.cpp index aa8e838c..48791ba7 100755 --- a/orbbec_camera/examples/multi_camera_time_sync/image_sync_example_node.cpp +++ b/orbbec_camera/examples/multi_camera_time_sync/image_sync_example_node.cpp @@ -1,8 +1,17 @@ +#include +#include + +#if __has_include() #include #include #include -#include -#include +#elif __has_include() +#include +#include +#include +#else +#error "No compatible message_filters headers found" +#endif #if __has_include() #include @@ -79,7 +88,7 @@ class ImageSyncNode : public rclcpp::Node { rclcpp::QoS qos{rclcpp::KeepLast(queue_size_)}; qos.reliable(); -#ifdef message_filters_QoS +#ifdef ORBBEC_MESSAGE_FILTERS_USES_RCLCPP_QOS const rclcpp::QoS qos_prof = qos; #else const rmw_qos_profile_t qos_prof = qos.get_rmw_qos_profile(); diff --git a/orbbec_camera/include/orbbec_camera/d2c_viewer.h b/orbbec_camera/include/orbbec_camera/d2c_viewer.h index 1bb366a2..1c9f31d6 100644 --- a/orbbec_camera/include/orbbec_camera/d2c_viewer.h +++ b/orbbec_camera/include/orbbec_camera/d2c_viewer.h @@ -14,12 +14,20 @@ * limitations under the License. *******************************************************************************/ #pragma once +#include +#include + +#if __has_include() #include #include #include -#include -#include -#include +#elif __has_include() +#include +#include +#include +#else +#error "No compatible message_filters headers found" +#endif #include "utils.h" diff --git a/orbbec_camera/include/orbbec_camera/ob_camera_node.h b/orbbec_camera/include/orbbec_camera/ob_camera_node.h index 5562c6f6..f21ad31c 100644 --- a/orbbec_camera/include/orbbec_camera/ob_camera_node.h +++ b/orbbec_camera/include/orbbec_camera/ob_camera_node.h @@ -31,11 +31,6 @@ #include #include #include -#include -#include -#include -#include -#include #include #include #include @@ -81,6 +76,26 @@ #include #include +#if __has_include() +#include +#include +#elif __has_include() +#include +#include +#else +#error "No compatible tf2 LinearMath headers found" +#endif + +#if __has_include() +#include +#include +#elif __has_include() +#include +#include +#else +#error "No compatible tf2_ros broadcaster headers found" +#endif + #if __has_include() #include #elif __has_include() diff --git a/orbbec_camera/include/orbbec_camera/ob_lidar_node.h b/orbbec_camera/include/orbbec_camera/ob_lidar_node.h index 9f870638..a843ae79 100644 --- a/orbbec_camera/include/orbbec_camera/ob_lidar_node.h +++ b/orbbec_camera/include/orbbec_camera/ob_lidar_node.h @@ -31,11 +31,6 @@ #include #include #include -#include -#include -#include -#include -#include #include #include #include @@ -66,6 +61,26 @@ #include #include +#if __has_include() +#include +#include +#elif __has_include() +#include +#include +#else +#error "No compatible tf2 LinearMath headers found" +#endif + +#if __has_include() +#include +#include +#elif __has_include() +#include +#include +#else +#error "No compatible tf2_ros broadcaster headers found" +#endif + #if __has_include() #include #elif __has_include() diff --git a/orbbec_camera/include/orbbec_camera/utils.h b/orbbec_camera/include/orbbec_camera/utils.h index 84f94f41..1f6e6c89 100644 --- a/orbbec_camera/include/orbbec_camera/utils.h +++ b/orbbec_camera/include/orbbec_camera/utils.h @@ -17,13 +17,19 @@ #pragma once #include #include -#include #include #include "libobsensor/ObSensor.hpp" #include "sensor_msgs/distortion_models.hpp" #include "sensor_msgs/msg/camera_info.hpp" #include "orbbec_camera_msgs/msg/extrinsics.hpp" +#if __has_include() +#include +#elif __has_include() +#include +#else +#error "No compatible tf2 Quaternion header found" +#endif #include #include #include diff --git a/orbbec_camera/package.xml b/orbbec_camera/package.xml index 8cf3d733..790cf788 100644 --- a/orbbec_camera/package.xml +++ b/orbbec_camera/package.xml @@ -8,6 +8,8 @@ Apache-2.0 ament_cmake + pkg-config + ament_lint_auto ament_lint_common ament_index_cpp @@ -18,7 +20,7 @@ rclcpp_components cv_bridge camera_info_manager - orbbec_camera_msgs + orbbec_camera_msgs builtin_interfaces rclcpp sensor_msgs @@ -37,6 +39,21 @@ libssl-dev opengl + eigen + geometry_msgs + libopencv-dev + rcl_interfaces + rmw + yaml-cpp + + ament_index_python + launch + launch_ros + python3-psutil + python3-tabulate + python3-yaml + rclpy + ament_cmake diff --git a/orbbec_camera/src/d2c_viewer.cpp b/orbbec_camera/src/d2c_viewer.cpp index 0637f3f5..b6a4f166 100644 --- a/orbbec_camera/src/d2c_viewer.cpp +++ b/orbbec_camera/src/d2c_viewer.cpp @@ -31,7 +31,7 @@ D2CViewer::D2CViewer(rclcpp::Node* const node, rmw_qos_profile_t rgb_qos, : node_(node), logger_(rclcpp::get_logger("d2c_viewer")), is_active_(true) { rgb_sub_ = std::make_shared>( node_, "color/image_raw", -#ifdef message_filters_QoS +#ifdef ORBBEC_MESSAGE_FILTERS_USES_RCLCPP_QOS rclcpp::QoS{rclcpp::QoSInitialization::from_rmw(rgb_qos), rgb_qos} #else rgb_qos @@ -39,7 +39,7 @@ D2CViewer::D2CViewer(rclcpp::Node* const node, rmw_qos_profile_t rgb_qos, ); depth_sub_ = std::make_shared>( node_, "depth/image_raw", -#ifdef message_filters_QoS +#ifdef ORBBEC_MESSAGE_FILTERS_USES_RCLCPP_QOS rclcpp::QoS{rclcpp::QoSInitialization::from_rmw(depth_qos), depth_qos} #else depth_qos diff --git a/orbbec_camera/src/image_publisher.cpp b/orbbec_camera/src/image_publisher.cpp index 7283cb8d..0998fedb 100644 --- a/orbbec_camera/src/image_publisher.cpp +++ b/orbbec_camera/src/image_publisher.cpp @@ -35,20 +35,20 @@ size_t image_rcl_publisher::get_subscription_count() const { 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::create_publisher( -#ifdef image_transport_NODE_INTERFACE + image_publisher_impl = + std::make_shared(image_transport::create_publisher( +#ifdef ORBBEC_IMAGE_TRANSPORT_USES_REQUIRED_INTERFACES image_transport::RequiredInterfaces{node}, #else &node, #endif topic_name, -#ifdef image_transport_QoS +#ifdef ORBBEC_IMAGE_TRANSPORT_USES_REQUIRED_INTERFACES 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); @@ -57,4 +57,4 @@ void image_transport_publisher::publish(sensor_msgs::msg::Image::UniquePtr image size_t image_transport_publisher::get_subscription_count() const { return image_publisher_impl->getNumSubscribers(); } -} // namespace orbbec_camera \ No newline at end of file +} // namespace orbbec_camera diff --git a/orbbec_camera/src/ob_camera_node.cpp b/orbbec_camera/src/ob_camera_node.cpp index 0f9ca2a4..2db3c2a4 100755 --- a/orbbec_camera/src/ob_camera_node.cpp +++ b/orbbec_camera/src/ob_camera_node.cpp @@ -5311,15 +5311,32 @@ void OBCameraNode::publishConfidenceFrame(const std::shared_ptr &conf } void OBCameraNode::setupCameraInfo() { - std::string color_camera_name = camera_name_ + "_color"; + const auto create_camera_info_manager = [this](const std::string &camera_name, + const std::string &camera_info_url) { +#ifdef ORBBEC_CAMERA_INFO_MANAGER_USES_NODE_INTERFACES +#ifdef ORBBEC_CAMERA_INFO_MANAGER_USES_RCLCPP_QOS + return std::make_unique( + node_->get_node_base_interface(), node_->get_node_services_interface(), + node_->get_node_logging_interface(), camera_name, camera_info_url, + rclcpp::SystemDefaultsQoS()); +#else + return std::make_unique( + node_->get_node_base_interface(), node_->get_node_services_interface(), + node_->get_node_logging_interface(), camera_name, camera_info_url, rmw_qos_profile_default); +#endif +#else + return std::make_unique(node_, camera_name, + camera_info_url); +#endif + }; + + const std::string color_camera_name = camera_name_ + "_color"; if (!color_info_url_.empty()) { - color_info_manager_ = std::make_unique( - node_, color_camera_name, color_info_url_); + color_info_manager_ = create_camera_info_manager(color_camera_name, color_info_url_); } - std::string ir_camera_name = camera_name_ + "_ir"; + const std::string ir_camera_name = camera_name_ + "_ir"; if (!ir_info_url_.empty()) { - ir_info_manager_ = std::make_unique( - node_, ir_camera_name, ir_info_url_); + ir_info_manager_ = create_camera_info_manager(ir_camera_name, ir_info_url_); } } @@ -7287,8 +7304,8 @@ void OBCameraNode::publishStaticTransforms() { if (!publish_tf_) { return; } - static_tf_broadcaster_ = std::make_shared(node_); - dynamic_tf_broadcaster_ = std::make_shared(node_); + static_tf_broadcaster_ = std::make_shared(*node_); + dynamic_tf_broadcaster_ = std::make_shared(*node_); calcAndPublishStaticTransform(); if (tf_publish_rate_ > 0) { tf_thread_ = std::make_shared([this]() { publishDynamicTransforms(); }); diff --git a/orbbec_camera/src/ob_camera_node_driver.cpp b/orbbec_camera/src/ob_camera_node_driver.cpp index 98c6ef07..5634a3f3 100644 --- a/orbbec_camera/src/ob_camera_node_driver.cpp +++ b/orbbec_camera/src/ob_camera_node_driver.cpp @@ -19,8 +19,13 @@ #include #include #include -#include #include +#if __has_include() +#include +#define ORBBEC_AMENT_INDEX_USES_FILESYSTEM_PATHS +#else +#include +#endif #include #include #include @@ -39,6 +44,24 @@ std::string g_time_domain = "global"; // Assuming this is declared elsew namespace { constexpr auto kStreamStartDelayAfterReconnect = std::chrono::seconds(5); +std::filesystem::path getPackageSharePath(const std::string &package_name) { +#ifdef ORBBEC_AMENT_INDEX_USES_FILESYSTEM_PATHS + return ament_index_cpp::get_package_share_path(package_name); +#else + return ament_index_cpp::get_package_share_directory(package_name); +#endif +} + +std::filesystem::path getPackagePrefixPath(const std::string &package_name) { +#ifdef ORBBEC_AMENT_INDEX_USES_FILESYSTEM_PATHS + std::filesystem::path package_prefix; + ament_index_cpp::get_package_prefix(package_name, package_prefix); + return package_prefix; +#else + return ament_index_cpp::get_package_prefix(package_name); +#endif +} + std::string getLogDirectoryForCamera(const std::string &camera_name) { const char *log_dir_override = std::getenv("ORBBEC_LOG_DIR"); if (log_dir_override && log_dir_override[0] != '\0') { @@ -153,10 +176,10 @@ int rosLogSeverityFromString(const std::string_view &log_level) { OBCameraNodeDriver::OBCameraNodeDriver(const rclcpp::NodeOptions &node_options) : Node("orbbec_camera_node", "/", node_options), node_options_(node_options), - config_path_(ament_index_cpp::get_package_share_directory("orbbec_camera") + - "/config/OrbbecSDKConfig_v2.0.xml"), + config_path_( + (getPackageSharePath("orbbec_camera") / "config" / "OrbbecSDKConfig_v2.0.xml").string()), logger_(this->get_logger()), - extension_path_(ament_index_cpp::get_package_prefix("orbbec_camera") + "/lib/extensions") { + extension_path_((getPackagePrefixPath("orbbec_camera") / "lib" / "extensions").string()) { node_name_ = "orbbec_camera_node"; init(); } @@ -165,10 +188,10 @@ OBCameraNodeDriver::OBCameraNodeDriver(const std::string &node_name, const std:: const rclcpp::NodeOptions &node_options) : Node(node_name, ns, node_options), node_options_(node_options), - config_path_(ament_index_cpp::get_package_share_directory("orbbec_camera") + - "/config/OrbbecSDKConfig_v2.0.xml"), + config_path_( + (getPackageSharePath("orbbec_camera") / "config" / "OrbbecSDKConfig_v2.0.xml").string()), logger_(this->get_logger()), - extension_path_(ament_index_cpp::get_package_prefix("orbbec_camera") + "/lib/extensions") { + extension_path_((getPackagePrefixPath("orbbec_camera") / "lib" / "extensions").string()) { node_name_ = node_name; init(); } diff --git a/orbbec_camera/src/ob_lidar_node.cpp b/orbbec_camera/src/ob_lidar_node.cpp index 0f3d2baa..b21bc13e 100644 --- a/orbbec_camera/src/ob_lidar_node.cpp +++ b/orbbec_camera/src/ob_lidar_node.cpp @@ -1165,8 +1165,8 @@ void OBLidarNode::publishStaticTransforms() { if (!publish_tf_) { return; } - static_tf_broadcaster_ = std::make_shared(node_); - dynamic_tf_broadcaster_ = std::make_shared(node_); + static_tf_broadcaster_ = std::make_shared(*node_); + dynamic_tf_broadcaster_ = std::make_shared(*node_); calcAndPublishStaticTransform(); if (tf_publish_rate_ > 0) { tf_thread_ = std::make_shared([this]() { publishDynamicTransforms(); }); diff --git a/orbbec_camera/tools/multi_save_rgbir.cpp b/orbbec_camera/tools/multi_save_rgbir.cpp index 6496787a..69bbc290 100644 --- a/orbbec_camera/tools/multi_save_rgbir.cpp +++ b/orbbec_camera/tools/multi_save_rgbir.cpp @@ -5,9 +5,6 @@ #include #include "orbbec_camera/ob_camera_node.h" #include "orbbec_camera_msgs/msg/metadata.hpp" -#include -#include -#include #include #include #include @@ -410,4 +407,4 @@ class MultiCameraSubscriber : public rclcpp::Node { }; } // namespace tools } // namespace orbbec_camera -RCLCPP_COMPONENTS_REGISTER_NODE(orbbec_camera::tools::MultiCameraSubscriber) \ No newline at end of file +RCLCPP_COMPONENTS_REGISTER_NODE(orbbec_camera::tools::MultiCameraSubscriber) diff --git a/orbbec_camera/tools/ob_benchmark.cpp b/orbbec_camera/tools/ob_benchmark.cpp index 52022503..76a85081 100644 --- a/orbbec_camera/tools/ob_benchmark.cpp +++ b/orbbec_camera/tools/ob_benchmark.cpp @@ -3,9 +3,6 @@ #include #include #include "orbbec_camera_msgs/msg/metadata.hpp" -#include -#include -#include #include namespace orbbec_camera { diff --git a/orbbec_camera/tools/start_benchmark.cpp b/orbbec_camera/tools/start_benchmark.cpp index 9b474080..5987a554 100644 --- a/orbbec_camera/tools/start_benchmark.cpp +++ b/orbbec_camera/tools/start_benchmark.cpp @@ -3,9 +3,6 @@ #include #include #include "orbbec_camera_msgs/msg/metadata.hpp" -#include -#include -#include #include namespace orbbec_camera { diff --git a/orbbec_camera_msgs/CMakeLists.txt b/orbbec_camera_msgs/CMakeLists.txt index fd229bb6..b71437b9 100644 --- a/orbbec_camera_msgs/CMakeLists.txt +++ b/orbbec_camera_msgs/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.22) +cmake_minimum_required(VERSION 3.10) project(orbbec_camera_msgs) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/orbbec_description/CMakeLists.txt b/orbbec_description/CMakeLists.txt index 8310ce57..5cbf3d19 100644 --- a/orbbec_description/CMakeLists.txt +++ b/orbbec_description/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.22) +cmake_minimum_required(VERSION 3.10) project(orbbec_description) find_package(ament_cmake REQUIRED) diff --git a/orbbec_description/package.xml b/orbbec_description/package.xml index f79a7f55..10234781 100644 --- a/orbbec_description/package.xml +++ b/orbbec_description/package.xml @@ -9,6 +9,13 @@ ament_cmake + ament_index_python + launch + launch_ros + robot_state_publisher + rviz2 + xacro + ament_lint_auto ament_lint_common From 05acd7174cbc47687d11ac1e4658dd4eed80ff76 Mon Sep 17 00:00:00 2001 From: slz Date: Wed, 29 Jul 2026 16:01:00 +0800 Subject: [PATCH 19/21] fix: pass robot description as a parameter --- orbbec_description/launch/launch_utils.py | 15 +++------------ orbbec_description/launch/view_model.launch.py | 5 +++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/orbbec_description/launch/launch_utils.py b/orbbec_description/launch/launch_utils.py index 10e43fb0..fd365587 100644 --- a/orbbec_description/launch/launch_utils.py +++ b/orbbec_description/launch/launch_utils.py @@ -12,22 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os import xacro -import tempfile + def to_urdf(xacro_path, parameters=None): - """Convert the given xacro file to URDF file. + """Convert the given xacro file to a URDF string. * xacro_path -- the path to the xacro file * parameters -- to be used when xacro file is parsed. """ - with tempfile.NamedTemporaryFile(prefix="%s_" % os.path.basename(xacro_path), delete=False) as xacro_file: - urdf_path = xacro_file.name - - # open and process file doc = xacro.process_file(xacro_path, mappings=parameters) - # open the output file - with open(urdf_path, 'w') as urdf_file: - urdf_file.write(doc.toprettyxml(indent=' ')) - - return urdf_path + return doc.toprettyxml(indent=' ') diff --git a/orbbec_description/launch/view_model.launch.py b/orbbec_description/launch/view_model.launch.py index 8f163cd9..f5a73fd4 100644 --- a/orbbec_description/launch/view_model.launch.py +++ b/orbbec_description/launch/view_model.launch.py @@ -35,7 +35,8 @@ def generate_launch_description(): rviz_config_dir = os.path.join(get_package_share_directory('orbbec_description'), 'rviz', 'urdf.rviz') xacro_path = os.path.join(get_package_share_directory('orbbec_description'), 'urdf', params['model']) - urdf = to_urdf(xacro_path, {'use_nominal_extrinsics': 'true', 'add_plug': 'true'}) + robot_description = to_urdf( + xacro_path, {'use_nominal_extrinsics': 'true', 'add_plug': 'true'}) rviz_node = Node( package='rviz2', executable='rviz2', @@ -50,6 +51,6 @@ def generate_launch_description(): executable='robot_state_publisher', namespace='', output='screen', - arguments=[urdf] + parameters=[{'robot_description': robot_description}] ) return launch.LaunchDescription([rviz_node, model_node]) From 130f6a6704ad1bcf944490193a557759095afe80 Mon Sep 17 00:00:00 2001 From: slz Date: Wed, 29 Jul 2026 16:51:57 +0800 Subject: [PATCH 20/21] fix: correct public header install path --- orbbec_camera/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orbbec_camera/CMakeLists.txt b/orbbec_camera/CMakeLists.txt index 555112fe..334401c2 100644 --- a/orbbec_camera/CMakeLists.txt +++ b/orbbec_camera/CMakeLists.txt @@ -359,7 +359,7 @@ install(TARGETS ${PROJECT_NAME} frame_latency start_benchmark multi_save_rgbir A LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) -install(DIRECTORY include/orbbec_camera DESTINATION include/orbbec_camera) +install(DIRECTORY include/orbbec_camera DESTINATION include) install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}/) install(DIRECTORY config DESTINATION share/${PROJECT_NAME}/) install(DIRECTORY examples DESTINATION share/${PROJECT_NAME}/) From 19e2ce69100112dcc143232f4f78af06d9f755ce Mon Sep 17 00:00:00 2001 From: slz Date: Wed, 29 Jul 2026 17:06:52 +0800 Subject: [PATCH 21/21] fix: require CMake 3.13 for link commands The package uses add_link_options() and target_link_directories(), which were both introduced in CMake 3.13. --- orbbec_camera/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orbbec_camera/CMakeLists.txt b/orbbec_camera/CMakeLists.txt index 334401c2..d3e514fc 100644 --- a/orbbec_camera/CMakeLists.txt +++ b/orbbec_camera/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.13) project(orbbec_camera) set(CMAKE_CXX_STANDARD 17)