From d0357fa96051e36ba43ce6f2f11db74350375bf3 Mon Sep 17 00:00:00 2001 From: Ian Colwell Date: Mon, 19 Aug 2019 18:36:06 -0400 Subject: [PATCH 01/11] Changelog for upcoming release --- CHANGELOG.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 940e1b62..996e3686 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,19 @@ Changelog for package avt_vimba_camera ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Forthcoming +----------- +* Merge pull request `#35 `_ from willcbaker/feature/nodelet + Feature/nodelet +* Update nodelet launch files +* Add nodelet +* Fix `#31 `_ +* Merge pull request `#30 `_ from chewwt/armv8 + add support for armv8 +* add support for armv8 +* Change frame observer to shared ptr +* Contributors: Miquel Massot, Will Baker, ruth + 0.0.10 (2017-08-16) ------------------- * Merge pull request `#26 `_ from 130s/k/add_ci From 028ccace4d414697065eb5073fd2ad77dfc73ee4 Mon Sep 17 00:00:00 2001 From: Ian Colwell Date: Mon, 19 Aug 2019 18:36:19 -0400 Subject: [PATCH 02/11] 0.0.11 --- CHANGELOG.rst | 4 ++-- package.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 996e3686..46633a37 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,8 +2,8 @@ Changelog for package avt_vimba_camera ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Forthcoming ------------ +0.0.11 (2019-08-19) +------------------- * Merge pull request `#35 `_ from willcbaker/feature/nodelet Feature/nodelet * Update nodelet launch files diff --git a/package.xml b/package.xml index d286fd91..35917386 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,7 @@ avt_vimba_camera - 0.0.10 + 0.0.11 Wrapper of the Allied Vision Technologies (AVT) VIMBA Ethernet and Firewire SDK. Miquel Massot From 426322c631252006a18f0121acccd36fca1222ca Mon Sep 17 00:00:00 2001 From: icolwell-as <48106342+icolwell-as@users.noreply.github.com> Date: Fri, 6 Mar 2020 16:20:10 +0100 Subject: [PATCH 03/11] Add more pixelformats, thanks to @jmoreau-hds (#3) --- cfg/AvtVimbaCamera.cfg | 42 +++++++++++++++++++++++++++++++--------- src/avt_vimba_camera.cpp | 21 +++++++++++++++++++- 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/cfg/AvtVimbaCamera.cfg b/cfg/AvtVimbaCamera.cfg index 5115a16c..b834630e 100755 --- a/cfg/AvtVimbaCamera.cfg +++ b/cfg/AvtVimbaCamera.cfg @@ -31,15 +31,39 @@ acquisition_mode_enum = gen.enum( [ gen.const("Continuous", str_t, "Continuous" gen.const("SingleFrame", str_t, "SingleFrame", "The camera will only deliver a single frame trigger event"), gen.const("MultiFrame", str_t, "MultiFrame", "The camera will acquire the number of images specified by `~AcquisitionFrameCount`. Further trigger events will be ignored"), gen.const("Recorder", str_t, "Recorder", "The camera will continuously record images into the camera on-board memory")], "Set Trigger Mode") -# Monochrome cameras have mono8,12 and 12Packed. Color cameras have only mono8. -pixelformat_enum = gen.enum([ gen.const("Mono8", str_t, "Mono8", ""), - gen.const("Mono12", str_t, "Mono12", ""), - gen.const("Mono12Packed", str_t, "Mono12Packed", ""), - gen.const("BayerRG8", str_t, "BayerRG8", ""), - gen.const("BayerRG12Packed", str_t, "BayerRG12Packed", ""), - gen.const("BayerGR12", str_t, "BayerGR12", ""), - gen.const("RGB8Packed", str_t, "RGB8Packed", ""), - gen.const("BGR8Packed", str_t, "BGR8Packed", "")], "Set Pixel Format") + +# NOTE: Your AVT camera model likely doesn't support all these formats, +# check the datasheet to confirm which formats are supported. +pixelformat_enum = gen.enum([ + gen.const("Mono8", str_t, "Mono8", ""), + gen.const("Mono10", str_t, "Mono10", ""), + gen.const("Mono10Packed", str_t, "Mono10Packed", ""), + gen.const("Mono12", str_t, "Mono12", ""), + gen.const("Mono12Packed", str_t, "Mono12Packed", ""), + gen.const("BayerGR8", str_t, "BayerGR8", ""), + gen.const("BayerRG8", str_t, "BayerRG8", ""), + gen.const("BayerGB8", str_t, "BayerGB8", ""), + gen.const("BayerBG8", str_t, "BayerBG8", ""), + gen.const("BayerGR10", str_t, "BayerGR10", ""), + gen.const("BayerRG10", str_t, "BayerRG10", ""), + gen.const("BayerGB10", str_t, "BayerGB10", ""), + gen.const("BayerBG10", str_t, "BayerBG10", ""), + gen.const("BayerGR12", str_t, "BayerGR12", ""), + gen.const("BayerRG12", str_t, "BayerRG12", ""), + gen.const("BayerGB12", str_t, "BayerGB12", ""), + gen.const("BayerBG12", str_t, "BayerBG12", ""), + gen.const("BayerGR10Packed", str_t, "BayerGR10Packed", ""), + gen.const("BayerRG10Packed", str_t, "BayerRG10Packed", ""), + gen.const("BayerGB10Packed", str_t, "BayerGB10Packed", ""), + gen.const("BayerBG10Packed", str_t, "BayerBG10Packed", ""), + gen.const("BayerGR12Packed", str_t, "BayerGR12Packed", ""), + gen.const("BayerRG12Packed", str_t, "BayerRG12Packed", ""), + gen.const("BayerGB12Packed", str_t, "BayerGB12Packed", ""), + gen.const("BayerBG12Packed", str_t, "BayerBG12Packed", ""), + gen.const("RGB8Packed", str_t, "RGB8Packed", ""), + gen.const("BGR8Packed", str_t, "BGR8Packed", "") +], "Set Pixel Format") + auto_enum = gen.enum([ gen.const("Off", str_t, "Off", ""), gen.const("Once", str_t, "Once", ""), gen.const("Auto", str_t, "Continuous", "")], "Set Automatic Control") diff --git a/src/avt_vimba_camera.cpp b/src/avt_vimba_camera.cpp index 0096dfb7..b54110d6 100644 --- a/src/avt_vimba_camera.cpp +++ b/src/avt_vimba_camera.cpp @@ -59,11 +59,30 @@ static const char* AcquisitionMode[] = { "Recorder"}; static const char* PixelFormatMode[] = { "Mono8", + "Mono10", + "Mono10Packed", "Mono12", "Mono12Packed", + "BayerGR8", "BayerRG8", - "BayerRG12Packed", + "BayerGB8", + "BayerBG8", + "BayerGR10", + "BayerRG10", + "BayerGB10", + "BayerBG10", + "BayerGR12", "BayerRG12", + "BayerGB12", + "BayerBG12", + "BayerGR10Packed", + "BayerRG10Packed", + "BayerGB10Packed", + "BayerBG10Packed", + "BayerGR12Packed", + "BayerRG12Packed", + "BayerGB12Packed", + "BayerBG12Packed", "RGB8Packed", "BGR8Packed"}; static const char* BalanceRatioMode[] = { From 88135d5d63f764beae445b8680da95aa1d21b823 Mon Sep 17 00:00:00 2001 From: icolwell-as <48106342+icolwell-as@users.noreply.github.com> Date: Wed, 3 Jun 2020 17:27:13 -0400 Subject: [PATCH 04/11] Brief README (#10) --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..b2dd6224 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# avt_vimba_camera + +This repo contains a ROS driver for cameras manufactured by [Allied Vision Technologies](https://www.alliedvision.com). +The driver relies on libraries provided by AVT as part of their [Vimba SDK](https://www.alliedvision.com/en/products/software.html). + +## Installing the driver + +You can install via ROS package repos: +``` +sudo apt install ros-$ROS_DISTRO-avt-vimba-camera +``` From 40b235ab87949932c7121ba45e8cd15d7269e300 Mon Sep 17 00:00:00 2001 From: icolwell-as <48106342+icolwell-as@users.noreply.github.com> Date: Thu, 4 Jun 2020 12:46:26 -0400 Subject: [PATCH 05/11] Remove duplicated launch file installs (#15) --- CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffc947ba..8a143986 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,10 +143,6 @@ install(DIRECTORY include ## Mark other files for installation (e.g. launch and bag files, etc.) install(FILES plugins.xml - launch/mono_camera.launch - launch/mono_camera_nodelet.launch - launch/stereo_camera_one_node.launch - launch/stereo_camera_two_nodes.launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} ) From a3567d09b442d78dcc3e1ca811682cca36ac4976 Mon Sep 17 00:00:00 2001 From: icolwell-as <48106342+icolwell-as@users.noreply.github.com> Date: Thu, 4 Jun 2020 16:48:11 -0400 Subject: [PATCH 06/11] Launch File Updates (#13) * Standardize launch file formatting, remove commented code * Provide args for all parameters * Launch file for Mako G-319 * Fix typo * Update stream_bytes_per_second to maximum bandwidth for the Mako G-319, disable output to screen due to excessive logging --- launch/Mako_G-319.launch | 23 +++++ launch/calibration.launch | 16 ++-- launch/mono_camera.launch | 129 ++++++++++++-------------- launch/mono_camera_nodelet.launch | 78 +++++++++------- launch/record.launch | 14 +-- launch/stereo_camera_nodelet.launch | 1 - launch/stereo_camera_one_node.launch | 28 +++--- launch/stereo_camera_two_nodes.launch | 106 ++++++++++----------- 8 files changed, 202 insertions(+), 193 deletions(-) create mode 100644 launch/Mako_G-319.launch diff --git a/launch/Mako_G-319.launch b/launch/Mako_G-319.launch new file mode 100644 index 00000000..f9095927 --- /dev/null +++ b/launch/Mako_G-319.launch @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/launch/calibration.launch b/launch/calibration.launch index 5c882137..b26c05b0 100644 --- a/launch/calibration.launch +++ b/launch/calibration.launch @@ -1,9 +1,9 @@ - - - - - - - - \ No newline at end of file + + + + + + + + diff --git a/launch/mono_camera.launch b/launch/mono_camera.launch index 529ab358..b795662f 100644 --- a/launch/mono_camera.launch +++ b/launch/mono_camera.launch @@ -1,74 +1,59 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/launch/mono_camera_nodelet.launch b/launch/mono_camera_nodelet.launch index e114ad8d..bed642d9 100644 --- a/launch/mono_camera_nodelet.launch +++ b/launch/mono_camera_nodelet.launch @@ -3,46 +3,62 @@ + + + + + + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/launch/record.launch b/launch/record.launch index 2727d6aa..1d06d51c 100644 --- a/launch/record.launch +++ b/launch/record.launch @@ -1,8 +1,10 @@ - - - + + + - - - \ No newline at end of file + + diff --git a/launch/stereo_camera_nodelet.launch b/launch/stereo_camera_nodelet.launch index 1fa96f02..9efeeeba 100644 --- a/launch/stereo_camera_nodelet.launch +++ b/launch/stereo_camera_nodelet.launch @@ -22,5 +22,4 @@ - diff --git a/launch/stereo_camera_one_node.launch b/launch/stereo_camera_one_node.launch index e3577d8a..e03cef02 100644 --- a/launch/stereo_camera_one_node.launch +++ b/launch/stereo_camera_one_node.launch @@ -1,21 +1,17 @@ - - - - - + + + - + - - - - - - - - - + + + + + + + + - diff --git a/launch/stereo_camera_two_nodes.launch b/launch/stereo_camera_two_nodes.launch index 0fdf7152..ef7e57db 100644 --- a/launch/stereo_camera_two_nodes.launch +++ b/launch/stereo_camera_two_nodes.launch @@ -1,63 +1,51 @@ + + - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - From 759d685f9181c17a08199d2f979a7f4e524f1cda Mon Sep 17 00:00:00 2001 From: icolwell-as <48106342+icolwell-as@users.noreply.github.com> Date: Fri, 5 Jun 2020 11:45:42 -0400 Subject: [PATCH 07/11] Add missing MonoCamera Class (#16) --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a143986..ab5c1d08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,6 +117,7 @@ add_dependencies_and_linkings(sync_node) add_library(avt_camera_nodelets src/nodes/mono_camera_nodelet.cpp src/nodes/stereo_camera_nodelet.cpp + src/mono_camera.cpp src/stereo_camera.cpp src/avt_vimba_camera.cpp src/frame_observer.cpp) From 45086a3e21ee73da7797127fb0e90118d98ffc38 Mon Sep 17 00:00:00 2001 From: icolwell-as <48106342+icolwell-as@users.noreply.github.com> Date: Mon, 8 Jun 2020 12:15:28 -0400 Subject: [PATCH 08/11] 0.0.12 Release (#17) * Update changelog for 0.0.12 release * 0.0.12 --- CHANGELOG.rst | 22 +++++++++++++++++++--- package.xml | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 46633a37..f56dadae 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,20 @@ Changelog for package avt_vimba_camera ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +0.0.12 (2020-06-05) +------------------- +* Fix MonoCamera nodelet (`#16 `_) +* Launch File Updates (`#13 `_) + + * Standardize launch file formatting, remove commented code + * Provide args for all parameters + * Launch file for Mako G-319 + +* Remove duplicated launch file installs (`#15 `_) +* Brief README (`#10 `_) +* Add more pixelformats, thanks to @jmoreau-hds (`#3 `_) +* Contributors: icolwell-as + 0.0.11 (2019-08-19) ------------------- * Merge pull request `#35 `_ from willcbaker/feature/nodelet @@ -43,9 +57,11 @@ Changelog for package avt_vimba_camera * Change variable scope * Fix `#15 `_: do not depend on turbot_configurations * Merge pull request `#14 `_ from josepqp/kinetic -* 1) Added ARM 32 bits libraries - 2) Modified CMakeList.txt to compile with ARM 32 bits - 3) Added Iris Parameter + + * Added ARM 32 bits libraries + * Modified CMakeList.txt to compile with ARM 32 bits + * Added Iris Parameter + * kinetization * Fix sync problems after camera tests * Add a sync timer diff --git a/package.xml b/package.xml index 35917386..95ad7831 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,7 @@ avt_vimba_camera - 0.0.11 + 0.0.12 Wrapper of the Allied Vision Technologies (AVT) VIMBA Ethernet and Firewire SDK. Miquel Massot From 521c954a0b16de953f21c339ccb58b0c7bb3e41b Mon Sep 17 00:00:00 2001 From: Dave Date: Thu, 22 Oct 2020 13:41:37 -0400 Subject: [PATCH 09/11] increased max width to 6000 px, fixed image formats larger than 8 bits so they work now --- cfg/AvtVimbaCamera.cfg | 4 +- include/avt_vimba_camera/avt_vimba_api.h | 74 +++++++++++++++++------- 2 files changed, 54 insertions(+), 24 deletions(-) diff --git a/cfg/AvtVimbaCamera.cfg b/cfg/AvtVimbaCamera.cfg index b834630e..df61f37c 100755 --- a/cfg/AvtVimbaCamera.cfg +++ b/cfg/AvtVimbaCamera.cfg @@ -141,8 +141,8 @@ gen.add("binning_y", int_t, SensorLevels.RECONFIGURE_RUNNING, "Num gen.add("decimation_x", int_t, SensorLevels.RECONFIGURE_RUNNING, "Number of decimation operations in x.", 1, 1, 8) gen.add("decimation_y", int_t, SensorLevels.RECONFIGURE_RUNNING, "Number of decimation operations in y.", 1, 1, 8) # ROI -gen.add("width", int_t, SensorLevels.RECONFIGURE_RUNNING, "Width of the region of interest (0 for automatic).", 4096, 1, 4096) -gen.add("height", int_t, SensorLevels.RECONFIGURE_RUNNING, "Height of the region of interest (0 for automatic).", 4096, 1, 4096) +gen.add("width", int_t, SensorLevels.RECONFIGURE_RUNNING, "Width of the region of interest (0 for automatic).", 4096, 1, 6000) +gen.add("height", int_t, SensorLevels.RECONFIGURE_RUNNING, "Height of the region of interest (0 for automatic).", 4096, 1, 6000) gen.add("roi_width", int_t, SensorLevels.RECONFIGURE_RUNNING, "X offset of the region of interest.", 0, 0, 4095) gen.add("roi_height", int_t, SensorLevels.RECONFIGURE_RUNNING, "X offset of the region of interest.", 0, 0, 4095) gen.add("roi_offset_x", int_t, SensorLevels.RECONFIGURE_RUNNING, "X offset of the region of interest.", 0, 0, 4095) diff --git a/include/avt_vimba_camera/avt_vimba_api.h b/include/avt_vimba_camera/avt_vimba_api.h index 22c2e67b..4ac3edcf 100644 --- a/include/avt_vimba_camera/avt_vimba_api.h +++ b/include/avt_vimba_camera/avt_vimba_api.h @@ -111,54 +111,84 @@ class AvtVimbaApi { VmbUint32_t step = nSize / height; + // Scale images to fit data type + bool scale_to_16_bits = true; + int scale_bitshift = 0; + //bool scale_images_to_fit_data_type = true; + //uint8_t from_bits = 8; + //uint8_t to_bits = 8; + // NOTE: YUV and ARGB formats not supported std::string encoding; if (pixel_format == VmbPixelFormatMono8 ) encoding = sensor_msgs::image_encodings::MONO8; - else if (pixel_format == VmbPixelFormatMono10 ) encoding = sensor_msgs::image_encodings::MONO16; - else if (pixel_format == VmbPixelFormatMono12 ) encoding = sensor_msgs::image_encodings::MONO16; - else if (pixel_format == VmbPixelFormatMono12Packed ) encoding = sensor_msgs::image_encodings::MONO16; - else if (pixel_format == VmbPixelFormatMono14 ) encoding = sensor_msgs::image_encodings::MONO16; + else if (pixel_format == VmbPixelFormatMono10 ) { encoding = sensor_msgs::image_encodings::MONO16; scale_bitshift = 6; } // from_bits = 10; to_bits = 16; } + else if (pixel_format == VmbPixelFormatMono12 ) { encoding = sensor_msgs::image_encodings::MONO16; scale_bitshift = 4; } // from_bits = 12; to_bits = 16; } + else if (pixel_format == VmbPixelFormatMono12Packed ) encoding = "mono12_packed"; + else if (pixel_format == VmbPixelFormatMono14 ) { encoding = sensor_msgs::image_encodings::MONO16; scale_bitshift = 2; } // from_bits = 14; to_bits = 16; } else if (pixel_format == VmbPixelFormatMono16 ) encoding = sensor_msgs::image_encodings::MONO16; else if (pixel_format == VmbPixelFormatBayerGR8 ) encoding = sensor_msgs::image_encodings::BAYER_GRBG8; else if (pixel_format == VmbPixelFormatBayerRG8 ) encoding = sensor_msgs::image_encodings::BAYER_RGGB8; else if (pixel_format == VmbPixelFormatBayerGB8 ) encoding = sensor_msgs::image_encodings::BAYER_GBRG8; else if (pixel_format == VmbPixelFormatBayerBG8 ) encoding = sensor_msgs::image_encodings::BAYER_BGGR8; - else if (pixel_format == VmbPixelFormatBayerGR10 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; - else if (pixel_format == VmbPixelFormatBayerRG10 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; - else if (pixel_format == VmbPixelFormatBayerGB10 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; - else if (pixel_format == VmbPixelFormatBayerBG10 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; - else if (pixel_format == VmbPixelFormatBayerGR12 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; - else if (pixel_format == VmbPixelFormatBayerRG12 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; - else if (pixel_format == VmbPixelFormatBayerGB12 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; - else if (pixel_format == VmbPixelFormatBayerBG12 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; - else if (pixel_format == VmbPixelFormatBayerGR12Packed) encoding = sensor_msgs::image_encodings::TYPE_32SC4; - else if (pixel_format == VmbPixelFormatBayerRG12Packed) encoding = sensor_msgs::image_encodings::TYPE_32SC4; - else if (pixel_format == VmbPixelFormatBayerGB12Packed) encoding = sensor_msgs::image_encodings::TYPE_32SC4; - else if (pixel_format == VmbPixelFormatBayerBG12Packed) encoding = sensor_msgs::image_encodings::TYPE_32SC4; - else if (pixel_format == VmbPixelFormatBayerGR16 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; - else if (pixel_format == VmbPixelFormatBayerRG16 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; - else if (pixel_format == VmbPixelFormatBayerGB16 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; - else if (pixel_format == VmbPixelFormatBayerBG16 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; + else if (pixel_format == VmbPixelFormatBayerGR10 ) { encoding = sensor_msgs::image_encodings::BAYER_GRBG16; scale_bitshift = 6; } // from_bits = 10; to_bits = 16; } + else if (pixel_format == VmbPixelFormatBayerRG10 ) { encoding = sensor_msgs::image_encodings::BAYER_RGGB16; scale_bitshift = 6; } // from_bits = 10; to_bits = 16; } + else if (pixel_format == VmbPixelFormatBayerGB10 ) { encoding = sensor_msgs::image_encodings::BAYER_GBRG16; scale_bitshift = 6; } // from_bits = 10; to_bits = 16; } + else if (pixel_format == VmbPixelFormatBayerBG10 ) { encoding = sensor_msgs::image_encodings::BAYER_BGGR16; scale_bitshift = 6; } // from_bits = 10; to_bits = 16; } + else if (pixel_format == VmbPixelFormatBayerGR12 ) { encoding = sensor_msgs::image_encodings::BAYER_GRBG16; scale_bitshift = 4; } // from_bits = 12; to_bits = 16; } + else if (pixel_format == VmbPixelFormatBayerRG12 ) { encoding = sensor_msgs::image_encodings::BAYER_RGGB16; scale_bitshift = 4; } // from_bits = 12; to_bits = 16; } + else if (pixel_format == VmbPixelFormatBayerGB12 ) { encoding = sensor_msgs::image_encodings::BAYER_GBRG16; scale_bitshift = 4; } // from_bits = 12; to_bits = 16; } + else if (pixel_format == VmbPixelFormatBayerBG12 ) { encoding = sensor_msgs::image_encodings::BAYER_BGGR16; scale_bitshift = 4; } // from_bits = 12; to_bits = 16; } + else if (pixel_format == VmbPixelFormatBayerGR12Packed) encoding = "bayer_grrg12_packed"; + else if (pixel_format == VmbPixelFormatBayerRG12Packed) encoding = "bayer_rggb12_packed"; + else if (pixel_format == VmbPixelFormatBayerGB12Packed) encoding = "bayer_gbrg12_packed"; + else if (pixel_format == VmbPixelFormatBayerBG12Packed) encoding = "bayer_bggr12_packed"; + else if (pixel_format == VmbPixelFormatBayerGR16 ) encoding = sensor_msgs::image_encodings::BAYER_GRBG16; + else if (pixel_format == VmbPixelFormatBayerRG16 ) encoding = sensor_msgs::image_encodings::BAYER_RGGB16; + else if (pixel_format == VmbPixelFormatBayerGB16 ) encoding = sensor_msgs::image_encodings::BAYER_GBRG16; + else if (pixel_format == VmbPixelFormatBayerBG16 ) encoding = sensor_msgs::image_encodings::BAYER_BGGR16; else if (pixel_format == VmbPixelFormatRgb8 ) encoding = sensor_msgs::image_encodings::RGB8; else if (pixel_format == VmbPixelFormatBgr8 ) encoding = sensor_msgs::image_encodings::BGR8; else if (pixel_format == VmbPixelFormatRgba8 ) encoding = sensor_msgs::image_encodings::RGBA8; else if (pixel_format == VmbPixelFormatBgra8 ) encoding = sensor_msgs::image_encodings::BGRA8; - else if (pixel_format == VmbPixelFormatRgb12 ) encoding = sensor_msgs::image_encodings::TYPE_16UC3; - else if (pixel_format == VmbPixelFormatRgb16 ) encoding = sensor_msgs::image_encodings::TYPE_16UC3; + else if (pixel_format == VmbPixelFormatRgb12 ) { encoding = sensor_msgs::image_encodings::RGB16; scale_bitshift = 4; } //from_bits = 12; to_bits = 16; } + else if (pixel_format == VmbPixelFormatRgb16 ) encoding = sensor_msgs::image_encodings::RGB16; else ROS_WARN("Received frame with unsupported pixel format %d", pixel_format); if (encoding == "") return false; + + VmbUchar_t *buffer_ptr; VmbErrorType err = vimba_frame_ptr->GetImage(buffer_ptr); + bool res = false; if ( VmbErrorSuccess == err ) { + // Scale images to fit data type + if (scale_to_16_bits && scale_bitshift > 0) { + uint16_t* data_; + data_ = reinterpret_cast(buffer_ptr); + for (size_t i=0; i(buffer_ptr); + for (size_t i=0; i Date: Thu, 20 Oct 2022 16:12:10 -0400 Subject: [PATCH 10/11] Added SyncIn2 for external camera trigger --- src/avt_vimba_camera.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/avt_vimba_camera.cpp b/src/avt_vimba_camera.cpp index b54110d6..6c1a435e 100644 --- a/src/avt_vimba_camera.cpp +++ b/src/avt_vimba_camera.cpp @@ -192,7 +192,8 @@ void AvtVimbaCamera::start(std::string ip_str, std::string guid_str, bool debug_ if (trigger_source_int == Freerun || trigger_source_int == FixedRate || - trigger_source_int == SyncIn1) { + trigger_source_int == SyncIn1 || + trigger_source_int == SyncIn2) { // Create a frame observer for this camera SP_SET(frame_obs_ptr_, new FrameObserver(vimba_camera_ptr_, boost::bind(&avt_vimba_camera::AvtVimbaCamera::frameCallback, this, _1))); From 4223bc952698b44c97502e2cf443d9a8faeefb6f Mon Sep 17 00:00:00 2001 From: jake Date: Tue, 25 Oct 2022 22:20:55 -0400 Subject: [PATCH 11/11] 2021 field changes/bug fixes from kayak Fixed BGR12 and other pixel formats, sigint handler for ctrlc capture, default triggering rate, ROI, and several feature names. --- .gitignore | 79 ++++++++++++++---------- cfg/AvtVimbaCamera.cfg | 6 +- include/avt_vimba_camera/avt_vimba_api.h | 77 +++++++++-------------- src/avt_vimba_camera.cpp | 14 +++-- 4 files changed, 88 insertions(+), 88 deletions(-) diff --git a/.gitignore b/.gitignore index 335fe364..b24d71e2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,33 +1,50 @@ -# Specific files -src/VimbaCPP/ - -# Build objects -lib/ -bin/ -build/ -docs/ - -# Auto generated code -cfg/cpp/ -cfg/*.cfgc - msg_gen/ - msg/lisp/ - -# CMake files -CMakeCache.txt -cmake_install.cmake -CMakeFiles/ -src/*/Makefile -src/*/cmake_install.cmake -src/*/CMakeFiles/ - -# Eclipse temporary files -.cproject -.project -.pydevproject - -# ctags -.tags* -*/.tags* +# These are some examples of commonly ignored file patterns. +# You should customize this list as applicable to your project. +# Learn more about .gitignore: +# https://www.atlassian.com/git/tutorials/saving-changes/gitignore +# Node artifact files +node_modules/ +dist/ + +# Compiled Java class files +*.class + +# Compiled Python bytecode +*.py[cod] + +# Log files +*.log + +# Package files +*.jar + +# Maven +target/ +dist/ + +# JetBrains IDE +.idea/ + +# Unit test reports +TEST*.xml + +# Generated by MacOS +.DS_Store + +# Generated by Windows +Thumbs.db + +# Applications +*.app +*.exe +*.war + +# Large media files +*.mp4 +*.tiff +*.avi +*.flv +*.mov +*.wmv diff --git a/cfg/AvtVimbaCamera.cfg b/cfg/AvtVimbaCamera.cfg index df61f37c..0b4915db 100755 --- a/cfg/AvtVimbaCamera.cfg +++ b/cfg/AvtVimbaCamera.cfg @@ -103,7 +103,7 @@ gen.add("frame_id", str_t, SensorLevels.RECONFIGURE_RUNNING, "The gen.add("trig_timestamp_topic", str_t, SensorLevels.RECONFIGURE_STOP, "Sets the topic from which an externally trigged camera receives its trigger timestamps.", "") # ACQUISITION gen.add("acquisition_mode", str_t, SensorLevels.RECONFIGURE_STOP, "Camera acquisition mode", "Continuous", edit_method = acquisition_mode_enum) -gen.add("acquisition_rate", double_t, SensorLevels.RECONFIGURE_RUNNING, "Sets the expected triggering rate in externally triggered mode.", 2, 1, 30) +gen.add("acquisition_rate", double_t, SensorLevels.RECONFIGURE_RUNNING, "Sets the expected triggering rate in externally triggered mode.", 2, 0.001, 30) # TRIGGER gen.add("trigger_source", str_t, SensorLevels.RECONFIGURE_STOP, "Camera trigger source", "FixedRate", edit_method = trigger_source_enum) gen.add("trigger_mode", str_t, SensorLevels.RECONFIGURE_STOP, "Camera trigger mode", "On", edit_method = trigger_mode_enum) @@ -141,8 +141,8 @@ gen.add("binning_y", int_t, SensorLevels.RECONFIGURE_RUNNING, "Num gen.add("decimation_x", int_t, SensorLevels.RECONFIGURE_RUNNING, "Number of decimation operations in x.", 1, 1, 8) gen.add("decimation_y", int_t, SensorLevels.RECONFIGURE_RUNNING, "Number of decimation operations in y.", 1, 1, 8) # ROI -gen.add("width", int_t, SensorLevels.RECONFIGURE_RUNNING, "Width of the region of interest (0 for automatic).", 4096, 1, 6000) -gen.add("height", int_t, SensorLevels.RECONFIGURE_RUNNING, "Height of the region of interest (0 for automatic).", 4096, 1, 6000) +gen.add("width", int_t, SensorLevels.RECONFIGURE_RUNNING, "Width of the region of interest (0 for automatic).", 4112, 1, 4112) +gen.add("height", int_t, SensorLevels.RECONFIGURE_RUNNING, "Height of the region of interest (0 for automatic).", 4096, 1, 4096) gen.add("roi_width", int_t, SensorLevels.RECONFIGURE_RUNNING, "X offset of the region of interest.", 0, 0, 4095) gen.add("roi_height", int_t, SensorLevels.RECONFIGURE_RUNNING, "X offset of the region of interest.", 0, 0, 4095) gen.add("roi_offset_x", int_t, SensorLevels.RECONFIGURE_RUNNING, "X offset of the region of interest.", 0, 0, 4095) diff --git a/include/avt_vimba_camera/avt_vimba_api.h b/include/avt_vimba_camera/avt_vimba_api.h index 4ac3edcf..65ae7f73 100644 --- a/include/avt_vimba_camera/avt_vimba_api.h +++ b/include/avt_vimba_camera/avt_vimba_api.h @@ -111,77 +111,56 @@ class AvtVimbaApi { VmbUint32_t step = nSize / height; - // Scale images to fit data type - bool scale_to_16_bits = true; - int scale_bitshift = 0; - //bool scale_images_to_fit_data_type = true; - //uint8_t from_bits = 8; - //uint8_t to_bits = 8; - // NOTE: YUV and ARGB formats not supported std::string encoding; if (pixel_format == VmbPixelFormatMono8 ) encoding = sensor_msgs::image_encodings::MONO8; - else if (pixel_format == VmbPixelFormatMono10 ) { encoding = sensor_msgs::image_encodings::MONO16; scale_bitshift = 6; } // from_bits = 10; to_bits = 16; } - else if (pixel_format == VmbPixelFormatMono12 ) { encoding = sensor_msgs::image_encodings::MONO16; scale_bitshift = 4; } // from_bits = 12; to_bits = 16; } - else if (pixel_format == VmbPixelFormatMono12Packed ) encoding = "mono12_packed"; - else if (pixel_format == VmbPixelFormatMono14 ) { encoding = sensor_msgs::image_encodings::MONO16; scale_bitshift = 2; } // from_bits = 14; to_bits = 16; } + else if (pixel_format == VmbPixelFormatMono10 ) encoding = sensor_msgs::image_encodings::MONO16; + else if (pixel_format == VmbPixelFormatMono12 ) encoding = sensor_msgs::image_encodings::MONO16; + else if (pixel_format == VmbPixelFormatMono12Packed ) encoding = sensor_msgs::image_encodings::MONO16; + else if (pixel_format == VmbPixelFormatMono14 ) encoding = sensor_msgs::image_encodings::MONO16; else if (pixel_format == VmbPixelFormatMono16 ) encoding = sensor_msgs::image_encodings::MONO16; else if (pixel_format == VmbPixelFormatBayerGR8 ) encoding = sensor_msgs::image_encodings::BAYER_GRBG8; else if (pixel_format == VmbPixelFormatBayerRG8 ) encoding = sensor_msgs::image_encodings::BAYER_RGGB8; else if (pixel_format == VmbPixelFormatBayerGB8 ) encoding = sensor_msgs::image_encodings::BAYER_GBRG8; else if (pixel_format == VmbPixelFormatBayerBG8 ) encoding = sensor_msgs::image_encodings::BAYER_BGGR8; - else if (pixel_format == VmbPixelFormatBayerGR10 ) { encoding = sensor_msgs::image_encodings::BAYER_GRBG16; scale_bitshift = 6; } // from_bits = 10; to_bits = 16; } - else if (pixel_format == VmbPixelFormatBayerRG10 ) { encoding = sensor_msgs::image_encodings::BAYER_RGGB16; scale_bitshift = 6; } // from_bits = 10; to_bits = 16; } - else if (pixel_format == VmbPixelFormatBayerGB10 ) { encoding = sensor_msgs::image_encodings::BAYER_GBRG16; scale_bitshift = 6; } // from_bits = 10; to_bits = 16; } - else if (pixel_format == VmbPixelFormatBayerBG10 ) { encoding = sensor_msgs::image_encodings::BAYER_BGGR16; scale_bitshift = 6; } // from_bits = 10; to_bits = 16; } - else if (pixel_format == VmbPixelFormatBayerGR12 ) { encoding = sensor_msgs::image_encodings::BAYER_GRBG16; scale_bitshift = 4; } // from_bits = 12; to_bits = 16; } - else if (pixel_format == VmbPixelFormatBayerRG12 ) { encoding = sensor_msgs::image_encodings::BAYER_RGGB16; scale_bitshift = 4; } // from_bits = 12; to_bits = 16; } - else if (pixel_format == VmbPixelFormatBayerGB12 ) { encoding = sensor_msgs::image_encodings::BAYER_GBRG16; scale_bitshift = 4; } // from_bits = 12; to_bits = 16; } - else if (pixel_format == VmbPixelFormatBayerBG12 ) { encoding = sensor_msgs::image_encodings::BAYER_BGGR16; scale_bitshift = 4; } // from_bits = 12; to_bits = 16; } - else if (pixel_format == VmbPixelFormatBayerGR12Packed) encoding = "bayer_grrg12_packed"; - else if (pixel_format == VmbPixelFormatBayerRG12Packed) encoding = "bayer_rggb12_packed"; - else if (pixel_format == VmbPixelFormatBayerGB12Packed) encoding = "bayer_gbrg12_packed"; - else if (pixel_format == VmbPixelFormatBayerBG12Packed) encoding = "bayer_bggr12_packed"; - else if (pixel_format == VmbPixelFormatBayerGR16 ) encoding = sensor_msgs::image_encodings::BAYER_GRBG16; - else if (pixel_format == VmbPixelFormatBayerRG16 ) encoding = sensor_msgs::image_encodings::BAYER_RGGB16; - else if (pixel_format == VmbPixelFormatBayerGB16 ) encoding = sensor_msgs::image_encodings::BAYER_GBRG16; - else if (pixel_format == VmbPixelFormatBayerBG16 ) encoding = sensor_msgs::image_encodings::BAYER_BGGR16; + else if (pixel_format == VmbPixelFormatBayerGR10 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; + else if (pixel_format == VmbPixelFormatBayerRG10 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; + else if (pixel_format == VmbPixelFormatBayerGB10 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; + else if (pixel_format == VmbPixelFormatBayerBG10 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; + else if (pixel_format == VmbPixelFormatBayerGR12 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; + // dcasa: fixed BayerRG8 image encoding + else if (pixel_format == VmbPixelFormatBayerRG12 ) encoding = sensor_msgs::image_encodings::BAYER_RGGB16; + else if (pixel_format == VmbPixelFormatBayerGB12 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; + else if (pixel_format == VmbPixelFormatBayerBG12 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; + else if (pixel_format == VmbPixelFormatBayerGR12Packed) encoding = sensor_msgs::image_encodings::TYPE_32SC4; + else if (pixel_format == VmbPixelFormatBayerRG12Packed) encoding = sensor_msgs::image_encodings::TYPE_32SC4; + else if (pixel_format == VmbPixelFormatBayerGB12Packed) encoding = sensor_msgs::image_encodings::TYPE_32SC4; + else if (pixel_format == VmbPixelFormatBayerBG12Packed) encoding = sensor_msgs::image_encodings::TYPE_32SC4; + else if (pixel_format == VmbPixelFormatBayerGR16 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; + else if (pixel_format == VmbPixelFormatBayerRG16 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; + else if (pixel_format == VmbPixelFormatBayerGB16 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; + else if (pixel_format == VmbPixelFormatBayerBG16 ) encoding = sensor_msgs::image_encodings::TYPE_16SC1; else if (pixel_format == VmbPixelFormatRgb8 ) encoding = sensor_msgs::image_encodings::RGB8; else if (pixel_format == VmbPixelFormatBgr8 ) encoding = sensor_msgs::image_encodings::BGR8; else if (pixel_format == VmbPixelFormatRgba8 ) encoding = sensor_msgs::image_encodings::RGBA8; else if (pixel_format == VmbPixelFormatBgra8 ) encoding = sensor_msgs::image_encodings::BGRA8; - else if (pixel_format == VmbPixelFormatRgb12 ) { encoding = sensor_msgs::image_encodings::RGB16; scale_bitshift = 4; } //from_bits = 12; to_bits = 16; } - else if (pixel_format == VmbPixelFormatRgb16 ) encoding = sensor_msgs::image_encodings::RGB16; + else if (pixel_format == VmbPixelFormatRgb12 ) encoding = sensor_msgs::image_encodings::TYPE_16UC3; + else if (pixel_format == VmbPixelFormatRgb16 ) encoding = sensor_msgs::image_encodings::TYPE_16UC3; else ROS_WARN("Received frame with unsupported pixel format %d", pixel_format); if (encoding == "") return false; - - VmbUchar_t *buffer_ptr; VmbErrorType err = vimba_frame_ptr->GetImage(buffer_ptr); - bool res = false; if ( VmbErrorSuccess == err ) { - // Scale images to fit data type - if (scale_to_16_bits && scale_bitshift > 0) { - uint16_t* data_; - data_ = reinterpret_cast(buffer_ptr); - for (size_t i=0; i(buffer_ptr); - for (size_t i=0; i(config.gain_auto_outliers)); } if (config.gain_auto_rate != config_.gain_auto_rate || on_init_) { changed = true; - setFeatureValue("GainAutoOutliers", + setFeatureValue("GainAutoRate", static_cast(config.gain_auto_rate)); } if (config.gain_auto_target != config_.gain_auto_target || on_init_) { changed = true; - setFeatureValue("GainAutoRate", static_cast(config.gain_auto_target)); + setFeatureValue("GainAutoTarget", static_cast(config.gain_auto_target)); } if(changed && show_debug_prints_){ ROS_INFO_STREAM("New Gain config (" << config.frame_id << ") : "