mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-09 22:29:48 +08:00
fix: improve software alignment handling and cleanup in image registration mode
This commit is contained in:
@@ -6546,8 +6546,9 @@ void OBCameraNode::onNewFrameSetCallback(std::shared_ptr<ob::FrameSet> frame_set
|
||||
if (align_target_stream_ == OB_STREAM_COLOR) {
|
||||
publishRawDepthImage(depth_frame);
|
||||
}
|
||||
if (align_target_stream_ == OB_STREAM_DEPTH && !color_frame) {
|
||||
RCLCPP_DEBUG_STREAM(logger_, "C2D alignment requires a color frame, skip alignment");
|
||||
if (!color_frame) {
|
||||
RCLCPP_DEBUG_STREAM(logger_, "Software alignment requires a color frame, skip frame set");
|
||||
return;
|
||||
} else {
|
||||
auto align_color_frame = color_frame;
|
||||
if (align_target_stream_ == OB_STREAM_DEPTH) {
|
||||
@@ -6570,6 +6571,7 @@ void OBCameraNode::onNewFrameSetCallback(std::shared_ptr<ob::FrameSet> frame_set
|
||||
}
|
||||
if (!align_color_frame) {
|
||||
RCLCPP_ERROR_STREAM(logger_, "Failed to convert color frame for C2D alignment");
|
||||
return;
|
||||
} else if (align_color_frame != color_frame) {
|
||||
color_frame = align_color_frame;
|
||||
frame_set->pushFrame(color_frame);
|
||||
|
||||
@@ -903,6 +903,8 @@ void OBCameraNode::setImageRegistrationModeCallback(
|
||||
|
||||
auto rollback_after_error = [&](const std::string& error_message) {
|
||||
try {
|
||||
stopColorFrameThreads();
|
||||
clearColorFrameQueues();
|
||||
restore_old_mode();
|
||||
if (was_running && !pipeline_started_.load()) {
|
||||
startStreams();
|
||||
@@ -924,6 +926,8 @@ void OBCameraNode::setImageRegistrationModeCallback(
|
||||
if (was_running) {
|
||||
stopStreams();
|
||||
}
|
||||
stopColorFrameThreads();
|
||||
clearColorFrameQueues();
|
||||
|
||||
apply_image_registration_mode(mode);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user