(abort, MSG) in O-sub

More
30 Dec 2012 21:44 - 30 Dec 2012 21:45 #28179 by h_munktell
Hello, maybe the wrong forum category, moderator can move thread if needed.

Ok, I have a Z touch off /probe routine:
; this is called from gladevcp MDI action with the following
; MDI command:
; O<probe> call [${pfeed-f}] [${dist}] [${probeplate}] [${z_safe-f}]

O<probe> sub

M73 (Save modal state)
G49 (cancel dynamic tool length offset) 
G91 (relative mode)
F #1 (Set feed)
G38.3 Z #2 (Probe towards workpiece)

o100 if [#5070 EQ 1] (Probe sucessfull)
  (MSG, Probe successful!)
  G10 L20 P[#5220] z[#3] (Set Z touch off point coordinate)
  G0 Z [#4] (Retract Z)
o100 else (Probe failed)
  G90 G53 G0 Z0 (Retract to safe Z)
  (abort, Probe failed!)
o100 endif

O<probe> endsub

This gets called from a GladeVCP button. If probing fails, the conditional else is executed, but I only get the abort message, not the safe Z retract movement. If I change the "abort" to "MSG", I first get the movement, and then the message.

But I would like to get more like a warning/error rather than the message icon thing.

Why does the abort message cancel code before it is called? Bug?

Regards
Henrik

Edit: I'm on newest Master
Last edit: 30 Dec 2012 21:45 by h_munktell.

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

More
31 Dec 2012 00:12 #28185 by Rick G
Replied by Rick G on topic (abort, MSG) in O-sub

Why does the abort message cancel code before it is called? Bug?

Perhaps not, perhaps the movement is stopped by abort before it is completed.

You could try putting a pause after the movement and before the abort to give it time to complete.

Rick G

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

More
31 Dec 2012 00:44 #28188 by BigJohnT
Replied by BigJohnT on topic (abort, MSG) in O-sub
I don't see anything about there being an abort message, can you link the relevant part of the manual?

John

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

More
31 Dec 2012 01:08 #28190 by h_munktell
Replied by h_munktell on topic (abort, MSG) in O-sub
Rick, the movements are not started at all, and they should be finished before executing the next line of program. I tried a G4 P5 inbetween the movement and the abort with no luck. When entering the else statement, the abort message is instantly displayed.
o100 if [#5070 EQ 1] (Probe sucessfull)
  (MSG, Probe successful!)
  G10 L20 P[#5220] z[#3] (Set Z touch off point coordinate)
  G0 Z [#4] (Retract Z)
o100 else (Probe failed)
  G90 G53 G0 Z0 (Retract to safe Z)
  G4 P5
  (abort, Probe failed!)
o100 endif

John, it's in the developer manual at: www.linuxcnc.org/docs/devel/html/remap/s...g_dealing_with_abort

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

More
31 Dec 2012 05:06 #28203 by BigJohnT
Replied by BigJohnT on topic (abort, MSG) in O-sub
Thanks, need to read the developers manual more... could be as soon as the interpreter reads in the abort it happens. You might try nesting another if block with the abort message... just guessing out loud.

John

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

More
31 Dec 2012 05:11 #28204 by h_munktell
Replied by h_munktell on topic (abort, MSG) in O-sub
Thanks, but already tried that, like this:
; this is called from gladevcp MDI action with the following
; MDI command:
; O<probe> call [${pfeed-f}] [${dist}] [${probeplate}] [${z_safe-f}]

O<probe> sub

M73 (Save modal state)
G49 (cancel dynamic tool length offset) 
G91 (relative mode)
F #1 (Set feed)
G38.3 Z #2 (Probe towards workpiece)

o100 if [#5070 EQ 1] (Probe sucessfull)
  ;(MSG, Probe successful!)
  G10 L20 P[#5220] z[#3] (Set Z touch off point coordinate)
  G0 Z [#4] (Retract Z)
o100 else (Probe failed)
  G90 G53 G0 Z0 (Retract to safe Z)
o100 endif

o110 if [#5070 EQ 0]
  (abort, Probe failed!)
o110 endif

O<probe> endsub

Same thing, which is extremely strange. If the code where to be compiled by a high level compiler, I could have understod that the second if statement would be optimized into the first. But to my knowlege this is a interpreter(?) language and that should not happen.

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

More
31 Dec 2012 05:33 #28205 by BigJohnT
Replied by BigJohnT on topic (abort, MSG) in O-sub
I was thinking of a nested if, say to test if Z is at 0 with 5422 or something like that after the G90 so it is only true when you get to Z0.

John

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

More
03 Jan 2013 20:41 #28344 by andypugh
Replied by andypugh on topic (abort, MSG) in O-sub

Same thing, which is extremely strange. If the code where to be compiled by a high level compiler, I could have understod that the second if statement would be optimized into the first. But to my knowlege this is a interpreter(?) language and that should not happen.

I suspect that message printing happens in the user-space process, and is not added to the real-time queue.
One workaround might be to interleave a motion-synchronised command, such as an M67 or M62.

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

More
03 Jan 2013 21:11 #28345 by mhaberler
Replied by mhaberler on topic (abort, MSG) in O-sub

Same thing, which is extremely strange. If the code where to be compiled by a high level compiler, I could have understod that the second if statement would be optimized into the first. But to my knowlege this is a interpreter(?) language and that should not happen.

I suspect that message printing happens in the user-space process, and is not added to the real-time queue.
One workaround might be to interleave a motion-synchronised command, such as an M67 or M62.


yes, forcing the interpreter queue to finish by a 'read pin' command should work

unfortunately the interpreter as it stands doesnt have a command to 'wait until queue executed up to here', but it would be relatively simple to add by a M- or G-code which returns INTERP_EXECUTE_FINISH

- Michael

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

More
04 Jan 2013 02:50 #28351 by h_munktell
Replied by h_munktell on topic (abort, MSG) in O-sub

I was thinking of a nested if, say to test if Z is at 0 with 5422 or something like that after the G90 so it is only true when you get to Z0.

John


Tried this, did not work, got no message from the while loop.
o100 if [#5070 EQ 1] (Probe sucessfull)
  (MSG, Probe successful!)
  G10 L20 P[#5220] z[#3] (Set Z touch off point coordinate)
  G0 Z [#4] (Retract Z)
o100 else (Probe failed)

  o101 do 
    (msg, In while)
    G90 G53 G0 Z0
  o101 while [#5422 LT 0]

  (abort, Probe failed!)

o100 endif

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

Time to create page: 0.190 seconds
Powered by Kunena Forum