Need help with Qtvcp/Camview+GigE camera
- MatroskinTom
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
03 Feb 2023 09:41 #263588
by MatroskinTom
Need help with Qtvcp/Camview+GigE camera was created by MatroskinTom
Hello!
I am new in Python programming, Linux and LinuxCNC. I am currently trying to build my CNC laser cutting machine using LinuxCNC. My machine will use a Lucid TRIO81S GigE camera for precision targeting. I decided to use the Harvesters library ( github.com/genicam/harvesters ) to work with this camera and get images since it supports a lot of other cameras from different manufacturers. I use qtdragon_hd as interface and changed the camview_widget.py code a bit to capture images with Harvesters.
But there is one problem with this: when I run my image capture test program, everything works fine. But when I try to do it inside LinuxCNC, at moment when I activate the "CAMVIEW" tab, the program crashes. Running the LinuxCNC project in the terminal, I see an error, which is displayed when the program crashes:
I tried running different screens: qtdragon, qtdragon_hd, separately cam_align plugin - the result is the same. But when I run camview_widget.py directly in the terminal, it works correctly. So the problem is not with camview_widget.
Can someone help me with this and tell me what the problem is and how to fix it? Thanks in advance!
My work environment:
Linux Mint 21 with 5.19.0-2-rt-amd64 kernel
LinuxCNC 2.9.0~pre0
Python 3.10.9
P.S. Sorry for my English, I use translator.
I am new in Python programming, Linux and LinuxCNC. I am currently trying to build my CNC laser cutting machine using LinuxCNC. My machine will use a Lucid TRIO81S GigE camera for precision targeting. I decided to use the Harvesters library ( github.com/genicam/harvesters ) to work with this camera and get images since it supports a lot of other cameras from different manufacturers. I use qtdragon_hd as interface and changed the camview_widget.py code a bit to capture images with Harvesters.
But there is one problem with this: when I run my image capture test program, everything works fine. But when I try to do it inside LinuxCNC, at moment when I activate the "CAMVIEW" tab, the program crashes. Running the LinuxCNC project in the terminal, I see an error, which is displayed when the program crashes:
I tried for a long time to fix the problem and found the following: Harvesters kernel code uses exception handling logic in several places.(code samples in attached files). When I run my test program, these exception handling blocks work correctly. But when I run Harvesters functions inside camview_widget.py code, the exceptions are not caught in the try-except blocks inside the Harvesters kernel, but cause a critical error and LinuxCNC to terminate.terminate called after throwing an instance of 'GenTLCpp::InvalidHandleException'
what(): Given handle does not support the operation.(Message from the source: Invalid handle....
I tried running different screens: qtdragon, qtdragon_hd, separately cam_align plugin - the result is the same. But when I run camview_widget.py directly in the terminal, it works correctly. So the problem is not with camview_widget.
Can someone help me with this and tell me what the problem is and how to fix it? Thanks in advance!
My work environment:
Linux Mint 21 with 5.19.0-2-rt-amd64 kernel
LinuxCNC 2.9.0~pre0
Python 3.10.9
P.S. Sorry for my English, I use translator.
Please Log in or Create an account to join the conversation.
03 Feb 2023 18:29 - 03 Feb 2023 18:35 #263615
by cmorley
Replied by cmorley on topic Need help with Qtvcp/Camview+GigE camera
Can you post the modified cam_view.py file please.
Last edit: 03 Feb 2023 18:35 by cmorley.
Please Log in or Create an account to join the conversation.
- MatroskinTom
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
04 Feb 2023 12:50 #263670
by MatroskinTom
Replied by MatroskinTom on topic Need help with Qtvcp/Camview+GigE camera
Here is the modified file. I know my code is bad, sorry. But I just want to test the camera work for now. When it starts working, I want to write proper good code.
Please Log in or Create an account to join the conversation.
04 Feb 2023 18:36 #263684
by cmorley
Replied by cmorley on topic Need help with Qtvcp/Camview+GigE camera
I can't test so please see if this makes any difference.
Please Log in or Create an account to join the conversation.
- MatroskinTom
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
06 Feb 2023 15:55 #263841
by MatroskinTom
Replied by MatroskinTom on topic Need help with Qtvcp/Camview+GigE camera
Thanks for your help, Chris!
Sorry for taking so long to respond, just today at work I was able to test your solution. Unfortunately, the result is the same, the exception is not caught in the try-except block. I tried wrapping all internal update() calls with try-except block, but no exception was caught anywhere. Could it be that this problem is related to multiple threads? If I understand correctly, the qtvcp kernel and possibly LinuxCNC use multi-threaded programming, right? It seems that somehow this "scheduled" error is not handled by the try-except block in the Harvesters kernel code and goes up, where it causes the process to terminate...
Sorry for taking so long to respond, just today at work I was able to test your solution. Unfortunately, the result is the same, the exception is not caught in the try-except block. I tried wrapping all internal update() calls with try-except block, but no exception was caught anywhere. Could it be that this problem is related to multiple threads? If I understand correctly, the qtvcp kernel and possibly LinuxCNC use multi-threaded programming, right? It seems that somehow this "scheduled" error is not handled by the try-except block in the Harvesters kernel code and goes up, where it causes the process to terminate...
Please Log in or Create an account to join the conversation.
Moderators: cmorley
Time to create page: 0.066 seconds