Subroutines default to G94 Feed units when using CSS on a lathe

More
04 Apr 2021 19:52 #204807 by sqmathlete
Hi,

I have noticed that when running NGCGUI subroutines for a lathe that G95 units/rev is not active. i.e. G94 turns on even if you have programmed G95 in the subroutine. Seems like G95 should be active since the feed/rev is changing with CSS varying spindle speed and G94 active.

For example: In the subroutine
G95 F0.020
G96 D3500 S200
G01 X2.0 Z0.250

But the simulator runs
G94 at the last programed F(units/min) rate when executing the G01 command.

...seemingly ignoring G95 commands. Even stranger is that if I program the same code in the MDI window everything seems as it should. What is going on here? What am I missing?

Kind regards,
Dan

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

More
06 Apr 2021 00:40 #205009 by andypugh
Are you really saying that the G-code says one thing and the machine does something different?

Are you seeing this watching the machine? Or looking at the active G-codes display? The latter tends to show the final interpreter state, as the interpreter runs a lot ahead of the actual machine motion.

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

More
06 Apr 2021 12:01 #205084 by sqmathlete
Hi Andy,

At first I wasn't sure what I was saying. I was totally confused about what was going on. Based on your suggestion I added (debug, Units per Rev = #<_units_per_rev> etc) to my ngcgui subroutine and it seems like the code is executing correctly but the interpreter is is so far ahead that I am seeing codes like M02, M05 as well as G94? G97 and G17? in the display while it is running.

I can understand M02 M05 etc but, the thing that I can't get my mind around is that if you start the subroutine with G18, G95, G97 the subroutine runs, debugging statements are correct but at the end of the routine G17 G94 and G97 are the active G-Codes. Which I think explains why you can see the velocity fluctuate in the display as the machine is 'moving'. Adding a post amble doesn't solve this.

Note: Right now I am running a minimalist sim version of my real configuration that uses a custom gscreen to proof my subroutines
Not sure if this has anything to do with what I am seeing.

However, on a lathe and having G17 active at any time seems precarious...and incorrect.

Dan

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

More
06 Apr 2021 12:18 #205087 by andypugh
A lot of the modes are reset by M2
linuxcnc.org/docs/2.8/html/gcode/m-code.html#mcode:m2-m30

So if you end the gcode with an M2, you will see G94.

I realise that generally you don't want to do what M2 does, but it is part of the original G-code spec,

I think I read somewhere that the development version of LinuxCNC does actually show current state. But I can't find where I read it. Which version are you running?
The following user(s) said Thank You: RotarySMP, sqmathlete

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

More
06 Apr 2021 13:00 #205099 by sqmathlete

I realise that generally you don't want to do what M2 does, but it is part of the original G-code spec,


That must be it! :) M02 is not in my subroutine but added by the NGCGUI in the last line of code. Is remapping M02 possible?

I'm running 2.9, trying out the new G71/G72 commands as well.

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

More
06 Apr 2021 13:18 #205104 by dgarrett
NGCGUI_OPTIONS = opt1 opt2 … - NGCGUI options
    nonew - disallow making a new custom tab
    noremove - disallow removing any tab page
    noauto - no autosend (use makeFile,
             then save or manually send)
    noiframe - no internal image, display images
               on separate top level widget
    nom2 - do not terminate with m2, 
           use % terminator. This option eliminates
           all the side effects of m2 termination


REF: linuxcnc.org/docs/2.8/html/gui/ngcgui.html
The following user(s) said Thank You: sqmathlete

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

More
06 Apr 2021 13:19 #205105 by sqmathlete
Looks like M02 is not in the list of remappable codes. Is there any other possible solution?

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

More
06 Apr 2021 22:21 #205197 by andypugh
I think that Dewey answered while you were typing the question.

Which is pretty spooky.

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

More
08 Apr 2021 20:53 #205362 by sqmathlete
Perfect! Using a % instead of M2 solved my problem but, now I have another question...
How do you test parameters and then fail gracefully without using M2?
Example:
o<100> IF [#<value> NE 1]
(debug, value not in specified range)
M2
o<100> endif

or
o<110> if [#<value> NE 1]
(debug, value not in specified range)
%
o<110> endif
which causes an error, o<110> no endif in file.

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

More
08 Apr 2021 21:32 - 08 Apr 2021 21:33 #205373 by andypugh
Try
(ABORT, Error Message Here)
Last edit: 08 Apr 2021 21:33 by andypugh.

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

Time to create page: 0.120 seconds
Powered by Kunena Forum