Reload Program Through Pin

More
25 Aug 2015 21:49 #61783 by Delron
Replied by Delron on topic Reload Program Through Pin
Andy, Thank you so much!

I do not want to reload a program while one is running. All I want to do is update (Refresh/Reload/Whatever) the plot with the new offsets after a touch-off invoked from a remote pendant hooked up to the parallel port. Otherwise, axis thinks the g-codes moves are past the limits of the table.

I'll give it a try. Can you tell me what I need to next? I assume I need to place the file somewhere so HAL can see it, where? Do I need to make it executable first?
I assume I need to load it and add it to a thread. Is the function called "update?
Would this be correct?

loadrt update
addf update servo-thread
net tripped update.trigger <= pendant.pin-out?

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

More
25 Aug 2015 22:03 #61785 by andypugh
Replied by andypugh on topic Reload Program Through Pin

I'll give it a try. Can you tell me what I need to next? I assume I need to place the file somewhere so HAL can see it, where?

I used /usr/bin

Do I need to make it executable first?

I used 775 but I suspect that lesser permissions would work too.

I assume I need to load it and add it to a thread. Is the function called "update?
Would this be correct?

loadrt update
addf update servo-thread
net tripped update.trigger <= pendant.pin-out?


If you save the file as "update" then that is nearly correct, but you need to use "loadusr" for a component written in Python as they work in Userspace, not hard realtime.
The following user(s) said Thank You: Delron

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

More
27 Aug 2015 00:04 #61814 by Delron
Replied by Delron on topic Reload Program Through Pin
Quick question;

Can "axis.remote --reload" or any other axis.remote command be invoked within the custom.hal file? If so, how?

I know I could do it by calling a mdi.command, but was wondering...

Cheers!

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

More
27 Aug 2015 12:53 #61827 by ArcEye
Replied by ArcEye on topic Reload Program Through Pin
No

customgui.hal is the last hal file to be called, but it is still called before Axis is shown, to connect the user defined GUI elements.
The following user(s) said Thank You: Delron

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

More
29 Aug 2015 21:47 #61888 by andypugh
Replied by andypugh on topic Reload Program Through Pin

Can "axis.remote --reload" or any other axis.remote command be invoked within the custom.hal file? If so, how?


I think that the question might indicate that you are unclear about what HAL files do.
The HAL files are each read once, at start-up, the components are loaded and connected as specified, and then the HAL file plays no further part on the system.

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

More
30 Aug 2015 03:19 #61903 by Delron
Replied by Delron on topic Reload Program Through Pin

Can "axis.remote --reload" or any other axis.remote command be invoked within the custom.hal file? If so, how?


I think that the question might indicate that you are unclear about what HAL files do.
The HAL files are each read once, at start-up, the components are loaded and connected as specified, and then the HAL file plays no further part on the system.


No, I understand how hal is loaded. I thought maybe the axis.remote command could be hooked to a net and input like a function.

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

More
30 Aug 2015 04:23 #61904 by andypugh
Replied by andypugh on topic Reload Program Through Pin

No, I understand how hal is loaded. I thought maybe the axis.remote command could be hooked to a net and input like a function.


That's what my Python component does. It is a HAL wrapper for the command line instruction.

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

More
30 Aug 2015 04:46 #61905 by Delron
Replied by Delron on topic Reload Program Through Pin

No, I understand how hal is loaded. I thought maybe the axis.remote command could be hooked to a net and input like a function.


That's what my Python component does. It is a HAL wrapper for the command line instruction.


You know, I should have known that already after you wrote that component. My brain is so tired that it just does not think right all the time. It was a silly question. Sorry.

I still have to see if that Python script works for me. Will be working on it tonight or tomorrow. Thanks again.

Would I be correct in assuming most users simply use the keyboard and mouse to touch-off? I feel like I'm forging my way down a path few others dare. I would have assumed most everybody would want to touch-off via a pendant and not have to manually refresh the corridinate system with the keyboard/mouse to avoid a possible "Outside machine limits" error?

In any case, I will one day figure this out.
I did have a partial working solution by having HAL invoke "haul.mode.mdi" before running the below M-code. It refreshes the program just fine, but then it's stuck in MDI mode and I can't get back to manual mode without hitting another button.

***machine.ini***
# MDI command #5 --Test of New z-probe with Program Reload--
MDI_COMMAND = M101


***custom.hal***
net touchoff halui.mode.mdi halui.mdi-command-05 <= matrix_kb.0.key.r1c4


***M101***
#!/bin/sh
axis-remote -m "o100 call"
axis-remote —reload &
exit 0


***o100***
<pre>
o100 sub
( Set current Z position to 0 so that we will always be moving down )
G10 L20 P0 Z0
( Probe to Z-1.0 at F5 [Uses machine units, I work in inches, this is meant to be slow!] )
G38.2 Z-1.0 f5
( Set Z0 at point where probe triggers with offset of +0.963 [thickness of PCB plate. You must adjust this for your plate / setup] )
G10 L20 P0 Z0.963
( Rapid up to Z1 above the material )
G0 Z2
o100 endsub
</pre>

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

More
04 Apr 2016 22:07 #72745 by bogie6040
Sorry to poke an old thread but....

@Delron I am looking to do the same thing, did you ever get yours to work??

@Andy I tried to implement the script you posted in the axis sim with a pyvcp panel and I keep getting the following no matter what I try:
HAL: ERROR: function 'update' not found
test_postgui.hal:2: addf failed

test_postgui.hal file has:

loadusr update
addf update.trigger servo-thread
net jake-update-backplot update.trigger <= pyvcp.update-button

I placed the newly created file in /usr/bin with all permissions and executable.
I am running Wheezy 2.7.4
What am I doing wrong / missing??

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

More
04 Apr 2016 22:35 #72747 by andypugh
Replied by andypugh on topic Reload Program Through Pin

@Andy I tried to implement the script you posted in the axis sim with a pyvcp panel and I keep getting the following no matter what I try:
HAL: ERROR: function 'update' not found
test_postgui.hal:2: addf failed


Where did you save the file? (ie, the Python file here: forum.linuxcnc.org/forum/21-axis/29552-r...h-pin?start=20#61763 )

linuxcnc.org/docs/2.7/html/hal/halmodule.html

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

Time to create page: 0.180 seconds
Powered by Kunena Forum