From dfa44a51727accd30c97a3a853d45a0c577559a1 Mon Sep 17 00:00:00 2001 From: ob-yalian Date: Sun, 20 Sep 2026 16:59:19 +0800 Subject: [PATCH] fix: ignore MJPEG quality for non-MJPEG formats --- orbbec_camera/src/ob_camera_node.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/orbbec_camera/src/ob_camera_node.cpp b/orbbec_camera/src/ob_camera_node.cpp index 34ca616c..a1cd7891 100644 --- a/orbbec_camera/src/ob_camera_node.cpp +++ b/orbbec_camera/src/ob_camera_node.cpp @@ -1473,7 +1473,9 @@ void OBCameraNode::setupDevices() { logger_, "Current color gain: " << device_->getIntProperty(OB_PROP_COLOR_GAIN_INT))); } } - if (color_mjpeg_quality_ != -1) { + if (color_mjpeg_quality_ != -1 && + (format_[COLOR] == OB_FORMAT_UNKNOWN || format_[COLOR] == OB_FORMAT_MJPG || + format_[COLOR] == OB_FORMAT_MJPEG)) { if (!device_->isPropertySupported(OB_PROP_MJPEG_QUALITY_INT, OB_PERMISSION_WRITE)) { RCLCPP_WARN_STREAM(logger_, "color_mjpeg_quality is not supported by this device"); } else { @@ -1489,6 +1491,9 @@ void OBCameraNode::setupDevices() { "Current color MJPEG quality: " << device_->getIntProperty(OB_PROP_MJPEG_QUALITY_INT))); } } + } else if (color_mjpeg_quality_ != -1) { + RCLCPP_WARN_STREAM(logger_, "color_mjpeg_quality is ignored because color format is " + << format_str_[COLOR] << "; MJPG/MJPEG is required"); } if (should_apply_launch_config("enable_color_auto_exposure_priority") && device_->isPropertySupported(OB_PROP_COLOR_AUTO_EXPOSURE_PRIORITY_INT, OB_PERMISSION_WRITE)) {