-
Notifications
You must be signed in to change notification settings - Fork 1.2k
DRAFT: ZMQ messages from HALUI to GUIs #3580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Gstat sends out socket messages for jog rate
calls these functions in a GUI
This is a proof of concept to allow 3rd party (hal_bridge) to call macros. The macros are run from Gmoccapy so no timing problems should occur and and pre checks or post changes can be covered. There needs to be agreement on where to put macro definitions in the INI. Gmoccapy puts them under [MACROS], iniinfo under [DISPLAY] python ZMQ module package must be available for this to work
mdi commands with a comma in it (ie MSG, text) would not be interpeted properly
named INI MDI commands were not recognised.
you can use STATUS messages to 'press' ok or cancel
so you can use halui to accept the toolchange
so GUIs not basd in gobject can run the message system
|
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! |
|
test 1: test3: Modified coolant test: The first question is what do you think should be the right behavior? |
|
Test 1 Gmoccapy creates a button for the MACRO. It is possible to add an image to this MACRO. Unfortunately, the MACRO does not have HAL pins. That is why I do not use the MACRO. 2 ) halui.mdi_command - is part of the halui.cc code. The MDI command is defined in the INI file in section halui.mdi_command has HAL pins. Unfortunately, Gmoccapy does not create buttons for halui.mdi_command. I have to create them myself and connect them in the HAL file using net. 3 ) halui.gui_mdi_command - the MDI command is defined in the INI file in section I was bothered earlier that there were two things with a similar function (MACRO and halui.mdi_command) I hope halui.gui_mdi_command is just a temporary workaround.
Often used halui.mdi_command for ATC with carousel. Most often you have physical buttons from "M6 T1" to "M6 T10". When you are in manual mode and change the tool, you want to end up in manual mode as well. Test 3 I only see the problem in the unnecessary error message. If someone doesn't want to run halui.gui-mdi-command in AUTO mode, everybody can simply take care of it in HAL using the halui.mode.is-auto pin Coolant test
I use this coolant button to run the command self.command.wait_complete(30) because it is the easiest way for me to run this command in Gmoccapy. It is also the way LCNC developers can easily replicate this behavior.
I would leave the choice of the right behavior to the LCNC developers. But I will write you the conditions that should be met.
This should be decided by the LCNC developer. The developer should be able to implement both abort and stack. |
|
reading about your mode switch patch 2945. It requires you to connect HAL pins to detect if halui commands are running. This is a hacky way to fix the problem. I'm not criticizing you for coming up with it. The more you can avoid waitcomplete the better. It makes the GUI unresponsive.. For your tool buttons, could you not make oword files that just had the tool change gcode and then the macro button would be made to call the oword file? |
I dont need Gmoccapy MACRO. I need physical buttons. So I need run mdi_commands by HAL signal. |
The indicator shows state, so we don't need to chow checked state. in a real panel the buttons would be momentary buttons anyways
this must have been fix in master after I branched
|
I have been wanting to integrate Probe screen into Gmoccapy for a long time. I would like to split one glade screen into several glade screens and modify PNCconf so that LCNC configuration with Gmoccapy and ProbeScreen is one click away. The author of Probe screen also has problems with switching modes. I still don't see the benefits of ZMQ and I don't understand ZMQ. I would like to ask if it would be appropriate to integrate ZMQ into Probe screen? My point is that if I'm going to redo Probe screen, I want to do it properly. |
|
Yes you could send gcode via ZMQ. I don't know what the limits of the amount of data you could send at once. A version of versa probe is actually already in linuxcnc's repo: |
|
Seems I somehow missed that discussion. Just wanted to say I did a fairly complete POC to add a 0mq messaging layer parallel to NML, so you could run linuxcnc without any NML. see https://github.com/rmu75/linuxcnc/tree/rs/zmq-experiments. |
|
rmu75: c-morley:
I dont agree. I think that halui.mdi-command, versa-probe, ncam, ...... should have same interface for GUI. |
Proof of Concept. machinekit did add a bridge between NML and something 0mq/protobuf based, probably because they didn't want to touch the NML layer. I wanted to explore if replacing NML would be feasible. |
How well did it work? |
The interface can not resolve mode switching problems by it's self. Only the GUI programmer can do that. It certainly can ask the GUI to run some gcode, if that is what you want. |
I thought "interface" + "modification GUI for interface" should be same for halui.mdi-command, versa-probe, ncam, ...... I thought "modification GUI for interface" should resolve issues related to mode switching and race-conditions with other commands.
I want:
But I'm not a Gmoccapy developer, so it doesn't matter to me. |
basically it does work. I tested with a minimal debug-tool https://github.com/rmu75/cockpit/tree/rs/zmq in parallel to axis & co. Overhead is slightly higher than with NML, because zeromq doesn't have a shared memory transport, so everything is serialized/desrialized into a pipe, but nothing really noticable. The tedious part, extraction of all messages into IDL files and the writing the boilerplate code turned out to be relatively quick and easy. one central point needed changing of a pointer to std::unique_ptr because messages received via zeromq are dynamically allocated and need to be disposed of whereas NML messages always get copied to some static buffer. That change already is in master. 6d65386 The zeromq messaging layer would allow for some improved semantics of e.g. the error / warning channel, at the moment, only one consumer is allowed, if you connect more than one it is defacto undeterministic which one receives a message. |
|
A few notes: I don't know if the probe-screen in the LinuxCNC repository has been updated for Python3 / Gtk3. I did that task in a fork of a fork of psng: https://github.com/andypugh/probe-screen-ng There was a plan some time ago to replace NML with 0MQ/ZMQ. I recall a phone call from a meetup in Wichita to the original author of NML at NIST. He was astonishd that we were still using it and thought that switching to zmq was a good idea. But that got all tangled up in the Machinekit split, and I don't think that MK ever got round to doing it. |
|
@rmu75 |
|
In principle it could be merged as is, it can be run parallel to NML. Modulo bugs and things I missed. Some infrastructure / configurability and tests have to be done. Maybe alternatives to 0mq resp. flatbuffers should be evaluated before merging: (nanomsg, protocol buffers, capt'n'proto) -- flatbuffers seemed to have lower overhead compared to protobuf. |




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.