photoneo-3d / photoneo-python-examples

BSD 3-Clause "New" or "Revised" License
9 stars 3 forks source link

h.device_info_list is empty #1

Closed OsamaAlAhmadieh closed 3 months ago

OsamaAlAhmadieh commented 9 months ago

Hello,

thank you for developing this library.

I am trying to run the examples, but it seems I can't get it running. The main problem it seems the device is not being discovered by the harvester. I am running on Ubuntu 22.04 in a Docker container. I am able to reach the camera from inside the docker container with ping .

I am mainly trying to run the GigEV examples. I installed the MATRIX_VISION GenTL producer and made sure that the environment variables are set correctly.

(.venv) vscode@6bc5d3bc4cac:/workspaces/photoneo$ echo $PHOXI_CONTROL_PATH
/opt/Photoneo/PhoXiControl-1.12.1
(.venv) vscode@6bc5d3bc4cac:/workspaces/photoneo$ echo $GENICAM_GENTL64_PATH
/opt/mvIMPACT_Acquire/lib/x86_64

I am also able to connect to the camera and trigger the Freerun from the PhoXiControl App UI on windows. All the commands need the device serial number to be triggered, but that I can get when I run the device_list_example.py. However, that is always returning an empty list. The following shows the output I am receiving from running the script:

(.venv) vscode@6bc5d3bc4cac:/workspaces/photoneo/photoneo-python-examples/GigEV/harvesters$ python3 basic/device_list_example.py 
Load .cti file...
/opt/mvIMPACT_Acquire/lib/x86_64/libmvGenTLProducer.so
[]

Here I was printing the cti_file_path to make sure that it is being read correctly, but then I noticed in the first run that it is providing the GenTL producer path, so I hardcoded the cti file path but I still got an empty list.

(.venv) vscode@6bc5d3bc4cac:/workspaces/photoneo/photoneo-python-examples/GigEV/harvesters$ python3 basic/device_list_example.py 
Load .cti file...
/opt/Photoneo/PhoXiControl-1.12.1/API/lib/photoneo.cti
[]

Furthermore, when I am trying to run the GenTL examples such as freerun.py. In the following lines, we can provide the Device ID as an argument. https://github.com/photoneo-3d/photoneo-python-examples/blob/899d74b65f927e9a805daff168585eb190e3f553/GenTL/freerun.py#L72C4-L74C40. I am getting the following error, although I provide the ID.

(.venv) vscode@6bc5d3bc4cac:/workspaces/photoneo/photoneo-python-examples/GenTL$ python3 freerun.py DEV-102
--> device_id:  PhotoneoTL_DEV_DEV-102
--> cti_file_path:  /opt/Photoneo/PhoXiControl-1.12.1/API/lib/photoneo.cti

Name : ID
---------

Traceback (most recent call last):
  File "/workspaces/photoneo/photoneo-python-examples/GenTL/freerun.py", line 178, in <module>
    freerun()
  File "/workspaces/photoneo/photoneo-python-examples/GenTL/freerun.py", line 95, in freerun
    with h.create({'id_': device_id}) as ia:
  File "/workspaces/photoneo/photoneo-python-examples/GenTL/.venv/lib/python3.10/site-packages/harvesters/core.py", line 2884, in create
    raise ValueError(compose_message(1, 1))
ValueError: no device found: provide sufficient search key

Any pointers / directions of debugging would be appreciated.

Thank you!

rtoth94 commented 9 months ago

Hello,

first, I would like to address some minor differences related to the GenTL/GigEV examples in this repository. The GenTL examples utilize the PhoXiControl API with the proprietary custom GenTL producer located at /opt/Photoneo/<PXC>/API/lib/photoneo.cti. On the other hand, the GigEV examples with Harvesters use the MatrixVision GenTL producers. (These examples were developed under version 2.49.0)

If you intend to use GigEV examples, your original output:

Load .cti file...
/opt/mvIMPACT_Acquire/lib/x86_64/libmvGenTLProducer.so`

is correct. Please ensure that your Docker container can detect the device on only one interface. I encountered similar errors when both ethernet and wireless networks were connected simultaneously, causing the device to be listed twice and resulting in connection issues.

Additionally, you can try linking the .so files directly by placing them in the photoneo-python-examples/GigEV/harvesters/basic/ folder:

libmvGenTLProducer.so -> libmvGenTLProducer.so.3
libmvGenTLProducer.so.3 -> libmvGenTLProducer.so.3.0.0
libmvGenTLProducer.so.3.0.0

If the issues persist, you may want to try running your Docker container with the --network=host option. This will allow the container to share the network namespace with the host, potentially resolving any connectivity or device detection problems.

I will test your setup with a Docker container to identify and address any additional problems that may be causing the reported issue. Thank you for providing feedback.

OsamaAlAhmadieh commented 9 months ago

Thank you for your prompt reply and for explaining the different between GenTL and GigEV. I want to use GigEV in my setting and therefore I will continue with the Matrix Vision GenTL producers. I have also made sure that my docker container can only detect the device on one interface (I disabled the wireless adapter). I have also tried running my docker with the --network=host option but still no luck. However, pinging the device still works. I have also tried copying the files to the photoneo-python-examples/GigEV/harvesters/basic/ folder, but still no luck in getting the device read. One more thing, in my case I am using WSL2 on windows, and running Docker on WSL2. This might be adding an extra layer of abstraction that is causing some problems. That said, I would also try running on Native linux, and checking. But any feedback would still be very much appreciated. Thank you !

rtoth94 commented 7 months ago

Hello, after some experimentation on Windows, we have developed a workaround, eliminating the need for a Docker container. Everything should now work seamlessly on Windows with the following tutorial:

  1. Download and install the package using the ImpactAcquire-x86_64-3.0.3.exe executable.
  2. The installer sets the GENICAM_GENTL64_PATH environment variable to C:\Program Files\Balluff\ImpactAcquire\bin\x64\ by default.
  3. Ensure the mvGenTLProducer.cti file is accessible, as it is essential for proper functioning.
  4. On Windows, it's important to disable the GigE Vision NDIS 6.x Filter Driver. c0a11570-800e-4c4f-9bd5-bfc83863f900
YueErro commented 6 months ago

Hello all,

I am experiencing the same issue of h.device_info_list being empty after following the tutorial of @rtoth94 😢.

I am executing the GigEv basic device_list_example.py from Windows 10 Pro through the git bash terminal with no luck: image I tried from cmd and powershell as admin user and neither finds anything and from GetTL the freerun.py works.

Could someone assist me please?

Thanks in advance.

patrikdaniel commented 6 months ago

Hi @YueErro, what is the FW version on the device you try to detect via device_list_example.py ?

You can check it in the Network Discovery window of PhoXi Control as Version

image

YueErro commented 6 months ago

Hi @patrikdaniel,

Indeed the old firmware version was the problem, after updating it, the device list is no longer empty and I can run the examples without problems, thank you very much!