fix: improve software alignment handling and cleanup in image registration mode

This commit is contained in:
slz
2026-09-14 16:47:22 +08:00
parent c28fcb9052
commit 113a956afa
2 changed files with 8 additions and 2 deletions
+4 -2
View File
@@ -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);
+4
View File
@@ -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);