mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-12 15:29:49 +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) {
|
if (align_target_stream_ == OB_STREAM_COLOR) {
|
||||||
publishRawDepthImage(depth_frame);
|
publishRawDepthImage(depth_frame);
|
||||||
}
|
}
|
||||||
if (align_target_stream_ == OB_STREAM_DEPTH && !color_frame) {
|
if (!color_frame) {
|
||||||
RCLCPP_DEBUG_STREAM(logger_, "C2D alignment requires a color frame, skip alignment");
|
RCLCPP_DEBUG_STREAM(logger_, "Software alignment requires a color frame, skip frame set");
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
auto align_color_frame = color_frame;
|
auto align_color_frame = color_frame;
|
||||||
if (align_target_stream_ == OB_STREAM_DEPTH) {
|
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) {
|
if (!align_color_frame) {
|
||||||
RCLCPP_ERROR_STREAM(logger_, "Failed to convert color frame for C2D alignment");
|
RCLCPP_ERROR_STREAM(logger_, "Failed to convert color frame for C2D alignment");
|
||||||
|
return;
|
||||||
} else if (align_color_frame != color_frame) {
|
} else if (align_color_frame != color_frame) {
|
||||||
color_frame = align_color_frame;
|
color_frame = align_color_frame;
|
||||||
frame_set->pushFrame(color_frame);
|
frame_set->pushFrame(color_frame);
|
||||||
|
|||||||
@@ -903,6 +903,8 @@ void OBCameraNode::setImageRegistrationModeCallback(
|
|||||||
|
|
||||||
auto rollback_after_error = [&](const std::string& error_message) {
|
auto rollback_after_error = [&](const std::string& error_message) {
|
||||||
try {
|
try {
|
||||||
|
stopColorFrameThreads();
|
||||||
|
clearColorFrameQueues();
|
||||||
restore_old_mode();
|
restore_old_mode();
|
||||||
if (was_running && !pipeline_started_.load()) {
|
if (was_running && !pipeline_started_.load()) {
|
||||||
startStreams();
|
startStreams();
|
||||||
@@ -924,6 +926,8 @@ void OBCameraNode::setImageRegistrationModeCallback(
|
|||||||
if (was_running) {
|
if (was_running) {
|
||||||
stopStreams();
|
stopStreams();
|
||||||
}
|
}
|
||||||
|
stopColorFrameThreads();
|
||||||
|
clearColorFrameQueues();
|
||||||
|
|
||||||
apply_image_registration_mode(mode);
|
apply_image_registration_mode(mode);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user