Architecture LinuxCNC-block-diagram - update - #3718
Conversation
|
I am surprised to see spindles in EMCIO. I am pretty sure those are in EMCMOT. So the whole EMCIO block is probably not there any more. |
|
I am interested only aboat 2.10 version. I made quick modification:
If I understand correctly, here are the HAL pins of the TASK: linuxcnc/src/emc/task/taskclass.cc Lines 46 to 70 in 764655e |
|
Yes, though the lube pins don't exist any more. (They didn't have any useful behaviour) The tool-change pins are missing from the diagram. (change / changed and number for both tools and pockets). They always have been despite being the main point of emcio. |
|
@c-morley disagrees with me that HALUI should not be associated with GUI
I understand the functional reasons, but I would be interested in others' opinions from the perspective of preserving the architecture. |
|
If we are going to replace this diagram I suggest to
|
|
HALUI should not really be in this view. |
Do you have a model of what you would like the LCNC architecture to look like? Do you know of any open-source projects with architecture? Do you prefer graphviz or mermaid? I have no experience with software architecture, but I am convinced that we need it. At least do it in reverse. |
HALUI is part of LCNC. It is an inseparable part of Gmoccapy. We can discuss:
I am interested in both states. How it is and how it should ideally be. I want to update this picture mainly because of HALUI. HALUI is a specific component and therefore I would like to know its current function and whether we want to continue using it this way. The abbreviation HALUI is "HAL User Interface", but at the moment HALUI serves more as an engine for Gmoccapy. If I removed HALUI from the architecture, I would de facto stick my head in the sand like an ostrich. Maybe no one will want to discuss it. |
|
I didn't find the source of the architecture diagram, I guess at some point in time it originated in xfig. Some translations also translated this diagram and even colorized it. With a vector format, we could do better and make that consistent. I played around a bit with draw.io, will attach a draft later. |
|
This diagram is to show the basic architecture of linuxcnc. It is not to show a typical setup. HALUI is equivalent to the GUI and so just adds detail that is not needed. I would suggest making another diagram that shows a typical setup maybe including Mesa card/ spindle control/ ethernet servo? In this diagram one might show task/motion as just one box called motion controller. If Gmoccapy requires HALUI to be useful then IMHO a undisearable limiting choice has been made. One should be able to use a different program the HALUI such as panelui or a custom program. |
It is.
It really shouldn't be.... I am curious what Gmoccapy relies on in HALUI that isn't available to it from the Python interface? Maybe this is a throwback to the fact that Mocca was written in Pascal ( https://forum.linuxcnc.org/41-guis/1813-new-gui-for-emc-available-for-testing?limit=6&start=0#1813 ) and we have no LinuxCNC Pascal interface. |
I agree that some of the HAL pins created in Gmoccapy make sense, for example this: linuxcnc/src/emc/usr_intf/gmoccapy/gmoccapy.py Lines 6188 to 6197 in 781023e But creating pins like these seems weird to me: linuxcnc/src/emc/usr_intf/gmoccapy/gmoccapy.py Lines 6271 to 6276 in 781023e For the other pins created by Gmoccapy, I can't determine whether they are there just because of Python interface shortcomings, or whether they have a purpose.
I dont know what is available to it from the Python interface. Here are halui pins in Gmoccapy: linuxcnc/src/emc/usr_intf/gmoccapy/gmoccapy.py Lines 3797 to 3812 in 781023e I don't know if this is about using hal signals in the glade file. But they are called hal: linuxcnc/src/emc/usr_intf/gmoccapy/gmoccapy.glade Lines 180 to 202 in 781023e |
I guess I'm wrong. Gmoccapy uses a function named "def _update_halui_pin(self):" , but it doesn't use halui pins. Edit: |
|
To rmu75: |
|
My two cents, while draw.io has been around for a while mermaid or LaTeX might be preferable so it can be maintained with the source code. |
|
I redrawn the diagram in drawio. linuxcnc.architecture.drawio |
|
I don't think that there is a PID in Motion, the ones I know of are in HAL components. (there is a simple one in stepgen as well as the the standalone PID) |
(Possibly spindle-synch motion) |
|
Again, I believe you are adding too much information for what this diagram is for. |
spindle sync does not use PID |
|
I must say though - the drawings do look much nicer! |
|
That really starts to look very nice -- thanks a lot!. Some comments:
|
|
Now I'm at the stage where I redrawn the image in drawio and added HALUI there. I consider adding HALUI very important because many Pull Requests are created that do not respect the original concept of HALUI and GUI. I myself was confused about this, thinking that HALUI was part of Gmoccapy. There may be a change, for example, HALUI may be canceled, or HALUI and GUI may communicate with each other, or ...... But now at least we have the current state. I've done the simplest thing. The difficult part is just beginning. Chris:
Give me a chance to convince you that the amount of information I want to put in this diagram is right. I understand that the more information I put in this diagram, the more work I will have to maintain it. On the other hand, I believe that the maintenance of this diagram outweighs its benefits. I expect that developers will contact me and I will modify the diagram in the future. If I stop enjoying it, it will be easy to simplify the diagram. Chris:
I agree. I made extra diagram for integrators and begginers. #3738 rmu75:
I would be happy if you could help me with this. rmu75:
I thought so, but I didn't solve it during the phase of redrawing the diagram into drawio. rmu75:
My goal is to make a diagram where the heart of LCNC is the TASK module and the interface is the HAL layer. This diagram should be intended mainly for developers. Moreover, the boundary from TASK to HAL is always the same, or similar. The boundary from HAL to hardware is unique for each integration. I do not want to draw the boundary from HAL to hardware here, or only very simplified as in the upper part of the figure (non-realtime hardware). I want to delete the lower part of the figure "Example of Hardware". I think that most LCNC applications do not use an encoder on the axis. If someone wants to draw a diagram for integrators with specific hardware, I can do it, but it would be another diagram tied to this core. |
just remove "NML" from the arrows or replace with "FIFO" (first in first out).
don't overthink this, i just meant another rectangle just like the "JOINT 0" group around "encoder counter", "D/A converter" (notice also typo there), I would call that "INTERFACE". and perhaps add "field I/O" and connect the switches box. I would have done that myself but the .drawio you attached seems to be my initial draft? |
|
I just came across Mermaid https://github.com/mermaid-js/mermaid as a graph description library that reportedly can also be integrated with Asciidoc. This would ease quite some of our problems with whatever we need as an external tool to edit the current graphs. Please kindly check this out. |
|
I'm sorry I interrupted work on this PR. I have some family problems. So I don't know when I'll be able to return to LCNC. I'm sorry I left some unfinished work here, but family is more important. Feel free to close my PR or continue on them. |
I played around with mermaid and found it was not a good fit for this type of diagram. Where is the problem with SVGs that are generated by drawio? This doesn't need to be automated, that diagram will not be updated on a regular basis, and a manual step to generate SVG to include in asciidoc would be acceptable IMO. draw.io can be used online and on desktop and is free (apache license), so changing a drawio diagram is a nuisance at worst. cf visio, illustrator or other proprietary stuff, those would be a real hurdle. |
Don't worry. We likely finish this somehow. It will just take a bit longer. Best wishes! |
|
My last version, if somebody want continue. |
|
@smoe what do we need for this to be accepted? are we ok with draw.io ? ZMQ is not in yet, waiting for that before updating docs? do you want a PR for a fix without ZMQ to reflect current status? |
|
For quick acceptance it is not a problem to delete the bridge module and the "zmq" arrows. Then the upper part of the "NON-REALTIME" diagram should be ok. The MOTION area is taken from the original image. It does not contain AXIS + JOINTS. I have no idea how outdated it is. |
I have no say in this. I am happy for anything that is better than the current content. Just make sure both the drawio and the svg are in the right place. |
|
Ok, sounds great, Robert told me in Discord/IRC he will do it.
@smoe you should join us there sometime ;-) |
|
Apologies for coming at this sideways — I didn't know this PR existed and Briefly: I'm new to LinuxCNC, coming from other CNC and PLC systems, and It landed on the same conclusions several of you reached here — EMCIO gone, The diagram itself, as published and corrected side by side: What would help me most: could someone who knows this code look at it and Everything else — findings, patches, verifier: PS: I also used AI to help me with english :-) |
|
@Zia-research I went through the three patches in The patches look good to me. Please send them as a PR and we will have a look there. One detail for the review: in the PAUSE paragraph, "(and jerk)" only applies to the cruckig planner; the default tpmod planner is trapezoidal. On the diagram: Sheet B of your errata sheet (the corrected diagram, second one on the page) is the most accurate rendering of the architecture diagram I have seen, and plain handwritten SVG carries no tooling dependency, which fits this codebase well. drawio has seen some friction here (single-line unformatted SVG output, out-of-tree web editor). @rmu75 @smoe, you have been steering the diagram question in this issue: what do you think of extracting Sheet B as a standalone .svg to replace |
|
Hi @Zia-research, First of all, thanks for taking the time to work on this. When I opened this PR, I thought updating the architecture diagram would be a relatively small task. As I dug deeper into the LinuxCNC architecture and the discussions around it, I realized it is a much larger effort than I originally expected, and I don't currently have enough time to see it through. Since you're now working in the same area, I wonder if it would make sense to close this PR and let you open a new one based on your own work. I think that would keep the review process cleaner and make it easier to follow the discussion. Please feel free to reuse anything from this PR that you find useful—diagrams, ideas, comments, or anything else. I'd be happy if any of it helps move the documentation forward. Thanks again for picking this up, and I look forward to seeing where you take it. |
|
Disclaimer. This text, the findings behind it and the diagrams are AI-generated — @grandixximo @zz912 — thank you both. The jerk point. You were right, and more right than I first credited: "the default This is the second time you have caught the same shape of error: the citations held up @zz912 — thank you. Let me be clear about scope, so I don't promise more than I can Sheet B. @grandixximo put that question to @rmu75 and @smoe, and it is theirs to What I cannot honestly offer is to maintain it. I am not a LinuxCNC developer, and I Three things found while checking the thread.
Note: GitHub Pages has been failing to deploy on their side today, so the rendered Next: I will open a PR with the three patches, re-checked against master when I do. |
|
Hello everyone, I started this trip into LinuxCNC for my own understanding, before building a test machine. I ended up posting here with a large case of impostor syndrome — hence my repeated mentions of AI. This is my first time contributing to a project and my first time using GitHub at all, so please tell me if I am going about any of this the wrong way. I have learned a great deal. I also spent two weeks of holiday, full time, on LinuxCNC. I let the AI guide me through opening a repository, and through opening #4349 after @grandixximo's invitation to send the patches as a PR — I am still surprised I did that. I still owe @grandixximo a reply on the review — both of the errors he found should be corrected, if the AI is right :-) The corrections exist in my own repository, but the PR still shows the old text, because I don't know whether to force-push the branch — which I am told marks his comments as outdated — or to add another commit on top. And should I answer eight review comments inline, or in one message? I would rather be told than guess and make more work for the reviewer. @zz912 — you asked back in August whether it would make sense to close this PR and let me open a new one based on my own work, and I never really answered. Honestly: I don't know, and I am not sure it is mine to decide. I don't really know what to do with any of this next, mostly because I understand too little about how things work here. What I can say is that I took you up on the other half of your message — the context diagram below is redrawn from #3781, and your work is the base of it. If a new PR is what you and the maintainers want, I will open one; I would just rather not open it on my own judgement. I kept going in the meantime. This figure mixes two images, and is inspired by #3781: that one I redrew my own way, and merged it with the rebuilt version of the diagram in the docs. The three pieces, if you want to look:
The working format is a What I would like to ask is what I should do with all of this. I hope the content of the system overview is correct — could you please check it? It is still a work in progress, there are typos etc. And even if it is correct, I am not happy with it: I find the overall understanding weak. Too much information? Maybe fine for someone who already knows the system? A different presentation? I don't know. Can you check whether the picture is true? Or at least not that false! I would like to keep improving this image. It is the thing I missed when I wanted to dig deeper. I hope I will get some feedback and suggestions. Thank you in advance. |
|
You are not doing this wrong. Two weeks of holiday spent reading our source is more than most people give, and it is appreciated. Practical bits first. Force-push or commit on top. Force-push is fine. My comments going outdated is correct, the source changed, so I read it again. That is how it works. If you or the AI mess it up we will tell you. Eight inline replies or one message. Inline, one short reply per thread, so each resolves on its own. One summary comment at the end only if something needs saying across all of them. #3718 vs a new PR. Open a fresh one if you think you can stick with it to the end, or say so and give someone else permission to take it over and carry it. Both are fine, what does not work is a PR that sits there waiting on someone who is not coming back. Nobody needs permission to open a PR here, it is not a commitment to anything else, it is just where the review happens. Is the picture true. As things stand today, it looks sensible. But that is the problem with a structure diagram of master: master moves. Your halmrt box was right three days ago, Bertho has changed it since. Some of what is coming sits in open PRs, some only exists in maintainers' heads as future restructuring. Nobody has the full picture; the project is many small pieces from many people and it is dynamic. So the diagram is a snapshot by nature. Fine as a draft to be maintained alongside the source, but someone has to keep doing it, and someone with an overall understanding of everything, which we don't really have. It is a community effort. 2.9 is static, a diagram of 2.9 would stay correct. Maintaining it. You said you cannot commit to that. That is fine and honest. Say the word and someone will take it over. Don't be too scared either: we mostly know what we are doing, something unacceptable will not be merged. Presentation. c-morley already said it earlier in this thread and I agree: one diagram per audience. The code notes one is for developers, users and integrators need a different and much simpler one. Your figure is trying to be both, that is why it reads heavy. Pick one reader and cut everything that reader does not need. drawio. I don't know that it is the tool we want. There has been some pushback and some acceptance. On the AI side: cut the walls of text. Read what the AI writes, understand it yourself, then shorten it. A short disclaimer at top or bottom is enough, you don't need to repeat it every post. It is fine to contribute, fine to arrive wanting to learn new things. What is not fine is sending text for other people to read that you have not read and understood yourself; a translation of it in your case. We are respectful of other people's time and we appreciate the time you are dedicating here, but the respect goes both ways. Some contributors do a touch and go, some stay, how much you invest is up to you. You will waste some of our time along the way, everyone does, don't beat yourself up. We all learn a thing or two with time, no shame in that. |
|
Complaining about walls of texts, I built one myself, sorry... |
|
Regarding draw.io: I would not consider #3781 a precedent for using draw.io. I chose draw.io simply because it was the first diagramming tool I tried that worked reasonably well for me. I didn't want to spend my limited time evaluating and comparing different diagramming tools — my goal was to work on the architecture itself, not on choosing the perfect drawing software. So I wouldn't read anything more into my choice of draw.io than that. A little bit of context from my side: My role in this project is basically that of an unofficial tester. The maintainers here are friendly and quite open to different opinions. They respect the fact that I sometimes have different views — and also that I sometimes get things wrong. 🙂 One advantage of using AI is that you can ask it to make your responses polite and non-confrontational. I had a few faux pas in the past when I relied on an ordinary translator, so I appreciate that aspect of AI. In fact, I am using AI to write this message to you as well. 🙂 I also consider this PR partly my own mistake. I overestimated how much time and effort I could afford to put into it. Nobody here blames me for that, but I try to keep the number of PRs I start and then cannot finish to a minimum. The difficult part is that it is not always possible to estimate in advance how complicated a problem will turn out to be. In my opinion, it is usually better to split larger subjects into several smaller PRs or Issues, so that each one remains reasonably short and easy to follow. It is quite common here for an Issue to branch into several related Issues when that makes the discussion clearer. I think the same approach could work here. You cannot simply take over and close this PR yourself, but once you create a new PR, you can mention at the beginning that it is a continuation of #3718. Then we can add a note here saying that the discussion and further work have moved to your PR, and I can close this one. Or, alternatively, one of the maintainers with the necessary permissions can do it. So I don't see closing #3718 as a problem. I think it would actually make things clearer once there is a new PR that represents the work you want to continue. As for the architecture diagram itself, I don't see a problem with you offering to create it without committing to maintain it indefinitely. Ultimately, it is up to the maintainers to decide whether they want to merge it or not. On the other hand, I would try to do the work in a way that makes it as well documented as possible, so that someone else can take it over later with the minimum amount of effort. I think that is a reasonable approach for community-maintained documentation. You don't necessarily have to be the person who maintains it forever — but making the work easy for the next person to understand and continue is very valuable. One more suggestion regarding your context diagram. https://zia-research.github.io/linuxcnc-audit/sheets/linuxcnc-context-diagram.html I think it would be better to make this an official LinuxCNC Issue or PR rather than keeping the discussion only on your website. And please mention Would you please do that? If the current material was produced with AI, I suspect this should be quite easy to turn into an Issue or PR — AI can probably do the conversion for you without much trouble. 🙂 In any case, I would suggest making the Issue or PR only about the context diagram, and not mixing it with the other architecture diagrams or broader architectural questions. That would make it much easier to review and discuss. I think your own website is a good place for publishing your own views and documenting your research, especially when those views may not necessarily represent the consensus of the LinuxCNC community. I have my own website as well https://zz912.webnode.cz/, where I describe my personal experience with LinuxCNC. For example, I recommend the combination of an OptiPlex 9010 + Gmoccapy + Mesa 7i96S. That is simply the setup I have personally tested and found to work well. For a beginner, that can be useful information about one possible way to get started. But if there are 100 people in the LinuxCNC community, there will probably be 101 opinions about the best hardware/software combination. 🙂 I see your website in a similar way: it is a very good place to document your research, experiments, and conclusions. But if you want the LinuxCNC project itself to consider something for inclusion in the documentation, I think the official Issue/PR is the right place for that discussion. So in this particular case, I would really appreciate it if you could create an official Issue or PR specifically for the context diagram and mention Thanks for taking the time to go through my work and for proposing improvements. I appreciate it. Regarding the three actors, though, my intention was actually almost the opposite of yours. The Operator, Integrator and Developer are the most important parts of my context diagram. I wanted to show the LinuxCNC ecosystem from the point of view of these three roles and how they interact with the different parts of LinuxCNC. So I don't think removing the actors would be an improvement to my diagram. It would turn it into a different kind of diagram, which can certainly be useful — but it would answer a different question. The current LinuxCNC documentation itself describes this figure as a "Context diagram" and says that it presents the components and players of the LinuxCNC ecosystem and how they interact. It also explicitly says that it is not intended to explain LinuxCNC functionality. That was exactly the direction I was trying to follow. There are, however, a couple of points in your review where I think you are absolutely right. "halcmd / halshow — attach to HAL, not to the core" I agree with you here. That is an error in my diagram. If you want to prepare a PR fixing this, please do so. I would be happy to see that correction made. Regarding: "Embedded tabs and panels have no link to HAL" I agree that there is currently no such direct link that should be shown in the diagram. I deliberately did not draw one. Part of the reason is that C-morley is currently working on ZMQ communication, so I think we should wait and see what becomes the preferred approach for creating and communicating with embedded panels in the future. There was also a practical reason for my decision. When I was a beginner, I initially had the impression that HAL was somehow the universal solution for connecting everything to everything in LinuxCNC. I don't think that is a particularly helpful impression to give to beginners. HAL is a realtime part of the system, whereas embedded panels are a user-interface mechanism. Personally, I don't see putting a realtime layer between the UI and everything else as something we should encourage unless there is a real need for it. But I don't think this discussion belongs in a C1 context diagram anyway. The diagram should show the relevant relationships at a useful level of abstraction, rather than prescribe which communication mechanism should be used for every possible implementation. So I think your observations are useful, but I would separate the two things:
In short, thank you for the proposed changes. I think some of them are valuable, but for the context diagram I would keep the three actors. Removing them would make the diagram clearer as an internal technical map, but it would also remove the main purpose for which I created this particular diagram. |
|
I am closing #3718 because the further work on the architecture documentation is now being continued in #4377. Thanks @Zia-research for taking this forward. |
|
Thanks @zz912 — closing is fine by me. One precision for the record: #4377 replaces the Code Notes block diagram ( I will open a separate one for the context diagram in the course of next week, and mention you there as you asked. |




I tried to update the block diagram of the LinuxCNC architecture. I would like the image to include both the ideal state and the current unwanted state that has arisen.
I am currently observing that some problems are being solved at the frontend level, instead of being solved at the background level.
When I started with LinuxCNC, I was missing a display where the HAL is. So I drew it.
If anyone knows how other parts of LCNC should work that would be good to draw. Feel free to send them to me drawn with a pencil on paper and photographed with a mobile phone. I can then draw them in the image.
I will be happy if there is a discussion about my proposal.