From 1522bfd7907dd957c3ad583422fbdeb5c3e7dcad Mon Sep 17 00:00:00 2001 From: Fixstars-momoko Date: Thu, 29 Aug 2024 16:04:06 -0700 Subject: [PATCH 1/4] revert the order change for some devices --- src/bb/image-io/rt_u3v.h | 80 +++++++++++++++++++++++++++++++++------- 1 file changed, 67 insertions(+), 13 deletions(-) diff --git a/src/bb/image-io/rt_u3v.h b/src/bb/image-io/rt_u3v.h index b44cc462..808c710e 100644 --- a/src/bb/image-io/rt_u3v.h +++ b/src/bb/image-io/rt_u3v.h @@ -334,7 +334,7 @@ class U3V { devices_(num_sensor), buffers_(num_sensor), operation_mode_(OperationMode::Came1USB1), frame_cnt_(0), device_idx_(-1), disposed_(false), sim_mode_(sim_mode) { init_symbols(); - log::debug("U3V:: 23-11-18 : updating obtain and write"); + log::debug("U3V:: 24-08-29 : revert the order of AcquisitionStart and create stream as a default"); log::info("Using aravis-{}.{}.{}", arv_get_major_version(), arv_get_minor_version(), arv_get_micro_version()); } @@ -877,6 +877,7 @@ class U3VRealCam: public U3V{ log::info("\tFake Device {}::{} : {}", i, "Command", "AcquisitionStart"); } }else{ + bool order_filp = false; if (num_device < num_sensor_){ log::info("{} device is found; but the num_sensor is set to {}", num_device, num_sensor_); throw std::runtime_error("Device number is not match, please set num_device again"); @@ -950,6 +951,7 @@ class U3VRealCam: public U3V{ } if (is_gendc_){ frame_count_method_ = FrameCountMethod::TYPESPECIFIC3; + order_filp = true; } } log::info("\tDevice/USB {}::{} : {}", i, "frame_count method is ", @@ -1067,8 +1069,23 @@ class U3VRealCam: public U3V{ * ion-kit starts the acquisition before stream creation This is a tentative fix only in ion-kit due to hardware issue * In aravis, the acquisition should be done afterward. Since this maps better with GenAPI, where buffers * must be pushed to DataStream objectsbefore DataStream acquisition is started. + * refer to https://github.com/AravisProject/aravis/blob/2ebaa8661761ea4bbc4df878aa67b4a9e1a9a3b9/docs/reference/aravis/porting-0.10.md */ + if (order_filp){ + for (auto i=0; imessage); + } + log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionMode"); + arv_device_execute_command(devices_[i].device_, "AcquisitionStart", &err_); + if (err_) { + throw std::runtime_error(err_->message); + } + log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionStart"); + } + } //start streaming after AcquisitionStart for (auto i=0; imessage); + } + log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionMode"); + + arv_device_execute_command(devices_[i].device_, "AcquisitionStart", &err_); + if (err_) { + throw std::runtime_error(err_->message); + } + log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionStart"); + } + } + for (auto i=0; imessage); - } - log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionMode"); - - arv_device_execute_command(devices_[i].device_, "AcquisitionStart", &err_); - if (err_) { - throw std::runtime_error(err_->message); - } - log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionStart"); } /* @@ -1559,7 +1583,21 @@ class U3VGenDC: public U3V{ * must be pushed to DataStream objectsbefore DataStream acquisition is started. * refer to https://github.com/AravisProject/aravis/blob/2ebaa8661761ea4bbc4df878aa67b4a9e1a9a3b9/docs/reference/aravis/porting-0.10.md */ + if (order_filp){ + for (auto i=0; imessage); + } + log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionMode"); + arv_device_execute_command(devices_[i].device_, "AcquisitionStart", &err_); + if (err_) { + throw std::runtime_error(err_->message); + } + log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionStart"); + } + } //start streaming after AcquisitionStart for (auto i=0; imessage); + } + log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionMode"); + + arv_device_execute_command(devices_[i].device_, "AcquisitionStart", &err_); + if (err_) { + throw std::runtime_error(err_->message); + } + log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionStart"); + } + } + for (auto i=0; i Date: Fri, 30 Aug 2024 13:31:33 -0700 Subject: [PATCH 2/4] fixed the prev commit --- src/bb/image-io/rt_u3v.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/bb/image-io/rt_u3v.h b/src/bb/image-io/rt_u3v.h index 808c710e..2139af1c 100644 --- a/src/bb/image-io/rt_u3v.h +++ b/src/bb/image-io/rt_u3v.h @@ -1052,18 +1052,6 @@ class U3VRealCam: public U3V{ } log::info("\tDevice/USB {}::{} : {}", i, "OperationMode", operation_mode_in_string); } - - arv_device_set_string_feature_value(devices_[i].device_, "AcquisitionMode", arv_acquisition_mode_to_string(ARV_ACQUISITION_MODE_CONTINUOUS), &err_); - if (err_) { - throw std::runtime_error(err_->message); - } - log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionMode"); - - arv_device_execute_command(devices_[i].device_, "AcquisitionStart", &err_); - if (err_) { - throw std::runtime_error(err_->message); - } - log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionStart"); } /* * ion-kit starts the acquisition before stream creation This is a tentative fix only in ion-kit due to hardware issue From fa462d3c50d9d1396b2ae19f5fdcbbf41cdc2b87 Mon Sep 17 00:00:00 2001 From: Fixstars-momoko Date: Fri, 30 Aug 2024 13:35:32 -0700 Subject: [PATCH 3/4] used member variable --- src/bb/image-io/rt_u3v.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/bb/image-io/rt_u3v.h b/src/bb/image-io/rt_u3v.h index 2139af1c..a19274bc 100644 --- a/src/bb/image-io/rt_u3v.h +++ b/src/bb/image-io/rt_u3v.h @@ -331,7 +331,7 @@ class U3V { : gobject_(GOBJECT_FILE, true), aravis_(ARAVIS_FILE, true), num_sensor_(num_sensor), frame_count_method_(FrameCountMethod::UNAVAILABLE), frame_sync_(frame_sync), realtime_display_mode_(realtime_display_mode), is_gendc_(false), is_param_integer_(false), - devices_(num_sensor), buffers_(num_sensor), operation_mode_(OperationMode::Came1USB1), frame_cnt_(0), device_idx_(-1), disposed_(false), sim_mode_(sim_mode) + devices_(num_sensor), buffers_(num_sensor), operation_mode_(OperationMode::Came1USB1), frame_cnt_(0), device_idx_(-1), disposed_(false), sim_mode_(sim_mode), order_filp_(false) { init_symbols(); log::debug("U3V:: 24-08-29 : revert the order of AcquisitionStart and create stream as a default"); @@ -572,7 +572,7 @@ class U3V { bool disposed_; bool sim_mode_; - + bool order_filp_; }; // class U3V @@ -877,7 +877,6 @@ class U3VRealCam: public U3V{ log::info("\tFake Device {}::{} : {}", i, "Command", "AcquisitionStart"); } }else{ - bool order_filp = false; if (num_device < num_sensor_){ log::info("{} device is found; but the num_sensor is set to {}", num_device, num_sensor_); throw std::runtime_error("Device number is not match, please set num_device again"); @@ -951,7 +950,7 @@ class U3VRealCam: public U3V{ } if (is_gendc_){ frame_count_method_ = FrameCountMethod::TYPESPECIFIC3; - order_filp = true; + order_filp_ = true; } } log::info("\tDevice/USB {}::{} : {}", i, "frame_count method is ", @@ -1059,7 +1058,7 @@ class U3VRealCam: public U3V{ * must be pushed to DataStream objectsbefore DataStream acquisition is started. * refer to https://github.com/AravisProject/aravis/blob/2ebaa8661761ea4bbc4df878aa67b4a9e1a9a3b9/docs/reference/aravis/porting-0.10.md */ - if (order_filp){ + if (order_filp_){ for (auto i=0; i Date: Fri, 30 Aug 2024 13:42:53 -0700 Subject: [PATCH 4/4] add CommandAcquisitionModeContdStart(); --- src/bb/image-io/rt_u3v.h | 73 ++++++++++++---------------------------- 1 file changed, 21 insertions(+), 52 deletions(-) diff --git a/src/bb/image-io/rt_u3v.h b/src/bb/image-io/rt_u3v.h index a19274bc..67266716 100644 --- a/src/bb/image-io/rt_u3v.h +++ b/src/bb/image-io/rt_u3v.h @@ -483,6 +483,23 @@ class U3V { return err_; } + GError* CommandAcquisitionModeContdStart(){ + for (auto i=0; imessage); + } + log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionMode"); + + arv_device_execute_command(devices_[i].device_, "AcquisitionStart", &err_); + if (err_) { + throw std::runtime_error(err_->message); + } + log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionStart"); + } + return err_; + } + g_object_unref_t g_object_unref; arv_get_major_version_t arv_get_major_version; @@ -1059,19 +1076,7 @@ class U3VRealCam: public U3V{ * refer to https://github.com/AravisProject/aravis/blob/2ebaa8661761ea4bbc4df878aa67b4a9e1a9a3b9/docs/reference/aravis/porting-0.10.md */ if (order_filp_){ - for (auto i=0; imessage); - } - log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionMode"); - - arv_device_execute_command(devices_[i].device_, "AcquisitionStart", &err_); - if (err_) { - throw std::runtime_error(err_->message); - } - log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionStart"); - } + err_ = CommandAcquisitionModeContdStart(); } //start streaming after AcquisitionStart for (auto i=0; imessage); - } - log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionMode"); - - arv_device_execute_command(devices_[i].device_, "AcquisitionStart", &err_); - if (err_) { - throw std::runtime_error(err_->message); - } - log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionStart"); - } + err_ = CommandAcquisitionModeContdStart(); } for (auto i=0; imessage); - } - log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionMode"); - - arv_device_execute_command(devices_[i].device_, "AcquisitionStart", &err_); - if (err_) { - throw std::runtime_error(err_->message); - } - log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionStart"); - } + err_ = CommandAcquisitionModeContdStart(); } //start streaming after AcquisitionStart for (auto i=0; imessage); - } - log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionMode"); - - arv_device_execute_command(devices_[i].device_, "AcquisitionStart", &err_); - if (err_) { - throw std::runtime_error(err_->message); - } - log::info("\tDevice/USB {}::{} : {}", i, "Command", "AcquisitionStart"); - } + err_ = CommandAcquisitionModeContdStart(); } for (auto i=0; i