Skip to content

Commit 8a17f78

Browse files
authored
Improves/updates/fixes indi-gige driver (#1338)
* remove compiler warnings of unused and unreturned values * Change indi-gige in prepartion to support multiple gige cameras This patch retains the camera device id (and model name) only as persistent, even while the camera is disconnected. The device id is used to open a handle to the camera and the model name is used with the device id to create a unique INDI device name to present to the user. * make indi-gige really disconnect from cameras * Several improvements to enable multiple cameras and models This patch makes several improvments preparing to handle multiple cameras and multiple models: 1. Much better error handling/logging for all calls to aravis library. 2. Uses device ID to idenfity cameras (includes vendor, model, serial) 3. Changes GigECCD class functions signatures: - adds virtual specifier to those functions that we override that are virtual--proper virtual specification is necessary to ensure the correct functions are called in all cases - adds "override" modifier to overridden functions for cleaner code. * Add device temperature to indi property and image info In general, GiGE cameras often have sensors onboard to measure sensor the temperature of the CCD/CMOS chip. This patch gathers this data if the camera claims that it has this information (using "DeviceTemperature" property). The temperature is added to the INDI panel display and also to the image metadata. * examine stream buffer queue status before looking at buffer * GiGe: update gain property following ccd simulator * GiGe: set expopsure start/duration for FITS header * do not overwrite ArvGeneric::cam->device id--retain enumerated value from arv_get_device_id() * GiGe: add pixel size property to allow for manual user config * GiGe: save Gain and PixelSize settings in config file * GiGe: minor simplification in setting deviceName * GiGe: implement streaming * GiGE: Fix binning At least for FLIR GiGE cameras, changing binning changes the apparent size of the chip, such that the region of interest is configured using a smaller number of pixels. This appears to be contrary to how INDI expects binning to be configured. Following the CCD Simulator (hopefully it is a decent example of implementing a INDI::CCD device), it rather appears that the region of interest is still expected to be set using the entire available Width/Height. It therefore appears necessary to mitigate this mismatch since (at least for ekos) the client appears to mess up the apparent image if binning is configured but a smaller region is selected, but in reality the entire avaialble sensor was binned. So, for now, even when binning is used, this patch makes the driver use the full WidthMax and HeightMax manually divided by the binning to select the region of interest. This means that any use of get_x_offset().val(), get_y_offset().val(), get_width().val(), or get_height().val() from the GigECCD::camera object must be manually multiplied or divided by the values from get_bin_x().val() and get_bin_y().val() as appropriate. Similarly, camera->set_geometry(...) must be given values that are divided by the appropriate binning. It remains to verify this behavior on GiGE cameras from other vendors, or at least to check what the standard says, if anything useful on the matter. * GiGE: update aravis-0.8 requirement, authors, version in xml * GigE: use unique_ptr to fix memory leak This patch changes GigECCD to handle the pointer to the underlying ArvCamera with a unqiue_ptr rather than a raw pointer. Prior to this patch, the GigECCD destructor did not delete the ArvCamera pointer. Using a smart pointer interface, this is handled much more carefully and memory leaks are avoided entirely. * GigE: enable multiple cameras This patch implements an iterator in the ArvFactory and creates device instances for all cameras found.
1 parent b0802f2 commit 8a17f78

11 files changed

Lines changed: 912 additions & 329 deletions

File tree

indi-gige/AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
Hendrik Beijeman (hbeyeman@gmail.com) http://phym.nl
2+
Spencer E. Olson (olsonse@umich.edu)

indi-gige/README

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Requirements
1515

1616
cfitsio-devel is required to compile support for FITS.
1717

18-
+ aravis >= v0.6
18+
+ aravis >= v0.8
1919

2020
aravis is required, see https://github.com/AravisProject/aravis
2121

@@ -57,9 +57,9 @@ GigE machine vision overview
5757
(2b) Vendor specific set
5858

5959
Project Aravis only uses genicam standard. For some features you need to
60-
access the CSR directly. These can easily be queried with arv-tool-0.6 that come
60+
access the CSR directly. These can easily be queried with arv-tool-0.8 that come
6161
with aravis, i.e.
62-
$ arv-tool-0.6 control R[0xF0F00A00] R[0xF0F00A04] R[0xF0F00A08] R[0xF0F00A10] R[0xF0F00A14]
62+
$ arv-tool-0.8 control R[0xF0F00A00] R[0xF0F00A04] R[0xF0F00A08] R[0xF0F00A10] R[0xF0F00A14]
6363

6464
Point Grey Research-16048874
6565
R[0xf0f00a00] = 0x08000600

indi-gige/indi_gige_ccd.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<devGroup group="CCDs">
22
<device label="GigE CCD" mdpd="true">
33
<driver name="GigE CCD">indi_gige_ccd</driver>
4-
<version>0.1</version>
4+
<version>0.2</version>
55
</device>
66
</devGroup>
77

indi-gige/src/ArvFactory.cpp

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,49 @@
2626

2727
#define BLACKFLY_MODEL "BFLY-PGE-31S4M"
2828

29-
arv::ArvCamera *ArvFactory::find_first_available(void)
29+
namespace arv {
30+
std::unique_ptr<arv::ArvCamera> create_camera(unsigned int index)
31+
{
32+
if (index >= arv_get_n_devices())
33+
/* no devices found */
34+
return nullptr;
35+
36+
const char *device_id = arv_get_device_id(index);
37+
const char *model_name = arv_get_device_model(index);
38+
39+
if (memmem(model_name, strlen(model_name), BLACKFLY_MODEL, strlen(BLACKFLY_MODEL)))
40+
{
41+
printf("Creating BlackFly... for %s-%s\n", model_name, device_id);
42+
return std::unique_ptr<ArvCamera>(new BlackFly(device_id, model_name));
43+
}
44+
else
45+
{
46+
printf("Creating Generic... for %s-%s\n", model_name, device_id);
47+
return std::unique_ptr<ArvCamera>(new ArvGeneric(device_id, model_name));
48+
}
49+
}
50+
}
51+
52+
std::unique_ptr<arv::ArvCamera> ArvFactory::find_first_available(void)
53+
{
54+
/* We first ensure the library knows of all available devices and info */
55+
arv_update_device_list();
56+
return create_camera(0);
57+
}
58+
59+
ArvFactory::Iterator ArvFactory::begin(void)
60+
{
61+
/* We first ensure the library knows of all available devices and info */
62+
arv_update_device_list();
63+
return ArvFactory::Iterator(0);
64+
}
65+
66+
ArvFactory::Iterator ArvFactory::end(void)
67+
{
68+
return ArvFactory::Iterator(arv_get_n_devices());
69+
}
70+
71+
std::unique_ptr<arv::ArvCamera> ArvFactory::Index::instantiate(void) const
3072
{
31-
GError *error = NULL;
32-
::ArvCamera *camera = arv_camera_new(nullptr, &error);
33-
const char *model_name = arv_camera_get_model_name(camera, &error);
34-
35-
if ((camera == nullptr) || (model_name == nullptr))
36-
return nullptr;
37-
38-
if (memmem(model_name, strlen(model_name), BLACKFLY_MODEL, strlen(BLACKFLY_MODEL)))
39-
{
40-
printf("Creating BlackFly...\n");
41-
return new BlackFly((void *)camera);
42-
}
43-
else
44-
{
45-
printf("Creating Generic...\n");
46-
return new ArvGeneric((void *)camera);
47-
}
73+
return create_camera(this->index);
4874
}

0 commit comments

Comments
 (0)