From f4d762b750f848bd4e1b8fd3653e6fd4a89498e9 Mon Sep 17 00:00:00 2001 From: Nullket <25816243+nullket@users.noreply.github.com> Date: Wed, 7 Oct 2020 07:46:39 +0200 Subject: [PATCH] Check if camera supports sensor scaling before forefully trying to set it --- src/ueye_cam_nodelet.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ueye_cam_nodelet.cpp b/src/ueye_cam_nodelet.cpp index 4187e14..c2d16ac 100644 --- a/src/ueye_cam_nodelet.cpp +++ b/src/ueye_cam_nodelet.cpp @@ -539,8 +539,10 @@ INT UEyeCamNodelet::parseROSParams(ros::NodeHandle& local_nh) { if ((is_err = setBinning(cam_params_.binning, false)) != IS_SUCCESS) return is_err; if ((is_err = setResolution(cam_params_.image_width, cam_params_.image_height, cam_params_.image_left, cam_params_.image_top, false)) != IS_SUCCESS) return is_err; - if ((is_err = setSensorScaling(cam_params_.sensor_scaling, false)) != IS_SUCCESS) return is_err; - + SENSORSCALERINFO sensorScalerInfo; // Not all cameras support sensor scaling. Check if supported and only try to set it if supported + if (is_GetSensorScalerInfo(cam_handle_,&sensorScalerInfo, sizeof(sensorScalerInfo)) == IS_SUCCESS ) { + if ((is_err = setSensorScaling(cam_params_.sensor_scaling, false)) != IS_SUCCESS) return is_err; + } // Force synchronize settings and re-allocate frame buffer for redundancy // NOTE: although this might not be needed, assume that parseROSParams() // is called only once per nodelet, thus ignore cost