genicam / harvesters

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

Allied Vision camera first read always fails #154

Closed jmilloy closed 4 years ago

jmilloy commented 4 years ago

Describe the bug

After connecting to the camera (creating an ImageAcquirer), the first access always fails, no matter what it is. Subsequent io works, whether it is the same request or something else.

To Reproduce

Using an Allied Vision ALVIUM camera:

from harvesters.core import Harvester

h = Harvester()
h.add_file('/opt/mvIMPACT_Acquire/lib/x86_64/mvGenTLProducer.cti')
h.update()
ia = h.create_image_acquirer(0)
print(ia.remote_device.node_map.DeviceSerialNumber.value)

Expected behavior

The serial number should be printed

Observed Behavior

A GenTL io exception is raised:

Traceback (most recent call last):
  File "../test-harvesters.py", line 11, in <module>
    ia.remote_device.node_map.DeviceSerialNumber.value
  File "/home/jmilloy/miniconda3/envs/lmt/lib/python3.7/site-packages/genicam/genapi.py", line 2676, in _get_value
    return self._primal_get_value()
  File "/home/jmilloy/miniconda3/envs/lmt/lib/python3.7/site-packages/genicam/genapi.py", line 2652, in _primal_get_value
    return _genapi.IString__primal_get_value(self, Verify, IgnoreCache)
  File "/home/jmilloy/miniconda3/envs/lmt/lib/python3.7/site-packages/harvesters/_private/core/port.py", line 57, in read
    buffer = self.port.read(address, length)
  File "/home/jmilloy/miniconda3/envs/lmt/lib/python3.7/site-packages/genicam/gentl.py", line 5003, in read
    return _gentl.Port_read(self, address, buffer)
_gentl.IoException: GenTL exception: Communication error, read or write to remote device failed. (Message from the source: Could not read data from 0x144(64 bytes). System error: 0x00000000, bytes received: 0) (ID: -1010)

Desktop

Additional context

jmilloy commented 4 years ago

Is there just one more initialization step that I am missing? Or can we determine that this is a bug upstream (e.g. in the camera firmware)?

kazunarikudo commented 4 years ago

@jmilloy Hi, thank you for trying out Harvester. As far as I hear the symptom, I do not see any issue in your usage of Harvester. So I would suggest you the following idea: If you are involving cameras from several manufacturers, then try another version of MV's GenTL Producer. They have a website where you can download any version that they have released. Perhaps older versions do not reproduce the phenomenon but in general, they produce great software so I would not think they easily regress. However, sometimes it's cumbersome to tame USB3 host controllers or USB3 Vision devices/cameras in the transport layer level. Perhaps your host controller could be exposing an issue that MV has. If so, I would encourage you to report the issue to MV as a user; it's not bad deal, you use their software for free and they get an exposed issue that should be fixed. /Kazunari

jmilloy commented 4 years ago

Ok, after some more testing, I can see that I have errors independent of harvesters. VimbaViewer can enumerate, connect, and configure, but not acquire; mvDeviceConfigure can enumerate and connect, but not configure or acquire; harvesters with the vimba cti file can enumerate, configure, and acquire, but can't connect using the serial number; and harvesters with the mv cti file can enumerate and connect, but is unstable (different errors at different times). I'll keep digging, but it seems that harvesters is not the problem. Harvesters has actually been the most reliable! Thanks.

StefanD986 commented 4 years ago

Maybe this helps: I was using an Allied Vision camera sucessfully with the Matrix Vision GenTL producer (IIRC I installed mvGenTL_Acquire-x86_64-2.37.1.exe from http://static.matrix-vision.com/mvIMPACT_Acquire/)

jmilloy commented 4 years ago

@StefanD986 Yeah, that's what I'm using originally, but then I also tested the vendor producer and even the vendor GUI and still had problems. I'm going to try everything on Windows instead of Ubuntu Linux today.

kazunarikudo commented 4 years ago

Closing. Please feel free to re-open this when you get a clue that shows the issue is caused by Harvester.