Headless machine

More
09 Nov 2023 19:41 - 10 Nov 2023 20:03 #284965 by sterfield
Headless machine was created by sterfield
Hey folks,

I may need some help here, because I'm not entirely sure on how to proceed for this build.

A bit of context : I have a CNC machine (a PrintNC) that I built myself (both mechanical and electrical parts). I'm using LinuxCNC for the management, and have basic understanding of how different linuxCNC parts are working together.

Now, I'm building a machine for one of my relatives. It'll be a simple build, with just a X gantry moving on top of Y rails. The toolhead will be a power-machine nozzle that we'll use to wash some parts.

I'm pretty confident regarding the mechanical assembly and the electrical assembly, as it should be close to my current CNC machine.

But there's a catch : my relative is not really tech-oriented, and don't want to interact through LinuxCNC GUI. I'm considering building an headless system, using a panel and some physical buttons to manipulate the machine. Inside the electrical enclosure, I will put a small computer that would boot then start a default linuxcnc configuration.

The panel will have some standard buttons: home, start, hold, halt and an e-stop.
Then, I'll need some additional buttons that should load a GCODE program.

Here's my questions :
  • how can I create an input button that would trigger the loading of a GCODE program in linuxCNC ?
  • is my headless idea doable ? If yes, do you have any advises on what I should do and not do ?


    If anyone has any better idea, I'm absolutely ready to consider it and adjust my build accordingly.

    Thanks for your help !
Last edit: 10 Nov 2023 20:03 by sterfield. Reason: typos

Please Log in or Create an account to join the conversation.

More
09 Nov 2023 22:12 #284981 by tommylight
Replied by tommylight on topic Headless machine
It is pretty simple to make a simple GUI with whatever you need instead of the included ones, add a touch screen with some nicely colored buttons and it is not a machine any more from your relative's point of view, it is a toy with big shinny buttons! :)
You can probably also make it headless, but i am not the one to help with it, sorry.
I am pretty sure LinuxCNC can be run without a GUI at all, and i know it can use physical buttons to do whatever is required from it, so chances are very good it can work.

Please Log in or Create an account to join the conversation.

More
10 Nov 2023 15:45 #285033 by andypugh
Replied by andypugh on topic Headless machine
I like the touchscreen idea too. But you could also have a Python userspace component that watches for button presses and does things.

You could just poll the buttons in a loop like:
linuxcnc.org/docs/stable/html/hal/halmodule.html
Or maybe look at PanelUI which seems to be exactly for this, but (if I am being honest) looks to over-complicate it.

What I am not seeing in literally minutes of looking is a way to create callbacks triggered by HAL pins connected to physical buttons. But that doesn't mean that it isn't there

A very simple example that loads a specific G-code file when a button is pressed.
#!/usr/bin/env python3
import hal, time, linuxcnc
h = hal.component("washer")
h.newpin("load1", hal.HAL_FLOAT, hal.HAL_IN)
h.newpin("run", hal.HAL_FLOAT, hal.HAL_IN)
h.ready()
c = linuxcnc.command()
try:
    while 1:
        time.sleep(0.1)
        if h.['load1']:
            c.open('sample.ngc')
            c.text_msg('sample.ngc opened')
        if h['run']
            c.auto(linuxcnc.AUTO_RUN)
except KeyboardInterrupt:
    raise SystemExit

The load1 and run buttons would need to be connected to physical inputs through HAL.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
10 Nov 2023 20:01 #285044 by sterfield
Replied by sterfield on topic Headless machine
Hey,

Thanks for the feedback !

To be honest, a small UI with just big buttons look simple enough, and I'm currently considering it.

The Python userspace script seems to be easy enough to handle.
Also, and provided I understood it correctly, it would not require me to launch linuxcnc, but only halrun ?

As for the callback you mention, I'm not sure to understand what you mean. As the python component is creating HAL pin, I would "just" have to bind my card controller input to the python component HAL pin, and that should just work ?

Please Log in or Create an account to join the conversation.

More
13 Nov 2023 14:22 #285260 by andypugh
Replied by andypugh on topic Headless machine

The Python userspace script seems to be easy enough to handle.
Also, and provided I understood it correctly, it would not require me to launch linuxcnc, but only halrun ?


I think that, as you want to run G-code and motion, you might as well run LinuxCNC as normal. But you would use your Python UI in the "[DISPLAY]" section instead of "axis" or whatever.

As for the callback you mention, I'm not sure to understand what you mean. As the python component is creating HAL pin, I would "just" have to bind my card controller input to the python component HAL pin, and that should just work ?


I think you will actually have to poll the state of the pins in the Python code, but I could be wrong.
But I am not sure if by "bind" you mean event binding inside the Python, or whether you are talking about making connections in HAL (you would definitely have to do that)

Please Log in or Create an account to join the conversation.

Time to create page: 0.124 seconds
Powered by Kunena Forum