Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user_defined_name and serial_number not implemented with Daheng MER2-503-23GM #471

Open
3 of 5 tasks
LVH-27 opened this issue Jul 14, 2024 · 0 comments
Open
3 of 5 tasks

Comments

@LVH-27
Copy link

LVH-27 commented Jul 14, 2024

Describe the Issue
When trying to create an ImageAcquirer instance with MER2-503-23GM, using the user_defined_name does not work.

The output of Harvester().device_info_list (after having added the CTI file for Ethernet cameras) looks like this:

[{'access_status': 1,
  'display_name': 'MER2-503-23GM(192.168.2.123[00-21-49-04-95-97])',
  'id_': 'MER2-503-23GM(00-21-49-04-95-97)',
  'model': 'MER2-503-23GM',
  'parent': <genicam.gentl.Interface; proxy of <Swig Object of type 'std::shared_ptr< GenTLCpp::TLInterface > *' at 0x7ad8ed53cbd0> >,
  'serial_number': None,
  'tl_type': 'GEV',
  'user_defined_name': None,
  'vendor': 'Daheng Imaging',
  'version': None}]

As you can see, user_defined_name and serial_number are set to None even though they have been set. So when I provide the search_key argument, the key does not match any of the cameras.

I don't think this is an issue with the cameras, as using gxipy's open_device_by_user_id() method works just fine, and when viewing the camera in GalaxyView, a GUI tool for interfacing with the cameras, the user-defined name is clearly visible and correct.

I was toying around with this in the shell, and I just wanted to print out harvester.device_info_list[0].user_defined_name, and then I got an exception by GenTL, saying that the feature is not implemented:

_gentl.NotImplementedException: GenTL exception: Requested operation not implemented.
(Message from the source: {-1003}{GetInfo:line[456]}{TLError:INFO ID 6 is out of range}) (ID: -1003)

The same approach works for another model of Daheng cameras that we use: MER2-503-36U3M. They are USB cameras, whereas the cameras with the issue are Ethernet cameras. Not sure if it matters, and these are the only cameras I have available a this point, so I cannot confirm or deny it, but I thought I'd mention it anyway.

I have tried it on both Linux and Windows, and I see the same issue.

Connecting to the camera using the id_ (which contains the otherwise-broken serial number, by the way) as the search key works just fine.

To Reproduce
Steps to reproduce the behavior:
Run the script below with a Daheng MER2-503-23GM (and possibly other models) camera connected.

  1. See error

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

  • Yes
  • No

If yes, please provide a sample code:

from pprint import pprint
from harvesters.core import Harvester
from genicam.gentl import NotImplementedException

harvester = Harvester()
harvester.add_file("./GxGVTL_linux.cti", check_existence=True, check_validity=True)

harvester.update()
device_info = harvester.device_info_list[0]
pprint(device_info)

try:
    print("Trying to use user defined name")
    search_key = {"user_defined_name": device_info.user_defined_name}
except NotImplementedException as e:
    print(e)
    print("Camera user defined name not implemented; trying to use camera ID")
    search_key = {"id_": device_info.id_}

print("Search key:", search_key)
image_acquirer = harvester.create(search_key=search_key)

The CTI file can be obtained by downloading the appropriate SDK from get-cameras. For Linux this is Galaxy_Linux-x86_Gige-U3_32bits-64bits_1.5.2303.9221/Galaxy_camera/lib/x86_64/GxGVTL.cti.

Script output

The output can be seen below. Note that I did change it a tiny bit manually because I cannot run it now and I had to go off my terminal scrollback. But the important parts are correct:

>>> python harvesters_user_defined_name_demo.py
GenTL producer does not implement DSGetNumBufferParts
GenTL producer does not implement DSGetBufferPartInfo
GenTL producer does not implement IFGetParentTL
GenTL producer does not implement DevGetParentIF
GenTL producer does not implement DSGetParentDev
GenTL producer does not implement DSGetNumBufferParts
GenTL producer does not implement DSGetBufferPartInfo

{'access_status': 1, 'display_name': 'MER2-503-23GM(192.168.2.123[00-21-49-04-95-97])', 'id_': 'MER2-503-23GM(00-21-49-04-95-97)', 'model': 'MER2-503-23GM', 'parent': <genicam.gentl.Interface; proxy of <Swig Object of type 'std::shared_ptr< GenTLCpp::TLInterface > *' at 0x7a8d093b9840> >, 'serial_number': None, 'tl_type': 'GEV', 'user_defined_name': None, 'vendor': 'Daheng Imaging', 'version': None}
Traceback (most recent call last):
  File "harvesters_user_defined_name_demo.py", line 21, in <module>
    if device_info.user_defined_name is not None:
  File "/home/rincewind/.local/share/virtualenvs/backend-ZnTbkLwg/lib/python3.8/site-packages/harvesters/core.py", line 225, in __getattr__
    return getattr(self._source_object, attribute)
  File "/home/rincewind/.local/share/virtualenvs/backend-ZnTbkLwg/lib/python3.8/site-packages/genicam/gentl.py", line 3569, in _get_user_defined_name
    return _gentl.DeviceInfo__get_user_defined_name(self)
_gentl.NotImplementedException: GenTL exception: Requested operation not implemented. (Message from the source: {-1003}{GetInfo:line[456]}{TLError:INFO ID 6 is out of range}) (ID: -1003)
Camera user defined name not implemented; trying to use camera ID

Expected Behavior
I expected the search_key to be defined without an issue, and then to create an instance of ImageAcquirer using that search key without an issue.

Configuration

  • OS: Linux 6.9.8 and Windows 11
  • Python: 3.8.18 (Linux) | 3.8.12 (Win11)
  • Harvester: [e.g. 1.4.2]
  • GenTL Producer: not sure how to answer this. I used the CTI files from get-cameras, as described above.
  • Camera: Daheng MER2-503-23GM

Reproducibility

This phenomenon can be stably reproduced:

  • Yes
  • No.

No matter what I do or which OS I use the script above on, I cannot use user-defined camera names to connect to the cameras. It works just fine with another library, and the names are visible in GalaxyView.

I have tried using the script above and I have tried the interactive Python shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant