Script on startup

More
10 Oct 2020 20:20 #185628 by MatthiasF1210
Hi,

is there a way to execute a nc-file or python script on startup of Gmoccapy after the gui is loaded?

Thanks

Matthias

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

More
10 Oct 2020 21:22 #185635 by tommylight
Replied by tommylight on topic Script on startup
It should be possible, for nc file just adding this to the "display" section in the ini file should work:
open_file = name_of_the_file_to_open.ngc
It works with Axis GUI so it should with Gmoccapy.
Should also be possible for python, but i'll leave that to more experienced members here.

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

More
10 Oct 2020 22:01 #185649 by MaHa
Replied by MaHa on topic Script on startup
To execute a file, machine must be homed. After homing the last axis, for this axis in the hal file, at
'net n-is-homed halui.joint.n.is-homed' add: halui.mdi-command-nn

In .ini file
[HALUI]
MDI_COMMAND = Mnnn

In the executable Mnnn file your code
(n for axis and numbers)

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

More
11 Oct 2020 08:19 #185680 by newbynobi
Replied by newbynobi on topic Script on startup
To hook only one axis homed, it may cause an error, if not all axis are homed. So I would recommend to hook them to something like all_homed, that is the way gmoccapy reloads the tool on start up, Getting the all homed state, gmoccapy executes an MDI Command

Norbert
The following user(s) said Thank You: Aciera

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

More
11 Oct 2020 19:07 #185743 by MatthiasF1210
Replied by MatthiasF1210 on topic Script on startup
Hi,

Thanks for the hint.

My Ini File:
[HALUI]
MDI_COMMAND = o<startupcheck> call

My Postgui.hal:
net allhomed => halui.mdi-command-00

"allhomed" is calculated from all homeswitches.

But there is one problem left. Since my machine is still moving to the "home" Positionig after homing was done, there is an Error Msg "Change to MDI not possible" Is there a way to place an delay?

thanks

Matthias

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

More
12 Oct 2020 06:32 #185802 by newbynobi
Replied by newbynobi on topic Script on startup
Have you tried to include a G4 P5 in your file?

Norbert

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

More
12 Oct 2020 12:14 #185821 by andypugh
Replied by andypugh on topic Script on startup
Use an and2 using all-homed and motion.motion-type = 0?

That last condition will be slightly painful, as it's an s32 and needs to be convereted to float to use wcomp to test for zero.

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

More
12 Oct 2020 20:05 #185870 by MatthiasF1210
Replied by MatthiasF1210 on topic Script on startup
Hi,

i've done it.

in my hal-file

# -- NC-script on Startup Check with debounce --
loadrt debounce cfg=32,10,1
addf debounce.2 servo-thread
setp debounce.2.delay 1000
net all-homed => debounce.0.0.in
net mdi-cmd-startup <= debounce.0.0.out => halui.mdi-command-00


Thanks

Matthias

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

More
12 Oct 2020 21:39 #185885 by tommylight
Replied by tommylight on topic Script on startup
Hmmm that may also work with timedelay
linuxcnc.org/docs/2.8/html/man/man9/timedelay.9.html

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

More
15 Nov 2020 00:23 - 15 Nov 2020 00:24 #189411 by Nitram
Replied by Nitram on topic Script on startup

i've done it.

in my hal-file

# -- NC-script on Startup Check with debounce --
loadrt debounce cfg=32,10,1
addf debounce.2 servo-thread
setp debounce.2.delay 1000
net all-homed => debounce.0.0.in
net mdi-cmd-startup <= debounce.0.0.out => halui.mdi-command-00


Is there a native gmoccapy pin which needs to be connected to the "all-homed" signal, or is it created by using a few and2 components combining all "joint.N.is-homed" pins to create an "all-homed" pin?

Thanks.
Last edit: 15 Nov 2020 00:24 by Nitram.

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

Moderators: newbynobiHansU
Time to create page: 0.112 seconds
Powered by Kunena Forum