Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/colcon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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}
- {image: "ubuntu:26.04", ros: lyrical}

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 }}
123 changes: 88 additions & 35 deletions orbbec_camera/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.22)
project(orbbec_camera)

set(CMAKE_CXX_STANDARD 17)
Expand All @@ -13,6 +13,8 @@ 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
Expand All @@ -26,6 +28,7 @@ set(dependencies
camera_info_manager
image_transport
image_publisher
message_filters
OpenCV
orbbec_camera_msgs
rclcpp
Expand All @@ -52,6 +55,14 @@ 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(image_transport_VERSION VERSION_GREATER_EQUAL 6.4)
add_compile_definitions(image_transport_NODE_INTERFACE)
endif()

if(USE_RK_HW_DECODER)
pkg_search_module(RK_MPP REQUIRED rockchip_mpp)
if(NOT RK_MPP_FOUND)
Expand Down Expand Up @@ -100,26 +111,8 @@ set(COMMON_INCLUDE_DIRS
$<INSTALL_INTERFACE:include> ${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
Expand All @@ -140,15 +133,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
Expand All @@ -171,16 +165,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
Comment thread
christian-rauch marked this conversation as resolved.
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
Expand All @@ -207,24 +227,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
Expand Down
28 changes: 17 additions & 11 deletions orbbec_camera/examples/multi_camera_time_sync/image_sync_example_node.cpp
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <rclcpp/rclcpp.hpp>
#include <sensor_msgs/msg/image.hpp>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include <message_filters/subscriber.hpp>
#include <message_filters/synchronizer.hpp>
#include <message_filters/sync_policies/approximate_time.hpp>

#if __has_include(<cv_bridge/cv_bridge.hpp>)
#include <cv_bridge/cv_bridge.hpp>
Expand Down Expand Up @@ -56,14 +56,20 @@ class ImageSyncNode : public rclcpp::Node {
rclcpp::QoS qos(rclcpp::KeepLast(10));
qos.reliable();

camera_01_color_sub_.subscribe(this, "/camera_01/color/image_raw", qos.get_rmw_qos_profile());
camera_01_depth_sub_.subscribe(this, "/camera_01/depth/image_raw", qos.get_rmw_qos_profile());
camera_02_color_sub_.subscribe(this, "/camera_02/color/image_raw", qos.get_rmw_qos_profile());
camera_02_depth_sub_.subscribe(this, "/camera_02/depth/image_raw", qos.get_rmw_qos_profile());
camera_03_color_sub_.subscribe(this, "/camera_03/color/image_raw", qos.get_rmw_qos_profile());
camera_03_depth_sub_.subscribe(this, "/camera_03/depth/image_raw", qos.get_rmw_qos_profile());
camera_04_color_sub_.subscribe(this, "/camera_04/color/image_raw", qos.get_rmw_qos_profile());
camera_04_depth_sub_.subscribe(this, "/camera_04/depth/image_raw", qos.get_rmw_qos_profile());
#ifdef message_filters_QoS
const rclcpp::QoS qos_prof = qos;
#else
const rmw_qos_profile_t qos_prof = qos.get_rmw_qos_profile();
#endif

camera_01_color_sub_.subscribe(this, "/camera_01/color/image_raw", qos_prof);
camera_01_depth_sub_.subscribe(this, "/camera_01/depth/image_raw", qos_prof);
camera_02_color_sub_.subscribe(this, "/camera_02/color/image_raw", qos_prof);
camera_02_depth_sub_.subscribe(this, "/camera_02/depth/image_raw", qos_prof);
camera_03_color_sub_.subscribe(this, "/camera_03/color/image_raw", qos_prof);
camera_03_depth_sub_.subscribe(this, "/camera_03/depth/image_raw", qos_prof);
camera_04_color_sub_.subscribe(this, "/camera_04/color/image_raw", qos_prof);
camera_04_depth_sub_.subscribe(this, "/camera_04/depth/image_raw", qos_prof);

sync_ =
std::make_shared<Sync>(SyncPolicy(10), camera_01_color_sub_, camera_01_depth_sub_,
Expand Down
8 changes: 4 additions & 4 deletions orbbec_camera/include/orbbec_camera/d2c_viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*******************************************************************************/
#pragma once
#include <message_filters/subscriber.h>
#include <message_filters/sync_policies/approximate_time.h>
#include <message_filters/synchronizer.h>
#include <message_filters/time_synchronizer.h>
#include <message_filters/subscriber.hpp>
#include <message_filters/sync_policies/approximate_time.hpp>
#include <message_filters/synchronizer.hpp>
#include <message_filters/time_synchronizer.hpp>
#include <sensor_msgs/msg/image.hpp>
#include <rclcpp/rclcpp.hpp>

Expand Down
11 changes: 5 additions & 6 deletions orbbec_camera/include/orbbec_camera/ob_camera_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
#include <opencv2/opencv.hpp>
#include <sensor_msgs/msg/point_cloud2.hpp>
#include <sensor_msgs/point_cloud2_iterator.hpp>
#include <tf2_ros/static_transform_broadcaster.h>
#include <tf2_ros/transform_broadcaster.h>
#include <tf2/LinearMath/Quaternion.h>
#include <tf2/LinearMath/Vector3.h>
#include <tf2/LinearMath/Transform.h>
#include <tf2_ros/static_transform_broadcaster.hpp>
#include <tf2_ros/transform_broadcaster.hpp>
#include <tf2/LinearMath/Quaternion.hpp>
#include <tf2/LinearMath/Vector3.hpp>
#include <tf2/LinearMath/Transform.hpp>
#include <std_srvs/srv/set_bool.hpp>
#include <std_srvs/srv/empty.hpp>
#include <diagnostic_updater/diagnostic_updater.hpp>
Expand All @@ -47,7 +47,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_info.hpp"
Expand Down
12 changes: 5 additions & 7 deletions orbbec_camera/include/orbbec_camera/ob_lidar_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
#include <sensor_msgs/msg/laser_scan.hpp>
#include <sensor_msgs/msg/point_cloud2.hpp>
#include <sensor_msgs/point_cloud2_iterator.hpp>
#include <tf2_ros/static_transform_broadcaster.h>
#include <tf2_ros/transform_broadcaster.h>
#include <tf2/LinearMath/Quaternion.h>
#include <tf2/LinearMath/Vector3.h>
#include <tf2/LinearMath/Transform.h>
#include <tf2_ros/static_transform_broadcaster.hpp>
#include <tf2_ros/transform_broadcaster.hpp>
#include <tf2/LinearMath/Quaternion.hpp>
#include <tf2/LinearMath/Vector3.hpp>
#include <tf2/LinearMath/Transform.hpp>
#include <std_srvs/srv/set_bool.hpp>
#include <std_srvs/srv/empty.hpp>
#include <diagnostic_updater/diagnostic_updater.hpp>
Expand All @@ -48,10 +48,8 @@
#include <sensor_msgs/msg/imu.hpp>
#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"
Expand Down
2 changes: 1 addition & 1 deletion orbbec_camera/include/orbbec_camera/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#pragma once
#include <ostream>
#include <Eigen/Dense>
#include <tf2/LinearMath/Quaternion.h>
#include <tf2/LinearMath/Quaternion.hpp>
#include <rclcpp/rclcpp.hpp>

#include "libobsensor/ObSensor.hpp"
Expand Down
3 changes: 2 additions & 1 deletion orbbec_camera/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
<depend>backward_ros</depend>
<depend>image_transport</depend>
<depend>image_publisher</depend>
<depend>message_filters</depend>
<depend>rclcpp_components</depend>
<depend>cv_bridge</depend>
<depend>camera_info_manager</depend>
<depend>orbbec_camera_msgs</depend>
<depend version_gte="2.8.6">orbbec_camera_msgs</depend>
<depend>builtin_interfaces</depend>
<depend>rclcpp</depend>
<depend>sensor_msgs</depend>
Expand Down
16 changes: 14 additions & 2 deletions orbbec_camera/src/d2c_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<message_filters::Subscriber<sensor_msgs::msg::Image>>(
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<message_filters::Subscriber<sensor_msgs::msg::Image>>(
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<message_filters::Synchronizer<MySyncPolicy>>(MySyncPolicy(10), *rgb_sub_,
*depth_sub_);
sync_->setMaxIntervalDuration(rclcpp::Duration::from_seconds(1.0)); // 1s
Expand Down
Loading