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! |
|
@hansu I (again) think this is ready. Do you wish to test comment before I push? |
|
I could shrink the Gmoccapy commits to one if you like, but I think it could be used to show how each feature was set up. It's a lot of code touched. I started with about 120 commits. The problem comes if you reorder them to combine, then you can break git bisect. I have then down to 66 now. I'm not sure what to do with the shutdown dialog. |
0e87ac8 to
1045bf9
Compare
I am using Debian Trixie from the LinuxCNC ISO for developing and I guess most users use this.
No I think it's fine how you have it now, thanks!
Let me have a try if there is possibility to get this dialog wider. Otherwise I suggest to shorten the text. |
I haven't found a nice way to fix this. I suggest to increase the minimal window width of the dialog with: dialog.set_size_request(300, -1)in |
|
@c-morley why did you commit all your commits of this PR directly to master ?? |
|
It was convient to push directly. Why does it matter? The conflicts from other code come either way. |
Then I wonder why do we have PRs and the review mechanism? It also makes it easier to track the changes. |
|
You reviewed the code. This was the feature branch. I merged it. I push directly all the time. This was different strictly because I wanted others to look at the code and give suggestions and you did. |
But I didn't finally approve it. For example the docs lacks some information resp. they doesn't match the function. And you did NOT merge it. You cherry-picked your commits detached to master.
Because it's a very big change which affects several GUIs AND if you open a PR one would expect the feature doesn't silently go in on another way. |
|
If you had indicated you wanted me to wait then I would have. You told me issues I fixed all of them and said I was ready to push this. I rebased the commits on top of master so they all were in a row. I almost always do that. There were no conflicts. The unspoken pull request etiquette is new to me. I am sorry this didn't work out as we hoped. It was not intentional to screw anybody up. |
|
That was.... unexpected. @BsAtHome is in the midst of a massive refactoring / change of the HAL interfaces, it's probably not the best time to introduce new stuff that uses the old API. |
|
I put a commit on top to be able to merge it that it has at least the state "merged" in GitHub. (Which might wasn't the best idea). However, the original commits are: d0ac241 qtvcp -pushbutton: fix setting of group pin type |
I think nobody should be pushing directly to master. It is a serious problem that can take everybody off-guard. We have an established review process using PRs and those are generally merged when it is agreed upon. At least they give everybody a fair chance to look at the proposal and have their say if they wish to do so. FWIW, it has bothered me before that there are out-of-PR commits to master. There is only a justification to do so on the very rare occasion when there is a serious problem. For everything else, we should all adhere to the PR process. Besides, we would also have squashed the commits. |
|
I have turned on branch protection, and reverted the changes, Please open a new PR. |
|
the merge button is gone from all PRs? |
|
no, but the branch needs to be rebased, and the rip-and-test needs to pass. I also send a mail to emc-developers. |
|
I'm not sure there was an agreement on reverting, at least not that I can read here, am I safe to rebase my PRs now? or should I wait till this settle to avoid doing it twice? |
|
I am definitely more then annoyed about this behavior. Branch protection? |
|
@grandixximo the same thing happend before, if the branch was out of date. you can click on the arrow and rebase. Please continue this conversation in the discussion area, or on emc-developers. |











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.