Jan-17-2025, 08:47 AM
I have a python script that reads frames from an industrial camera, processes the images, and after that sends control signals to actuators inside the technical system. The setup is a proof-of-concept prototype, which is why I prefer to use Python for rapid prototyping.
Overall the script works fine, but a graphical user interface for monitoring and control of the process would be very helpful. Therefore, I would like to have a graphical interface that shows the most recent camera image (update rate of approx. 2 images per second), and also it should allow some basic interaction with mouse clicks and key presses, so that I can influence the control loop via the GUI.
Now I am thinking of two possible options:
1) Run the graphical user interface and the already developed python script as separate processes and communicate via TCP sockets.
2) Use Multithreading (especially QRunnable and QThreadPool from PyQt5) to setup parallel processing.
At the moment I'm leaning towards Option (1) because it seems that QRunnable and QThreadPool is not suited for bidirectional communication via signals [1].
Do you have a alternative ideas how to approach this problem? Or do you have arguments why option (1) or (2) might be better suited?
[1]: https://stackoverflow.com/a/61625408/7053480
PS: I already asked the question on StackOverflow [2], but it was closed because the question is too much based on opinions. However, I think it is difficult to rephrase the question without asking for opinions because in principle the problem can be solved in many different ways.
[2]: https://stackoverflow.com/questions/7936...ia-sockets
Overall the script works fine, but a graphical user interface for monitoring and control of the process would be very helpful. Therefore, I would like to have a graphical interface that shows the most recent camera image (update rate of approx. 2 images per second), and also it should allow some basic interaction with mouse clicks and key presses, so that I can influence the control loop via the GUI.
Now I am thinking of two possible options:
1) Run the graphical user interface and the already developed python script as separate processes and communicate via TCP sockets.
2) Use Multithreading (especially QRunnable and QThreadPool from PyQt5) to setup parallel processing.
At the moment I'm leaning towards Option (1) because it seems that QRunnable and QThreadPool is not suited for bidirectional communication via signals [1].
Do you have a alternative ideas how to approach this problem? Or do you have arguments why option (1) or (2) might be better suited?
[1]: https://stackoverflow.com/a/61625408/7053480
PS: I already asked the question on StackOverflow [2], but it was closed because the question is too much based on opinions. However, I think it is difficult to rephrase the question without asking for opinions because in principle the problem can be solved in many different ways.
[2]: https://stackoverflow.com/questions/7936...ia-sockets