Update sdk to v2.2.8 and replace Repeat using clean IR video and speckle depth video with skip frame

This commit is contained in:
datean
2025-03-17 18:13:34 +08:00
parent 9caaa78c0a
commit 2c0fa34988
29 changed files with 242 additions and 107 deletions
@@ -77,6 +77,7 @@ OB_EXPORT ob_device *ob_create_net_device(ob_context *context, const char *addre
/**
* @brief Set a device plug-in callback function
* @attention The added and removed device lists returned through the callback interface need to be released manually
* @attention This function supports multiple callbacks. Each call to this function adds a new callback to an internal list.
*
* @param[in] context Pointer to the context object
* @param[in] callback Pointer to the callback function triggered when a device is plugged or unplugged
@@ -241,6 +241,19 @@ OB_EXPORT void ob_device_update_firmware(ob_device *device, const char *path, ob
OB_EXPORT void ob_device_update_firmware_from_data(ob_device *device, const uint8_t *data, uint32_t data_size, ob_device_fw_update_callback callback,
bool async, void *user_data, ob_error **error);
/**
* @brief Update the device optional depth presets.
*
* @param[in] device The device object.
* @param[in] file_path_list A list(2D array) of preset file paths, each up to OB_PATH_MAX characters.
* @param[in] path_count The number of the preset file paths.
* @param[in] callback The preset upgrade progress callback.
* @param[in] user_data User-defined data that will be returned in the callback.
* @param[out] error Pointer to an error object that will be set if an error occurs.
*/
OB_EXPORT void ob_device_update_optional_depth_presets(ob_device *device, const char file_path_list[][OB_PATH_MAX], uint8_t path_count,
ob_device_fw_update_callback callback, void *user_data, ob_error **error);
/**
* @brief Device reboot
* @attention The device will be disconnected and reconnected. After the device is disconnected, the interface access to the device handle may be abnormal.
@@ -629,7 +629,7 @@ OB_EXPORT void ob_frameset_push_frame(ob_frame *frameset, const ob_frame *frame,
#define ob_gyro_frame_temperature ob_gyro_frame_get_temperature
#define ob_frameset_get_frame_count ob_frameset_get_count
#define ob_frame_time_stamp(frame, err) (ob_frame_get_timestamp_us(frame, err))
#define ob_frame_time_stamp(frame, err) (ob_frame_get_timestamp_us(frame, err) / 1000)
#define ob_frame_system_time_stamp(frame, err) (ob_frame_get_system_timestamp_us(frame, err))
#define ob_frame_set_system_time_stamp(frame, system_timestamp, err) (ob_frame_set_system_timestamp_us(frame, system_timestamp * 1000, err))
#define ob_frame_set_device_time_stamp(frame, device_timestamp, err) (ob_frame_set_timestamp_us(frame, device_timestamp * 1000, err))
@@ -637,4 +637,3 @@ OB_EXPORT void ob_frameset_push_frame(ob_frame *frameset, const ob_frame *frame,
#ifdef __cplusplus
}
#endif
@@ -49,6 +49,11 @@ typedef struct ob_device_frame_interleave_list_t ob_device_frame_interleave_list
#define OB_GYRO_FULL_SCALE_RANGE_ANY OB_GYRO_FS_UNKNOWN
#define OB_GYRO_SAMPLE_RATE_ANY OB_SAMPLE_RATE_UNKNOWN
/**
* @brief maximum path length
*/
#define OB_PATH_MAX (1024)
/**
* @brief the permission type of api or property
*/
@@ -238,20 +243,24 @@ typedef enum {
* @brief Enumeration value describing the firmware upgrade status
*/
typedef enum {
STAT_VERIFY_SUCCESS = 5, /**< Image file verifify success */
STAT_FILE_TRANSFER = 4, /**< file transfer */
STAT_DONE = 3, /**< update completed */
STAT_IN_PROGRESS = 2, /**< upgrade in process */
STAT_START = 1, /**< start the upgrade */
STAT_VERIFY_IMAGE = 0, /**< Image file verification */
ERR_VERIFY = -1, /**< Verification failed */
ERR_PROGRAM = -2, /**< Program execution failed */
ERR_ERASE = -3, /**< Flash parameter failed */
ERR_FLASH_TYPE = -4, /**< Flash type error */
ERR_IMAGE_SIZE = -5, /**< Image file size error */
ERR_OTHER = -6, /**< other errors */
ERR_DDR = -7, /**< DDR access error */
ERR_TIMEOUT = -8 /**< timeout error */
STAT_DONE_WITH_DUPLICATES = 6, /**< update completed, but some files were duplicated and ignored */
STAT_VERIFY_SUCCESS = 5, /**< Image file verifify success */
STAT_FILE_TRANSFER = 4, /**< file transfer */
STAT_DONE = 3, /**< update completed */
STAT_IN_PROGRESS = 2, /**< upgrade in process */
STAT_START = 1, /**< start the upgrade */
STAT_VERIFY_IMAGE = 0, /**< Image file verification */
ERR_VERIFY = -1, /**< Verification failed */
ERR_PROGRAM = -2, /**< Program execution failed */
ERR_ERASE = -3, /**< Flash parameter failed */
ERR_FLASH_TYPE = -4, /**< Flash type error */
ERR_IMAGE_SIZE = -5, /**< Image file size error */
ERR_OTHER = -6, /**< other errors */
ERR_DDR = -7, /**< DDR access error */
ERR_TIMEOUT = -8, /**< timeout error */
ERR_MISMATCH = -9, /**< Mismatch firmware error */
ERR_UNSUPPORT_DEV = -10, /**< Unsupported device error */
ERR_INVALID_COUNT = -11, /**< invalid firmware/preset count */
} OBUpgradeState,
OBFwUpdateState, ob_upgrade_state, ob_fw_update_state;
@@ -855,6 +864,11 @@ typedef enum {
*/
OB_SYNC_MODE_SECONDARY_SOFT_TRIGGER = 0x07,
/**
* @brief IR and IMU sync signal
*/
OB_SYNC_MODE_IR_IMU_SYNC = 0x08,
/**
* @brief Unknown type
*/
@@ -920,6 +934,16 @@ typedef struct {
uint16_t deviceId;
} OBDeviceSyncConfig, ob_device_sync_config, OB_DEVICE_SYNC_CONFIG;
/**
* @brief Preset tag
*/
typedef enum {
OB_DEVICE_DEPTH_WORK_MODE = 0,
OB_CUSTOM_DEPTH_WORK_MODE = 1,
} OBDepthWorkModeTag,
ob_depth_work_mode_tag;
/**
* @brief Depth work mode
*/
@@ -933,6 +957,11 @@ typedef struct {
* @brief Name of work mode
*/
char name[32];
/**
* @brief Preset tag
*/
OBDepthWorkModeTag tag;
} OBDepthWorkMode, ob_depth_work_mode;
/**
@@ -1128,6 +1157,12 @@ typedef enum {
* @attention In this mode, the user may return null when getting the specified type of data frame from the acquired FrameSet
*/
OB_FRAME_AGGREGATE_OUTPUT_ANY_SITUATION,
/**
* @brief Disable Frame Aggreate
*
* @attention In this mode, All types of data frames will output independently.
*/
OB_FRAME_AGGREGATE_OUTPUT_DISABLE,
} OB_FRAME_AGGREGATE_OUTPUT_MODE,
OBFrameAggregateOutputMode, ob_frame_aggregate_output_mode;
#define OB_FRAME_AGGREGATE_OUTPUT_FULL_FRAME_REQUIRE OB_FRAME_AGGREGATE_OUTPUT_ALL_TYPE_FRAME_REQUIRE
@@ -1240,6 +1275,11 @@ typedef enum {
*/
OB_MULTI_DEVICE_SYNC_MODE_HARDWARE_TRIGGERING = 1 << 6,
/**
* @brief IR and IMU sync mode
*/
OB_MULTI_DEVICE_SYNC_MODE_IR_IMU_SYNC = 1 << 7,
} ob_multi_device_sync_mode,
OBMultiDeviceSyncMode;
@@ -1405,6 +1445,16 @@ typedef struct {
char numberStr[16];
} OBDeviceSerialNumber, ob_device_serial_number, OBSerialNumber, ob_serial_number;
/**
* @brief Disparity offset interleaving configuration
*/
typedef struct {
uint8_t enable;
uint8_t offset0;
uint8_t offset1;
uint8_t reserved;
} OBDispOffsetConfig, ob_disp_offset_config;
/**
* @brief Frame metadata types
* @brief The frame metadata is a set of meta info generated by the device for current individual frame.
@@ -1588,6 +1638,16 @@ typedef enum {
*/
OB_FRAME_METADATA_TYPE_GPIO_INPUT_DATA = 31,
/**
* @brief disparity search offset value
*/
OB_FRAME_METADATA_TYPE_DISPARITY_SEARCH_OFFSET = 32,
/**
* @brief disparity search range
*/
OB_FRAME_METADATA_TYPE_DISPARITY_SEARCH_RANGE = 33,
/**
* @brief The number of frame metadata types, using for types iterating
* @attention It is not a valid frame metadata type
@@ -1,4 +1,4 @@
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Copyright (c) Orbbec Inc. All Rights Reserved.
// Licensed under the MIT License.
/**
@@ -440,6 +440,29 @@ typedef enum {
*/
OB_PROP_DISP_SEARCH_RANGE_MODE_INT = 191,
/**
* @brief Laser high temperature protection
*/
OB_PROP_LASER_HIGH_TEMPERATURE_PROTECT_BOOL = 193,
/**
* @brief low exposure laser control
*
* @brief Currently using for DabaiA device,if the exposure value is lower than a certain threshold, the laser is turned off;
* if it exceeds another threshold, the laser is turned on again.
*/
OB_PROP_LOW_EXPOSURE_LASER_CONTROL_BOOL = 194,
/**
* @brief check pps sync in signal
*/
OB_PROP_CHECK_PPS_SYNC_IN_SIGNAL_BOOL = 195,
/**
* @brief Disparity search range offset, range: [0, 127]
*/
OB_PROP_DISP_SEARCH_OFFSET_INT = 196,
/**
* @brief Repower device (cut off power and power on again)
*
@@ -460,7 +483,24 @@ typedef enum {
* @brief laser pattern sync with delay(us)
*/
OB_PROP_FRAME_INTERLEAVE_LASER_PATTERN_SYNC_DELAY_INT = 206,
/**
* @brief Get the health check result from device,range is [0.0f,1.5f]
*/
OB_PROP_ON_CHIP_CALIBRATION_HEALTH_CHECK_FLOAT = 209,
/**
* @brief Enable or disable on-chip calibration
*/
OB_PROP_ON_CHIP_CALIBRATION_ENABLE_BOOL = 210,
/**
* @brief hardware noise remove filter switch
*/
OB_PROP_HW_NOISE_REMOVE_FILTER_ENABLE_BOOL = 211,
/**
* @brief hardware noise remove filter threshold ,range [0.0 - 1.0]
*/
OB_PROP_HW_NOISE_REMOVE_FILTER_THRESHOLD_FLOAT = 212,
/**
* @brief Baseline calibration parameters
*/
@@ -545,6 +585,11 @@ typedef enum {
*/
OB_STRUCT_ASIC_SERIAL_NUMBER = 1063,
/**
* @brief Disparity offset interleaving
*/
OB_STRUCT_DISP_OFFSET_CONFIG = 1064,
/**
* @brief Color camera auto exposure
*/
@@ -704,6 +749,10 @@ typedef enum {
* @brief Color camera FOCUS
*/
OB_PROP_COLOR_FOCUS_INT = 2038,
/**
* @brief ir rectify status,true: ir rectify, false: no rectify
*/
OB_PROP_IR_RECTIFY_BOOL = 2040,
/**
* @brief Depth camera priority
@@ -113,6 +113,7 @@ public:
/**
* @brief Set the device plug-in callback function.
* @attention This function supports multiple callbacks. Each call to this function adds a new callback to an internal list.
*
* @param callback The function triggered when the device is plugged and unplugged.
*/
@@ -383,6 +383,20 @@ public:
Error::handle(&error);
}
/**
* @brief Update the device optional depth presets
*
* @param filePathList A list(2D array) of preset file paths, each up to OB_PATH_MAX characters.
* @param pathCount The number of the preset file paths.
* @param callback Preset update progress and status callback
*/
void updateOptionalDepthPresets(const char filePathList[][OB_PATH_MAX], uint8_t pathCount, DeviceFwUpdateCallback callback) {
ob_error *error = nullptr;
fwUpdateCallback_ = callback;
ob_device_update_optional_depth_presets(impl_, filePathList, pathCount, &Device::firmwareUpdateCallback, this, &error);
Error::handle(&error);
}
/**
* @brief Set the device state changed callbacks
*
@@ -957,7 +957,9 @@ private:
static void BufferDestroy(uint8_t *buffer, void *context) {
auto *ctx = static_cast<BufferDestroyContext *>(context);
ctx->callback(buffer);
if (ctx->callback) {
ctx->callback(buffer);
}
delete ctx;
}
};
@@ -8,12 +8,12 @@ set(CMAKE_IMPORT_FILE_VERSION 1)
# Import target "ob::OrbbecSDK" for configuration "Release"
set_property(TARGET ob::OrbbecSDK APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(ob::OrbbecSDK PROPERTIES
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.1.1"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.2.8"
IMPORTED_SONAME_RELEASE "libOrbbecSDK.so.2"
)
list(APPEND _cmake_import_check_targets ob::OrbbecSDK )
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.1.1" )
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.2.8" )
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
@@ -1 +1 @@
libOrbbecSDK.so.2.1.1
libOrbbecSDK.so.2.2.8
@@ -8,12 +8,12 @@ set(CMAKE_IMPORT_FILE_VERSION 1)
# Import target "ob::OrbbecSDK" for configuration "Release"
set_property(TARGET ob::OrbbecSDK APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(ob::OrbbecSDK PROPERTIES
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.1.1"
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.2.8"
IMPORTED_SONAME_RELEASE "libOrbbecSDK.so.2"
)
list(APPEND _cmake_import_check_targets ob::OrbbecSDK )
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.1.1" )
list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.2.8" )
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
+1 -1
View File
@@ -1 +1 @@
libOrbbecSDK.so.2.1.1
libOrbbecSDK.so.2.2.8
+6 -1
View File
@@ -1,6 +1,6 @@
# common params
depth_registration: false
enable_point_cloud: false
enable_point_cloud: true
enable_colored_point_cloud: false
device_preset: "High Accuracy"
time_domain: "global" # global, device, system
@@ -22,6 +22,7 @@ enable_color_auto_exposure: true
color_exposure: 50 # 5ms
color_gain: -1 # -1 default
color_qos: "sensor_data"
color_camera_info_qos: "sensor_data"
# depth params
enable_depth: true
@@ -30,6 +31,7 @@ depth_height: 360
depth_fps: 60
depth_format: "Y16"
depth_qos: "sensor_data"
depth_camera_info_qos: "sensor_data"
# ir exposure
enable_ir_auto_exposure: true
@@ -43,6 +45,7 @@ left_ir_height: 360
left_ir_fps: 60
left_ir_format: "Y8"
left_ir_qos: "sensor_data"
left_ir_camera_info_qos: "sensor_data"
#right ir params
enable_right_ir: true
@@ -51,3 +54,5 @@ right_ir_height: 360
right_ir_fps: 60
right_ir_format: "Y8"
right_ir_qos: "sensor_data"
right_ir_camera_info_qos: "sensor_data"
@@ -1,13 +1,17 @@
{
"save_rgbir_params": {
"time_domain": "device",
"time_domain": "global",
"usb_ports": [
"2-3",
"2-1"
"2-1",
"2-3.1",
"2-3.3",
"2-2"
],
"camera_name": [
"G330_0",
"G330_1"
"front_camera",
"left_camera",
"right_camera",
"rear_camera"
]
}
}
@@ -662,8 +662,7 @@ class OBCameraNode {
VideoStreamInfo depth_stream_info_ = {OB_FRAME_DEPTH, 0};
VideoStreamInfo left_ir_stream_info_ = {OB_FRAME_IR_LEFT, 0};
VideoStreamInfo right_ir_stream_info_ = {OB_FRAME_IR_RIGHT, 0};
std::shared_ptr<char[]> buffer_left_ir_ = nullptr;
std::shared_ptr<char[]> buffer_right_ir_ = nullptr;
std::shared_ptr<char[]> buffer_depth_ = nullptr;
uint64_t left_last_time=0;
uint64_t right_last_time=0;
};
} // namespace orbbec_camera
@@ -201,8 +201,8 @@ def generate_launch_description():
DeclareLaunchArgument('laser_index1_ir_brightness', default_value='60'),
DeclareLaunchArgument('laser_index1_ir_ae_max_exposure', default_value='17000'),
DeclareLaunchArgument('laser_index0_laser_control', default_value='1'),
DeclareLaunchArgument('laser_index0_depth_exposure', default_value='3000'),
DeclareLaunchArgument('laser_index0_depth_gain', default_value='16'),
DeclareLaunchArgument('laser_index0_depth_exposure', default_value='6000'),
DeclareLaunchArgument('laser_index0_depth_gain', default_value='20'),
DeclareLaunchArgument('laser_index0_ir_brightness', default_value='60'),
DeclareLaunchArgument('laser_index0_ir_ae_max_exposure', default_value='30000'),
@@ -112,15 +112,15 @@ def generate_launch_description():
actions=[left_camera],
)
delayed_right_camera = TimerAction(
period=2.0,
period=4.0,
actions=[right_camera],
)
delayed_rear_camera = TimerAction(
period=4.0,
period=6.0,
actions=[rear_camera],
)
delayed_front_camera = TimerAction(
period=6.0,
period=8.0,
actions=[front_camera],
)
ld = LaunchDescription(
+52 -65
View File
@@ -542,14 +542,14 @@ void OBCameraNode::setupDepthPostProcessFilter() {
} else if (filter_name == "NoiseRemovalFilter" && enable_noise_removal_filter_) {
auto noise_removal_filter = filter->as<ob::NoiseRemovalFilter>();
OBNoiseRemovalFilterParams params = noise_removal_filter->getFilterParams();
RCLCPP_INFO_STREAM(logger_, "Default noise removal filter params: "
<< "disp_diff: " << params.disp_diff
<< ", max_size: " << params.max_size);
RCLCPP_INFO_STREAM(
logger_, "Default noise removal filter params: " << "disp_diff: " << params.disp_diff
<< ", max_size: " << params.max_size);
params.disp_diff = noise_removal_filter_min_diff_;
params.max_size = noise_removal_filter_max_size_;
RCLCPP_INFO_STREAM(logger_, "Set noise removal filter params: "
<< "disp_diff: " << params.disp_diff
<< ", max_size: " << params.max_size);
RCLCPP_INFO_STREAM(logger_,
"Set noise removal filter params: " << "disp_diff: " << params.disp_diff
<< ", max_size: " << params.max_size);
if (noise_removal_filter_min_diff_ != -1 && noise_removal_filter_max_size_ != -1) {
noise_removal_filter->setFilterParams(params);
}
@@ -558,11 +558,11 @@ void OBCameraNode::setupDepthPostProcessFilter() {
hdr_merge_gain_2_ != -1) {
auto hdr_merge_filter = filter->as<ob::HdrMerge>();
hdr_merge_filter->enable(true);
RCLCPP_INFO_STREAM(logger_, "Set HDR merge filter params: "
<< "exposure_1: " << hdr_merge_exposure_1_
<< ", gain_1: " << hdr_merge_gain_1_
<< ", exposure_2: " << hdr_merge_exposure_2_
<< ", gain_2: " << hdr_merge_gain_2_);
RCLCPP_INFO_STREAM(
logger_, "Set HDR merge filter params: " << "exposure_1: " << hdr_merge_exposure_1_
<< ", gain_1: " << hdr_merge_gain_1_
<< ", exposure_2: " << hdr_merge_exposure_2_
<< ", gain_2: " << hdr_merge_gain_2_);
auto config = OBHdrConfig();
config.enable = true;
config.exposure_1 = hdr_merge_exposure_1_;
@@ -1615,9 +1615,9 @@ void OBCameraNode::publishDepthPointCloud(const std::shared_ptr<ob::FrameSet> &f
return;
}
if (depth_frame->getMetadataValue(OB_FRAME_METADATA_TYPE_HDR_SEQUENCE_INDEX) !=
if (depth_frame->getMetadataValue(OB_FRAME_METADATA_TYPE_LASER_POWER_MODE) ==
interleave_skip_index_) {
RCLCPP_DEBUG(logger_, "interleave filter skip frame type: %d", depth_frame->getType());
// RCLCPP_DEBUG(logger_, "interleave filter skip frame type: %d", depth_frame->getType());
return;
}
@@ -2164,25 +2164,52 @@ void OBCameraNode::onNewFrameCallback(const std::shared_ptr<ob::Frame> &frame,
}
std::shared_ptr<ob::VideoFrame> video_frame;
if (frame->getType() == OB_FRAME_COLOR) {
if (interleave_frame_enable_ && interleave_skip_enable_) {
interleave_skip_color_index_++;
if (interleave_skip_color_index_ % 2 == 0) {
return;
}
updateStreamInfo(frame, color_stream_info_);
}
video_frame = frame->as<ob::ColorFrame>();
} else if (frame->getType() == OB_FRAME_DEPTH) {
video_frame = frame->as<ob::DepthFrame>();
if (buffer_depth_ == nullptr) {
buffer_depth_ =
std::shared_ptr<char[]>(new char[video_frame->getWidth() * video_frame->getHeight() * 2]);
if (interleave_frame_enable_ && interleave_skip_enable_) {
if (video_frame->getMetadataValue(OB_FRAME_METADATA_TYPE_LASER_POWER_MODE) ==
interleave_skip_index_) {
return;
}
}
} else if (frame->getType() == OB_FRAME_IR || frame->getType() == OB_FRAME_IR_LEFT ||
frame->getType() == OB_FRAME_IR_RIGHT) {
video_frame = frame->as<ob::IRFrame>();
if (buffer_left_ir_ == nullptr) {
buffer_left_ir_ =
std::shared_ptr<char[]>(new char[video_frame->getWidth() * video_frame->getHeight()]);
}
if (buffer_right_ir_ == nullptr) {
buffer_right_ir_ =
std::shared_ptr<char[]>(new char[video_frame->getWidth() * video_frame->getHeight()]);
}
if (interleave_frame_enable_ && interleave_skip_enable_) {
if (video_frame->getMetadataValue(OB_FRAME_METADATA_TYPE_LASER_POWER_MODE) !=
interleave_skip_index_) {
if (frame->getType() == OB_FRAME_IR_LEFT) {
if ((getFrameTimestampUs(frame) - left_last_time) > 37000) {
RCLCPP_INFO_STREAM(logger_,
"left this FrameTimestampUs: " << (getFrameTimestampUs(frame)));
RCLCPP_INFO_STREAM(logger_, "left last FrameTimestampUs: " << (left_last_time));
RCLCPP_INFO_STREAM(logger_, "left-between current and previous fram "
<< (getFrameTimestampUs(frame) - left_last_time));
}
left_last_time = getFrameTimestampUs(frame);
}
if (frame->getType() == OB_FRAME_IR_RIGHT) {
if ((getFrameTimestampUs(frame) - right_last_time) > 37000) {
RCLCPP_INFO_STREAM(logger_,
"right this FrameTimestampUs: " << (getFrameTimestampUs(frame)));
RCLCPP_INFO_STREAM(logger_, "right last FrameTimestampUs: " << (right_last_time));
RCLCPP_INFO_STREAM(logger_, "right-between current and previous fram "
<< (getFrameTimestampUs(frame) - right_last_time));
}
right_last_time = getFrameTimestampUs(frame);
}
return;
}
}
} else {
RCLCPP_ERROR(logger_, "Unsupported frame type: %d", frame->getType());
return;
@@ -2265,28 +2292,8 @@ void OBCameraNode::onNewFrameCallback(const std::shared_ptr<ob::Frame> &frame,
frame->format() != OB_FORMAT_Y16 && frame->format() != OB_FORMAT_BGRA &&
frame->format() != OB_FORMAT_RGBA && image_publishers_[COLOR]->get_subscription_count() > 0) {
memcpy(image.data, rgb_buffer_, video_frame->getWidth() * video_frame->getHeight() * 3);
} else if (frame->getType() == OB_FRAME_DEPTH) {
if (video_frame->getMetadataValue(OB_FRAME_METADATA_TYPE_HDR_SEQUENCE_INDEX) !=
interleave_skip_index_) {
memcpy(image.data, buffer_depth_.get(), video_frame->getDataSize());
} else {
memcpy(image.data, video_frame->getData(), video_frame->getDataSize());
}
} else {
if (interleave_frame_enable_ && interleave_skip_enable_) {
if (video_frame->getMetadataValue(OB_FRAME_METADATA_TYPE_HDR_SEQUENCE_INDEX) ==
interleave_skip_index_) {
if (frame->getType() == OB_FRAME_IR_LEFT) {
memcpy(image.data, buffer_left_ir_.get(), video_frame->getDataSize());
} else if (frame->getType() == OB_FRAME_IR_RIGHT) {
memcpy(image.data, buffer_right_ir_.get(), video_frame->getDataSize());
}
} else {
memcpy(image.data, video_frame->getData(), video_frame->getDataSize());
}
} else {
memcpy(image.data, video_frame->getData(), video_frame->getDataSize());
}
memcpy(image.data, video_frame->getData(), video_frame->getDataSize());
}
if (stream_index == DEPTH) {
auto depth_scale = video_frame->as<ob::DepthFrame>()->getValueScale();
@@ -2304,26 +2311,6 @@ void OBCameraNode::onNewFrameCallback(const std::shared_ptr<ob::Frame> &frame,
CHECK(image_publishers_.count(stream_index) > 0);
saveImageToFile(stream_index, image, *image_msg);
image_publishers_[stream_index]->publish(std::move(image_msg));
if (frame->getType() == OB_FRAME_DEPTH) {
if (video_frame->getMetadataValue(OB_FRAME_METADATA_TYPE_HDR_SEQUENCE_INDEX) ==
interleave_skip_index_) {
memcpy(buffer_depth_.get(), video_frame->getData(), video_frame->getDataSize());
}
} else if (frame->getType() == OB_FRAME_IR || frame->getType() == OB_FRAME_IR_LEFT ||
frame->getType() == OB_FRAME_IR_RIGHT) {
if (interleave_frame_enable_ && interleave_skip_enable_) {
if (video_frame->getMetadataValue(OB_FRAME_METADATA_TYPE_HDR_SEQUENCE_INDEX) !=
interleave_skip_index_) {
if (frame->getType() == OB_FRAME_IR_LEFT) {
memcpy(buffer_left_ir_.get(), video_frame->getData(), video_frame->getDataSize());
} else if (frame->getType() == OB_FRAME_IR_RIGHT) {
memcpy(buffer_right_ir_.get(), video_frame->getData(), video_frame->getDataSize());
}
}
}
}
if (stream_index == COLOR && enable_color_undistortion_ &&
color_undistortion_publisher_->get_subscription_count() > 0) {
auto undistorted_image = undistortImage(image, intrinsic, distortion);
@@ -78,7 +78,7 @@ class MultiCameraSubscriber : public rclcpp::Node {
private:
std::mutex image_mutex_;
std::mutex meta_mutex_;
// std::mutex meta_mutex_;
void params_init() {
std::ifstream file(
"install/orbbec_camera/share/orbbec_camera/config/tools/multisavergbir/"
@@ -117,7 +117,8 @@ class MultiCameraSubscriber : public rclcpp::Node {
color_metadata_.exposure_buffs.resize(left_ir_topics_.size());
color_metadata_.gain_buffs.resize(left_ir_topics_.size());
callback_called_ = std::vector<bool>(left_ir_topics_.size(), false);
auto custom_qos = rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(rmw_qos_profile_default));
auto custom_qos = rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(rmw_qos_profile_sensor_data));
custom_qos.reliability(rclcpp::ReliabilityPolicy::BestEffort);
RCLCPP_INFO_STREAM(rclcpp::get_logger("multi_camera_subscriber"),
"camera_name_.size(): " << camera_name_.size());
for (size_t i = 0; i < camera_name_.size(); ++i) {
@@ -336,7 +337,7 @@ class MultiCameraSubscriber : public rclcpp::Node {
void ir_meta_Callback(std::shared_ptr<const orbbec_camera_msgs::msg::Metadata> msg,
size_t index) {
std::lock_guard<std::mutex> lock(meta_mutex_);
std::lock_guard<std::mutex> lock(image_mutex_);
if (!callback_called_[index] && static_cast<size_t>(saving_images_number_)) {
nlohmann::json json_data = nlohmann::json::parse(msg->json_data);
left_ir_metadata_.exposure_buffs[index].push_back(json_data["exposure"].dump());
@@ -345,7 +346,7 @@ class MultiCameraSubscriber : public rclcpp::Node {
}
void color_meta_Callback(std::shared_ptr<const orbbec_camera_msgs::msg::Metadata> msg,
size_t index) {
std::lock_guard<std::mutex> lock(meta_mutex_);
std::lock_guard<std::mutex> lock(image_mutex_);
if (!callback_called_[index] && static_cast<size_t>(saving_images_number_)) {
nlohmann::json json_data = nlohmann::json::parse(msg->json_data);
color_metadata_.exposure_buffs[index].push_back(json_data["exposure"].dump());