genicam / harvesters

Image Acquisition Library for GenICam-based Machine Vision System
Apache License 2.0
524 stars 91 forks source link

FLIR GEV crash in _retrieve_file_path #441

Open enp6s0 opened 10 months ago

enp6s0 commented 10 months ago

Describe the Issue Cannot create acquirer with FLIR GEV cameras, apparently due to an option parsing error

To Reproduce Steps to reproduce the behavior:

  1. Try to create an acquirer using the following code with FLIR GigE vision cameras

Sample Code I can show a piece of code that demonstrates the reported phenomenon:

# Simplified version
h = Harvester()
h.add_file(cti) # cti points to actual GenTL producer under /opt/spinnaker
h.update()

acquirer = h.create({"serial_number" : "xxx"}) # seems to fail here
acquirer.start()

Traceback

Traceback (most recent call last):
  File "/work/gev.py", line 123, in __init__
    self.acquirer = self.harvester.create({"serial_number" : cam_serial})
  File "/usr/local/lib/python3.10/dist-packages/harvesters/core.py", line 3085, in create
    return self._create_acquirer(device_proxy=device_proxy, config=config)
  File "/usr/local/lib/python3.10/dist-packages/harvesters/core.py", line 3115, in _create_acquirer
    ia = ImageAcquirer(device_proxy=device_proxy_, config=config,
  File "/usr/local/lib/python3.10/dist-packages/harvesters/core.py", line 1632, in __init__
    self._remote_device = RemoteDevice(
  File "/usr/local/lib/python3.10/dist-packages/harvesters/core.py", line 486, in __init__
    super().__init__(
  File "/usr/local/lib/python3.10/dist-packages/harvesters/core.py", line 281, in __init__
    self.node_map = self._create_node_map(
  File "/usr/local/lib/python3.10/dist-packages/harvesters/core.py", line 320, in _create_node_map
    clean_up_required, file_path = self._retrieve_file_path(
  File "/usr/local/lib/python3.10/dist-packages/harvesters/core.py", line 390, in _retrieve_file_path
    file_name, address, size = others.split(';')
ValueError: too many values to unpack (expected 3)

I've tried dumping out others, and it seems that the offending input is:

GRS_GEV_v003_189150.zip;7F1D0040;7959GRS_GEV_v003_181950.zip;7F1D0040;7959

Other inputs seems fine:

SFNC_GenTLSystem_Version_1_0_0_Schema_1_1.xml;42c1d80;74a3
SFNC_GenTLInterface_GigE_Version_1_0_0_Schema_1_1.xml;42c1d80;d58a
SFNC_GenTLInterface_GigE_Version_1_0_0_Schema_1_1.xml;42c1d80;d58a
SFNC_GenTLInterface_GigE_Version_1_0_0_Schema_1_1.xml;42c1d80;d58a
SFNC_GenTLInterface_GigE_Version_1_0_0_Schema_1_1.xml;42c1d80;d58a
SFNC_GenTLInterface_Usb3_Version_1_0_0_Schema_1_1.xml;42c1d80;6867

Expected Behavior Harvesters should be able to connect to the camera and get image frames

Configuration

Reproducibility

This phenomenon can be stably reproduced:

Actions You Have Taken

enp6s0 commented 10 months ago

As a workaround, I patched the parser to disregard extra parameters and trim the size variable... a hacky solution but it does work:

try:
    file_name, address, size = others.split(';')
except ValueError:
    splitted = others.split(';')
    file_name = splitted[0]
    address = splitted[1]
    size = splitted[2][:4]