How does PathPilot know what Python files to start?

More
24 Jan 2019 00:33 #124697 by jwatte
When I do a `ps` on the PathPilot controller, it looks as so:
0  1001  1867  1444  20   0 541952 39412 poll_s Sl   ?          0:00 /usr/bin/python /usr/bin/blueman-applet
0  1001  2147  1878  20   0 203200 39996 wait   S    ?          0:00 python /home/operator/tmc/python/pathpilotmanager.py
0  1001  2195  2147  20   0      0     0 task_d Z    ?          0:00 [python] <defunct>
0  1001  2264     1  20   0 232940 36128 poll_s S    ?          1:12 python python/hal_zbotatc.py -n zbotatc
0  1001  2267     1  20   0 230760 35996 poll_s S    ?          1:16 python python/hal_zbotschnozz.py -n zbotschnozz
0  1001  2271     1  20   0 305044 36528 poll_s S    ?          1:17 python /home/operator/tmc/python/usbio.py -n usbio
0  1001  2280  2211  20   0 1953120 194712 poll_s Sl ?        907:03 python /home/operator/tmc/python/tormach_mill_ui.py -ini /home/operator/tmc/configs/tormach_mill/tormach_440.ini
0  1001  2312     1  20   0 176088 28836 poll_s S    ?          1:03 python /home/operator/tmc/python/tormach_console.py -n tormach_console

Some .py files get their own processes. But I can't find any particular file or module that lists which files get this treatment, and it's not given to all .py files in the given directories.

So, how does PathPilot (or LinuxCNC) decide to start particular .py files as processes?

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

More
24 Jan 2019 09:24 #124718 by pl7i92
Path Pilot operates on internal C-compiler Strategie and then gose out to python scripts
THE same as FreeCAD

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

More
25 Jan 2019 17:42 #124831 by jwatte
Thanks for the answer. I understand that PathPilot is a C program using Python for embedded scripting. (Although, clearly, the different processes are actually python-main program that use C-based python modules, as witnessed by the "python" main executable for the process.)

My question is: "If I want to have PathPilot start another Python process using a script that I supply, how do I best arrange for that to happen?"
Do I need to get the C code and re-build it? Or is there some rule for which files are started as sub-processes, and I can just make my script follow that rule?

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

More
27 Jan 2019 18:23 #124981 by jwatte
To answer my own question:

I had hoped that PathPilot would just look for something like "py scripts with the x bit set in directory D" but I'm not so lucky.

The separate Python processes are created using the `loadusr` command in the v2.1.6/configs/tormach_mill/tormach_mill_mesa.hal and similar files. I don't know if PathPilot re-writes these files on each update, or whether changes made there will persist -- we shall find out.

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

More
28 Jan 2019 01:37 #124997 by smgvbest
Pathpilot is just another GUI front end for LinuxCNC, it works the same way LinucCNC does for other other gui's
if you want to learn I started reading linuxcnc doc first them hit PP. don't try to learn PP first. linuxcnc is at it core.
Tormach but allot of work into it but it is not a full implementation of all LinuxCNC features

it a nice slick interface which is what I want myself

for your question.
PP started with ./operator_login, from there is goes the pathpilotmanager.py which is where allot more of the setup and goes and the actual launching of linuxcnc which loads all the other python scripts, once that's done it load the postgui.hal which finishes setting up all the tormach specific stuff and then things are fully up

Pathpilot replaces all files under $HOME/tmc on upgrades. remember they are supporting thier products.
i just diff my old vs new directory then apply patches to update

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

More
28 Jan 2019 19:24 #125087 by jwatte
I'm thinking I could put a script into something like .bashrc (or maybe even a unit in /etc/systemd/system) that would look for my mods, and if not there, apply them on start-up. That way, I'd know they were available after an update.
I'd also need some way to un-apply if some incompatible update comes down the pipe...

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

More
28 Jan 2019 22:59 #125115 by smgvbest
If you want to look at how they do the update check check_for_pathpilot_update in pathpilotmanager.py
this is what does the update and also. those tgp files and just pgp encrypted tgz files (the password is in the script btw)

so if you wanted to look at an update you can do this
gpg --yes --no-use-agent --decrypt --passphrase=moravianvalley --output=v2.1.6.tgz v2.1.6.tgp
then
tar -zxvf v2.1.6.tgz
that will create the v2.1.6 directory in the current folder
you can look and compare (diff) the update vs your current tmc directory and create a patch file
apply the patch
do the symbolic switch and you on the new one with your updates

I maintain 2 system, my actual lathe version and my development vmware image (i'm modified vmcheck.py to detect VMWare and put me in sim mode
The following user(s) said Thank You: jwatte

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

More
28 Jan 2019 23:57 #125123 by jwatte
My approach would probably be to keep the one-line change to the HAL files as a diff/patch hunk.
Then, on start-up, I'd check whether the desired target line exists in the installed copy, and if not, apply the patch. I can use systemd to make sure that this happens before the GUI starts up.
The one-line change would then launch my UI thread script, and I'd be able to do whatever I want at that point.
After an update, when I reboot, the patch gets re-applied, and if it doesn't apply cleanly, I can detect that and take appropriate measures.

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

Moderators: cncbasher
Time to create page: 0.147 seconds
Powered by Kunena Forum