Update SDK sdk to v2.0.11

This commit is contained in:
Joe Dong
2024-09-30 20:13:45 +08:00
parent 6f53ba8439
commit dfdbbb2411
11 changed files with 56 additions and 109 deletions
Binary file not shown.
@@ -12,8 +12,8 @@ set_target_properties(ob::OrbbecSDK PROPERTIES
IMPORTED_SONAME_RELEASE "libOrbbecSDK.so"
)
list(APPEND _cmake_import_check_targets ob::OrbbecSDK )
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so" )
list(APPEND _IMPORT_CHECK_TARGETS ob::OrbbecSDK )
list(APPEND _IMPORT_CHECK_FILES_FOR_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so" )
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
+36 -48
View File
@@ -1,13 +1,10 @@
# Generated by CMake
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
message(FATAL_ERROR "CMake >= 2.8.0 required")
endif()
if(CMAKE_VERSION VERSION_LESS "2.8.3")
message(FATAL_ERROR "CMake >= 2.8.3 required")
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
message(FATAL_ERROR "CMake >= 2.6.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.8.3...3.28)
cmake_policy(VERSION 2.6)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------
@@ -16,34 +13,32 @@ cmake_policy(VERSION 2.8.3...3.28)
set(CMAKE_IMPORT_FILE_VERSION 1)
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_cmake_targets_defined "")
set(_cmake_targets_not_defined "")
set(_cmake_expected_targets "")
foreach(_cmake_expected_target IN ITEMS ob::OrbbecSDK)
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
if(TARGET "${_cmake_expected_target}")
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
else()
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
foreach(_expectedTarget ob::OrbbecSDK)
list(APPEND _expectedTargets ${_expectedTarget})
if(NOT TARGET ${_expectedTarget})
list(APPEND _targetsNotDefined ${_expectedTarget})
endif()
if(TARGET ${_expectedTarget})
list(APPEND _targetsDefined ${_expectedTarget})
endif()
endforeach()
unset(_cmake_expected_target)
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
unset(_cmake_targets_defined)
unset(_cmake_targets_not_defined)
unset(_cmake_expected_targets)
unset(CMAKE_IMPORT_FILE_VERSION)
if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
return()
endif()
if(NOT _cmake_targets_defined STREQUAL "")
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
if(NOT "${_targetsDefined}" STREQUAL "")
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
endif()
unset(_cmake_targets_defined)
unset(_cmake_targets_not_defined)
unset(_cmake_expected_targets)
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
# Compute the installation prefix relative to this file.
@@ -61,25 +56,21 @@ set_target_properties(ob::OrbbecSDK PROPERTIES
)
# Load information for each installed configuration.
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/OrbbecSDKConfig-*.cmake")
foreach(_cmake_config_file IN LISTS _cmake_config_files)
include("${_cmake_config_file}")
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
file(GLOB CONFIG_FILES "${_DIR}/OrbbecSDKConfig-*.cmake")
foreach(f ${CONFIG_FILES})
include(${f})
endforeach()
unset(_cmake_config_file)
unset(_cmake_config_files)
# Cleanup temporary variables.
set(_IMPORT_PREFIX)
# Loop over all imported files and verify that they actually exist
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
if(CMAKE_VERSION VERSION_LESS "3.28"
OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
if(NOT EXISTS "${_cmake_file}")
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
\"${_cmake_file}\"
foreach(target ${_IMPORT_CHECK_TARGETS} )
foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
if(NOT EXISTS "${file}" )
message(FATAL_ERROR "The imported target \"${target}\" references the file
\"${file}\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
@@ -87,14 +78,11 @@ but this file does not exist. Possible reasons include:
\"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
endif()
endforeach()
endif()
unset(_cmake_file)
unset("_cmake_import_check_files_for_${_cmake_target}")
endif()
endforeach()
unset(_IMPORT_CHECK_FILES_FOR_${target})
endforeach()
unset(_cmake_target)
unset(_cmake_import_check_targets)
unset(_IMPORT_CHECK_TARGETS)
# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.
Binary file not shown.
+18 -59
View File
@@ -1402,74 +1402,33 @@ void OBCameraNode::publishDepthPointCloud(const std::shared_ptr<ob::FrameSet> &f
RCLCPP_ERROR_STREAM(logger_, "depth frame is null");
return;
}
auto depth_width = depth_frame->getWidth();
auto depth_height = depth_frame->getHeight();
CHECK_NOTNULL(pipeline_);
auto camera_params = pipeline_->getCameraParam();
auto device_info = device_->getDeviceInfo();
CHECK_NOTNULL(device_info.get());
auto pid = device_info->getPid();
if (!depth_xy_tables_.has_value()) {
RCLCPP_INFO(logger_, "Update depth xy tables");
try {
calibration_param_ = pipeline_->getCalibrationParam(pipeline_config_);
} catch (const ob::Error &e) {
RCLCPP_ERROR_STREAM(logger_, "Failed to get calibration param: " << e.getMessage());
throw;
}
uint32_t table_size =
depth_width * depth_height * 2; // one for x-coordinate and one for y-coordinate LUT
if (depth_xy_table_data_size_ != table_size) {
RCLCPP_INFO_STREAM(logger_, "Update depth xy tables with size " << table_size);
depth_xy_table_data_size_ = table_size;
delete[] depth_xy_table_data_;
depth_xy_table_data_ = new float[table_size];
}
depth_xy_tables_ = OBXYTables();
CHECK_NOTNULL(depth_xy_table_data_);
auto align_sensor = depth_registration_ ? OB_SENSOR_COLOR : OB_SENSOR_DEPTH;
if (pid == DABAI_MAX_PID) {
align_sensor = OB_SENSOR_COLOR;
}
if (!ob::CoordinateTransformHelper::transformationInitXYTables(
*calibration_param_, align_sensor, depth_xy_table_data_, &table_size,
&(*depth_xy_tables_))) {
RCLCPP_ERROR_STREAM(logger_, "Failed to init depth xy tables");
return;
}
auto pid = device_info->pid();
if (depth_registration_ || pid == DABAI_MAX_PID) {
camera_params.depthIntrinsic = camera_params.rgbIntrinsic;
}
const auto *depth_data = depth_frame->getData();
if (depth_data == nullptr) {
RCLCPP_ERROR_STREAM(logger_, "depth data is empty");
depth_point_cloud_filter_.setCameraParam(camera_params);
float depth_scale = depth_frame->getValueScale();
depth_point_cloud_filter_.setPositionDataScaled(depth_scale);
depth_point_cloud_filter_.setCreatePointFormat(OB_FORMAT_POINT);
auto result_frame = depth_point_cloud_filter_.process(depth_frame);
if (!result_frame) {
RCLCPP_ERROR_STREAM(logger_, "Failed to process depth frame");
return;
}
uint32_t point_cloud_buffer_size = depth_width * depth_height * sizeof(OBPoint);
if (point_cloud_buffer_size > depth_point_cloud_buffer_size_) {
RCLCPP_INFO(logger_, "Update depth point cloud buffer size to %d", point_cloud_buffer_size);
delete[] depth_point_cloud_buffer_;
depth_point_cloud_buffer_ = new uint8_t[point_cloud_buffer_size];
depth_point_cloud_buffer_size_ = point_cloud_buffer_size;
}
memset(depth_point_cloud_buffer_, 0, depth_point_cloud_buffer_size_);
auto *point_cloud = reinterpret_cast<OBPoint *>(depth_point_cloud_buffer_);
ob::CoordinateTransformHelper::transformationDepthToPointCloud(&(*depth_xy_tables_), depth_data,
point_cloud);
auto point_size = depth_point_cloud_buffer_size_ / sizeof(OBPoint);
auto *points = reinterpret_cast<OBPoint *>(depth_point_cloud_buffer_);
auto width = depth_frame->getWidth();
auto height = depth_frame->getHeight();
auto depth_scale = depth_frame->getValueScale();
auto point_size = result_frame->dataSize() / sizeof(OBPoint);
auto *points = static_cast<OBPoint *>(result_frame->data());
auto width = depth_frame->width();
auto height = depth_frame->height();
auto point_cloud_msg = std::make_unique<sensor_msgs::msg::PointCloud2>();
sensor_msgs::PointCloud2Modifier modifier(*point_cloud_msg);
modifier.setPointCloud2FieldsByString(1, "xyz");
modifier.resize(width * height);
point_cloud_msg->width = depth_frame->getWidth();
point_cloud_msg->height = depth_frame->getHeight();
point_cloud_msg->width = depth_frame->width();
point_cloud_msg->height = depth_frame->height();
point_cloud_msg->row_step = point_cloud_msg->width * point_cloud_msg->point_step;
point_cloud_msg->data.resize(point_cloud_msg->height * point_cloud_msg->row_step);
sensor_msgs::PointCloud2Iterator<float> iter_x(*point_cloud_msg, "x");
@@ -1481,7 +1440,6 @@ void OBCameraNode::publishDepthPointCloud(const std::shared_ptr<ob::FrameSet> &f
const static float max_depth = MAX_DISTANCE / depth_scale;
size_t valid_count = 0;
for (size_t i = 0; i < point_size; i++) {
// RCLCPP_INFO_STREAM(logger_, "points[i].z" << points[i].z);
bool valid_point = points[i].z >= min_depth && points[i].z <= max_depth;
if (valid_point || ordered_pc_) {
*iter_x = static_cast<float>(points[i].x / 1000.0);
@@ -1527,6 +1485,7 @@ void OBCameraNode::publishDepthPointCloud(const std::shared_ptr<ob::FrameSet> &f
}
}
depth_cloud_pub_->publish(std::move(point_cloud_msg));
}
void OBCameraNode::publishColoredPointCloud(const std::shared_ptr<ob::FrameSet> &frame_set) {