diff --git a/README.md b/README.md index b28e4ad..76e65da 100644 --- a/README.md +++ b/README.md @@ -58,14 +58,33 @@ rqt_image_view ## Parmeters All the parameters can be set via the launch file or via the yaml config_file. It is good practice to specify all the 'task' specific parameters via launch file and all the 'system configuration' specific parameters via a config_file. + +### Auto Exposure Parameters +* ~exposure_time (int, default: 0, 0:auto) + Exposure setting for cameras, also available as dynamic reconfiguarble parameter. + + +* For auto_exposure mode (~exposure_time=0), following parameters will be used: + + +The upper and lower limits are the time duration for auto exposure algorithm on chip. On spinview software for Blackfly s, default upper limit = 15000 us +default lower limits = 100 us and acceptable minimum value >= 6 us + + +Setting an higher auto_exposure_upper_limit could potentially slow down the desired fps based on scene. Especially when collecting data greater than 45 fps in auto_exposure it is recommended to have a lower value on auto_exposure_upper_limit. + + +* ~auto_exposure_lower_limit (int, default: 100 us) + Auto Exposure lower limit setting to be used in auto_exposure mode, min:6 us for blackfly s model. +* ~auto_exposure_upper_limit (int, default: 2000 us) + Auto Exposure upper limit setting to be used in auto_exposure mode. + ### Task Specific Parameters * ~binning (int, default: 1) Binning for cameras, when changing from 2 to 1 cameras need to be unplugged and replugged * ~color (bool, default: false) Should color images be used (only works on models that support color images) -* ~exposure_time (int, default: 0, 0:auto) - Exposure setting for cameras, also available as dynamic reconfiguarble parameter. - * ~external_trigger (bool, default: false) +* ~external_trigger (bool, default: false) Camera triggering setting when using an external trigger. In this mode, none of the cameras would be set as a master camera. All cameras are setup to use external trigger. In this mode the main loop runs at rate set by soft_framerate, so if the external trigger rate is higher than the soft_framerate, the buffer will get filled and images will have a lag. Also in this mode, the getnextimage timeout is set to infinite so that the node dosen't die if a trigger is not received for a while. * ~target_grey_value (double, default: 0 , 0:Continous/auto) Setting target_grey_value > 4 (min:4 , max:99) will turn AutoExposureTargetGreyValueAuto to 'off' and set AutoExposureTargetGreyValue to target_grey_value. Also available as dynamic reconfigurable parameter. see below in Dynamic reconfigurable parameter section. diff --git a/include/spinnaker_sdk_camera_driver/capture.h b/include/spinnaker_sdk_camera_driver/capture.h index 741d286..a0a4be4 100755 --- a/include/spinnaker_sdk_camera_driver/capture.h +++ b/include/spinnaker_sdk_camera_driver/capture.h @@ -105,12 +105,13 @@ namespace acquisition { int nframes_; float init_delay_; int skip_num_; - float master_fps_; + //float master_fps_; int binning_; bool color_; string dump_img_; string ext_; float exposure_time_; + float auto_exposure_lower_limit_,auto_exposure_upper_limit_; double target_grey_value_; // int decimation_; string tf_prefix_; diff --git a/launch/acquisition.launch b/launch/acquisition.launch index 8d8fd31..ea4c4bf 100644 --- a/launch/acquisition.launch +++ b/launch/acquisition.launch @@ -3,9 +3,11 @@ - + - + + + @@ -43,6 +45,8 @@ + + diff --git a/launch/node_acquisition.launch b/launch/node_acquisition.launch index 83d3aec..d276466 100644 --- a/launch/node_acquisition.launch +++ b/launch/node_acquisition.launch @@ -5,8 +5,10 @@ - - + + + + @@ -36,6 +38,8 @@ + + diff --git a/params/stereo_camera_example.yaml b/params/stereo_camera_example.yaml index 1368a5c..786fcca 100644 --- a/params/stereo_camera_example.yaml +++ b/params/stereo_camera_example.yaml @@ -1,10 +1,10 @@ cam_ids: +- 17197555 - 17197554 -- 17197556 cam_aliases: - cam0 - cam1 -master_cam: 17197554 +master_cam: 17197555 skip: 20 delay: 1.0 diff --git a/params/test_params.yaml b/params/test_params.yaml index c359b2c..084e36f 100644 --- a/params/test_params.yaml +++ b/params/test_params.yaml @@ -1,8 +1,8 @@ cam_ids: -- 17197556 +- 17197554 cam_aliases: - cam0 -master_cam: 17197556 +master_cam: 17197554 skip: 20 delay: 1.0 diff --git a/src/capture.cpp b/src/capture.cpp index 95586a8..dc9eedb 100755 --- a/src/capture.cpp +++ b/src/capture.cpp @@ -82,6 +82,8 @@ void acquisition::Capture::init_variables_register_to_ros() { // default values for the parameters are set here. Should be removed eventually!! exposure_time_ = 0 ; // default as 0 = auto exposure + auto_exposure_lower_limit_ = 100; // 0.1 ms(min value blackfly s=6us) + auto_exposure_upper_limit_ = 2000; // 2ms soft_framerate_ = 20; //default soft framrate ext_ = ".bmp"; SOFT_FRAME_RATE_CTRL_ = false; @@ -99,7 +101,7 @@ void acquisition::Capture::init_variables_register_to_ros() { region_of_interest_set_ = false; skip_num_ = 20; init_delay_ = 1; - master_fps_ = 20.0; + //master_fps_ = 20.0; binning_ = 1; SPINNAKER_GET_NEXT_IMAGE_TIMEOUT_ = 2000; todays_date_ = todays_date(); @@ -425,6 +427,8 @@ void acquisition::Capture::read_parameters() { } } else ROS_WARN(" 'delay' Parameter not set, using default behavior: delay=%f",init_delay_); + + /* if (nh_pvt_.getParam("fps", master_fps_)){ if (master_fps_>=0) ROS_INFO(" Master cam fps set to : %0.2f",master_fps_); else { @@ -433,12 +437,21 @@ void acquisition::Capture::read_parameters() { } } else ROS_WARN(" 'fps' Parameter not set, using default behavior: fps=%0.2f",master_fps_); - + */ if (nh_pvt_.getParam("exposure_time", exposure_time_)){ if (exposure_time_ >0) ROS_INFO(" Exposure set to: %.1f",exposure_time_); else ROS_INFO(" 'exposure_time'=%0.f, Setting autoexposure",exposure_time_); } else ROS_WARN(" 'exposure_time' Parameter not set, using default behavior: Automatic Exposure "); - + if (exposure_time_ == 0) { + // if exposure is auto, exposure_time param is 0 + // min exposure is usually > 5 fro blackfly s and varies with camera model + if (nh_pvt_.getParam("auto_exposure_lower_limit", auto_exposure_lower_limit_)) ROS_INFO(" auto_exposure_lower_limit set to: %.1f",auto_exposure_lower_limit_); + else ROS_WARN(" 'auto_exposure_lower_limit' Parameter not set, using default behavior: auto_exposure_lower_limit=%.1f",auto_exposure_lower_limit_); + + if (nh_pvt_.getParam("auto_exposure_upper_limit", auto_exposure_upper_limit_)) ROS_INFO(" auto_exposure_upper_limit set to: %.1f",auto_exposure_upper_limit_); + else ROS_WARN(" 'auto_exposure_upper_limit' Parameter not set, using default behavior: auto_exposure_upper_limit=%.1f",auto_exposure_upper_limit_); + } + if (nh_pvt_.getParam("target_grey_value", target_grey_value_)){ if (target_grey_value_ >0) ROS_INFO(" target_grey_value set to: %.1f",target_grey_value_); else ROS_INFO(" 'target_grey_value'=%0.f, Setting AutoExposureTargetGreyValueAuto to Continuous/ auto",target_grey_value_);} @@ -658,7 +671,10 @@ void acquisition::Capture::init_cameras(bool soft = false) { cams[i].setFloatValue("ExposureTime", exposure_time_); } else { cams[i].setEnumValue("ExposureAuto", "Continuous"); + cams[i].setFloatValue("AutoExposureExposureTimeLowerLimit",auto_exposure_lower_limit_); + cams[i].setFloatValue("AutoExposureExposureTimeUpperLimit",auto_exposure_upper_limit_); } + if (target_grey_value_ > 4.0) { cams[i].setEnumValue("AutoExposureTargetGreyValueAuto", "Off"); cams[i].setFloatValue("AutoExposureTargetGreyValue", target_grey_value_);