DRAFT: ZMQ messages from HALUI to GUIs - #3580
Conversation
| FIELD(hal_bit_t,program_is_running) /* pin for notifying user that program is running */ \ | ||
| FIELD(hal_bit_t,halui_mdi_is_running) /* pin for notifying user that halui MDI commands is running */ \ | ||
| FIELD(hal_bit_t,program_is_paused) /* pin for notifying user that program is paused */ \ | ||
| FIELD(hal_bit_t,cycle_start) /* pin for running program */ \ |
There was a problem hiding this comment.
/* pin for running program */
I think, this is ctrl+c ctrl+v bug.
What is different between cycle and program?
|
What is the "HALBRIDGE = hal_bridge" command in an ini file good for? In some ini files you use it, in some you don't, and in some it is commented out. |
|
Feel free to tell me what I should focus on in testing. |
|
Thank you for testing - I will try to answer your questions. Yes the control panel was just for basic testing, it would be nice to come up with a list of 'standard' buttons that each GUI would be expected to support. each GUI requires some code work to fully integrate. Dialog control is for the popup dialogs such as tool change or warnings. I believe I only coded Qtdragon to respond for manual tool changes and warnings when unpausing the spindle when the spindle is auto lifted. Panel.ui is just for testing the basic code - I have put no thought into final naming and most likely would build a gladevcp based panel for gmoccapy. I just copied and pasted for speed. program_run starts the program thru linuxcnc's command channel (so bypasses the GUI). I would be interested if HALUI INI MDI commands work better when they are a 'request' form HALUI for the GUI to run them. As I remember, you had some timing problems in Gmoccapy. |
|
I see the MDI buttons work in the gmoccapy test panel. Can you simulate the problem you had with HALUI MDI commands? |
|
I had three problems: |
|
I think both problems are improved by using this halui technique. I'll be interested in what you find. |
|
Hi, I need to explain more what is the goal of implementing ZMQ? I studied the codes of this PR today. I am even more confused. Previously, there were halui.mdi_commands in halui. These commands were triggered by the hal signal. The halui.cc file switched modes and triggered MDI commands. That was it. Now there is halui.gui.mdi-command-MACRO0. These commands are triggered by the hal signal as well. |
|
The HALUI pin halui.gui.mdi-command-MACRO0 uses ZMQ messages to request the GUI to run the commands it's self. The best place to make sure mode changes and widget changes that are in sync with the MDI commands is the GUI. HALUI is probably the most common way to connect a panel to the GUI, but because it thinks it's the only UI, some things like MDI and jogging do not work so well. HALUI and bridge are really the same program. Bridge is a python library pulled into HALUI. Gmoccapy use the library qtk_action to run the INI macro command. The key here is that Gmoccapy is the one that runs the INI macro command, so it can be programed to set appropriate widgets and modes without having to worry about what HALUI is doing. |
Not gtk_action.py? |
|
Thank you for picture. Right now, I can only be your rubber duck until I understand the whole thing.
@Sigma1912 made something similar #3504 Why is bridge just a library? Could you describe to me better how MACRO0 works when using Gmoccapy? MOTION CONTROLLER is still some kind of abstract thing for me. Which specific files are these? gtk_action.py / qtk_action.py should be in the GUI image. |
I miss spelled gtk_action |
|
ZMQ is not realtime.
gtk_action is just a library of python functions for doing GUI related chores such as sending MDI commands defined in the INI. bridge is part of HALUI, it extends HALUI to do the new functions. It can not work without HALUI. While there are other ways to work around these problems, I believe this is better and also it covers all the GUIs (when it;s finished) and a consistent interface for users. To summarize: |
Is NML realtime? |
|
Do you think that HAL between GUI and HALUI should be replaced by ZMQ in the future? |
|
Possibly but certainly not necessarily. I think the things that are very standard (say jogging, axis selection) are better done in standard way (in this case I chose HALUI) that does not require connecting HAL pins. I would bet that non standard things would still be added using HAL pins - it's easy to do |
|
Well I said without connecting HAL pins, but I meant not connecting HAL pins from the GUI to HALUI, you still connect some HAL pins in HALUI, say for a control panel. |
|
I always wondered why we need NML or ZMQ when theoretically we could be done via HAL? |
|
Outside my cone of hard knowledge, but as I under stand it, NML is a Neutral Message Layer for networking. I believer the idea was the GUI, IO controller and motion controller could be on different computers. Certainly the GUI side could be networked at one time. |
|
What advantages does ZMQ have over HAL? |
|
In this case, zmq automically connects the gui to halui and any other program that registers to it. This creates consistent information in the system and a consistent connection path for doing jogging or axis selection. |
|
Thank you for explaining your thoughts. Now I can get back to testing. My test procedure: Test number 1: Test number 2: Test number 3: |
|
For another test: You must modify in INI file: You must modify in gmoccapy.py My test procedure: Old mdi_commands make errors: New gui_mdi_commands can be broken by another python command without any message. |
|
Ok Excellent notes. Thank you for testing! |
yo gui.response.ok gui.response.cancel
do to halui name change
do to halui name change
do to halui name change
pulls in gstat and iniinfo libraries
incorporated in axis now
selection by HAL pins should keep working.
|
@hansu : not sure if you saw my discussion of your point above.
How about halui.gui.mpg-aux.0 |
|
Thanks for adopting my ideas :)
Ah ok, then it's fine.
Can we pull this out into another PR or it this too much work?
👍
👍
Better indeed. Let's keep it. But why the .0 at the end? Will halui create .1, .2 ... if there are more MPGs configured?
I think halui should not create own dialogs which this function does.
'response' is fine, but I didn't like them "floating"
It does not crash anymore now, but this removes the 'x' from all dialogs. I know that's not really needed but is convenient some time. I discovered a further bug regarding dialogs. It cannot display the warning when trying to load a g-code file which contains a tool that is not in the tool table:
👍
Ok I didn't know these were only relicts from testing. |
|
Thanks for the suggestions!
It would be a bit of work but also, if we pull this out then neither type of MDI command is usable with HALUI and if we pull one type out, then one GUI doesn't get it's style. If we later combine then, HALUIs pin names will mot likey not change.
It's possible that later we might add a second pin for other optional features (scroll, zoom, pan?) then I don't need to have gui.mpg-aux and gui.mpg-aux.1
I'll look if there is a way to keep the X
It cannot display the warning when trying to load a g-code file which contains a tool that is not in the tool table: I discovered more function signatures wrong for warning dialogs too and fixed them.
I am not sure what you mean. HALUI doesn't create a dialog, gmoccapy does. Thanks! |
I guess to be more specific Gmoccapy calls a gladevcp action to shutdown the system. The action builds the dialog. It's quite possible to build the dialog in Gmoccapy's dialog library if needed. |
dialog returns True/False not Gtk enums
TRhey are the same as a negative response
and make gladevcp action's optional
HALUI code supercedes it









This is the on going work started here:
#3528
This generalizes the idea for messages.
There are three proof of concept sims:
axis_halui_test.ini
gmoccapy_halui_test.ini
qtdragon_halui_test.ini
They will load the respective gui and a separate simulated control panel.
You can notice the jograte slider on the control panel changes the jog rate on the gui.
I would love it if someone could test these rough changes.