ramifications of killing linuxcnc process

More
04 Sep 2017 21:59 #98514 by allwinedesigns
allwinedesigns created the topic: ramifications of killing linuxcnc process
What are the ramifications of killing the linuxcnc process (kill -9)? What kind of clean up happens when you let it gracefully quit?
More
05 Sep 2017 09:42 #98520 by andypugh
andypugh replied the topic: ramifications of killing linuxcnc process
On exit the values of the persistent parameters are saved to the linuxcnc.var file, and (optionally) the current axis positions are saved to the position.txt file. Also, I believe that changes to the tool table will be saved at this point too. (that is, any changes made in the G-code rather than the tool table editor).

Generally you will get away with it. But why do you want to?
More
05 Sep 2017 13:16 #98527 by allwinedesigns
allwinedesigns replied the topic: ramifications of killing linuxcnc process
It takes a long time for linuxcnc to shutdown (at least ~20 seconds) and I'm not sure why. I'm working on an interface for the PocketNC based on EmperorWeb and Rockhopper (you can see an old version of it here www.allwinedesigns.com/blog/pocketnc-jog-wheel ). I'm setting up systemd scripts for starting and stopping linuxcnc and Rockhopper (a Python webserver that provides a web socket interface to linuxcnc). In the Rockhopper interface I'd like to be able to restart the servers after changing INI variables to quickly see their changes reflected. If I could force kill linuxcnc, it would go much faster. I guess I could avoid the problem if there's a way to change INI variables at run time via Python, is that doable?
More
05 Sep 2017 13:45 #98528 by andypugh
andypugh replied the topic: ramifications of killing linuxcnc process
Many of the INI values that are used directly, rather than being read in to the HAL file and used to set HAL pins are mirrored as HAL pins, and these can be changed in a live system.

They belong to milltask:
linuxcnc.org/docs/html/man/man1/milltask.1.html

But are created by inihal.cc
github.com/LinuxCNC/linuxcnc/blob/master/src/emc/ini/inihal.cc

The other settings exist in the INI but are read by the HAL and are used in "setp" commands. You can just "setp" them to other values.
More
05 Sep 2017 14:13 #98529 by rodw
rodw replied the topic: ramifications of killing linuxcnc process
I'm not sure if it's specific to an experimental branch (dgarr/external_offsets) but the latest simulator there includes a separate popup window to edit ini file parameters on the fly. Its loaded by a few lines in the .ini file. Great for tuning and easy to copy to a working config.
More
05 Sep 2017 14:33 #98530 by allwinedesigns
allwinedesigns replied the topic: ramifications of killing linuxcnc process
The idea is to only use a web interface to interact with the machine, so no terminal or builtin GUIs from linuxcnc. EmperorWeb provides a web interface for general interaction with the machine (jogging, running gcode, setting tool offsets, etc.). It does so by communicating with Rockhopper, a python web server that provides a web socket API for UIs such as EmperorWeb, so everything must be done by Rockhopper. Rockhopper provides its own web interface for editing INI variables and displaying the hal graph. I'd like to modify Rockhopper in some way so the changes to the INI variables are picked up right away, rather than needing to write them to the INI file and restarting (which is my current plan, and the reason for this post).

@rodw, I'm not familiar with the linuxcnc source, is the simulator a python script that I could potentially look at to learn something? If so, do you have a link to where that might be? If not, unfortunately I don't think it will work for my purposes.

@andypugh, it seems like we're getting closer to a solution by setting hal pins, but I'm still unsure the best way to proceed. How can you change hal pins from python? Would I need to shell out to something like halcmd or is there a python module for that?

I appreciate the help!
More
05 Sep 2017 14:44 #98531 by andypugh
andypugh replied the topic: ramifications of killing linuxcnc process
if you "import hal" then the help suggests that the pin object has a set method.
More
05 Sep 2017 15:31 #98532 by allwinedesigns
allwinedesigns replied the topic: ramifications of killing linuxcnc process
Thanks, I found the set_p method and it seems to work with the milltask pins, but I'm unsure how to reference the others. How would I name the pins that aren't owned by milltask ([AXIS_0]SCALE for example)?
More
05 Sep 2017 15:47 #98533 by allwinedesigns
allwinedesigns replied the topic: ramifications of killing linuxcnc process
Oh, I think I see what you mean now. In my hal file I see:

setp [PRUCONF](DRIVER).stepgen.00.position-scale [AXIS_0]SCALE

I'm unable to reference [PRUCONF](DRIVER).stepgen.00.position-scale using halcmd or python. That seems machinekit specific. Any ideas?
More
05 Sep 2017 16:10 #98534 by allwinedesigns
allwinedesigns replied the topic: ramifications of killing linuxcnc process
[PRUCONF]DRIVER was also defined in my INI file as hal_pru_generic, so this worked:
setp hal_pru_generic.stepgen.00.position-scale -8333

Thanks for your help!
Time to create page: 0.098 seconds
Powered by Kunena Forum