Coder Social home page Coder Social logo

Comments (11)

andypugh avatar andypugh commented on June 9, 2024

(abort, xxxxx) should probably always have an ON_ABORT in the INI. Though I am not sure what would help here. Possibly an M2?

from linuxcnc.

Sigma1912 avatar Sigma1912 commented on June 9, 2024

The workaround from #2745 works here as well. Basically a change of the active work offset system (ie g5x) will set the DRO right.
(Note that M2 should not be used inside a subroutine.)
However, given that a default configuration does not come with an 'on_abort' subroutine call it seems that either the issue should be handled in the source code or an 'on_abort' routine should at least be included as a standard.
In my oppinon his is a surprising bug even for reasonably experienced users.

[Edit]
Testing shows that 'M2' does not fix this issue while WCS manipulation seems to put things right.

from linuxcnc.

Sigma1912 avatar Sigma1912 commented on June 9, 2024

Just to be clear, this happens whenever a program aborts, not just when it's caused by the magic comment (abort, ....)

from linuxcnc.

Sigma1912 avatar Sigma1912 commented on June 9, 2024

I wonder if this is connected to the confusion of resetting G52/G92 on M2/M30.
'Coordinate Systems' documentation states:
https://linuxcnc.org/docs/html/gcode/coordinates.html
```By default, G92 offsets are restored after the machine is started. Programmers that wish for Fanuc behavior, where G92 offsets are cleared at machine start and after a reset or program end, may disable G92 persistence by setting DISABLE_G92_PERSISTENCE = 1 in the [RS274NGC] section of the INI file.``

also 'interp_convert.cc' comments:

interp_convert g92

while 'INI' documentation seems to have only ever mentioned ' config start up':
linuxcnc.org/docs/2.8/html/config/ini-config.html

DISABLE_G92_PERSISTENCE = 0 Default 0 Allow to clear the G92 offset automatically when config start-up.

from linuxcnc.

Sigma1912 avatar Sigma1912 commented on June 9, 2024

In version 2.9 and master G52,G92 is not reset on M2,M30 regardless of DISABLE_G92_PERSISTENCE setting, that seems to only apply to 'config start-up'.
I don't know if it was working in earlier versions.

from linuxcnc.

Sigma1912 avatar Sigma1912 commented on June 9, 2024

Further on in 'interp_convert.cc' we find:
clear G92

And indeed if we run this:

g92.1
(debug, 5210: #5210; 5211: #5211)
g10 l2 p0 x0
g0 x0
g92 x123
(debug, 5210: #5210; 5211: #5211)
m2

and then in MDI:
(debug, 5210: #5210; 5211: #5211)

we get this situation
test_result

Parameter values are zero but DRO shows G92 offset applied.
issuing G0 X0 shows that the G92 offset is indeed still set to the value shown in the DRO.

Note here that this happens without any abort situation but in a simple gcode that runs just fine.

from linuxcnc.

Sigma1912 avatar Sigma1912 commented on June 9, 2024

So if I follow this correctly then the 'G92' offset value in the DRO comes from the status channel ('glcanon.py'):

G92dro

which seems to bring me back to the issue of the parameters being out of sync with the status channel (#2745).

So (while not good) this does not seem to be what causes the DRO to hide active G92 offsets.

However, if g92 is indeed not to be reset on M2/M30 we may want to remove this from 'interp_conver.cc':
interp_g92_reset

from linuxcnc.

Sigma1912 avatar Sigma1912 commented on June 9, 2024

While I have not come up with a better solution I have found the internal 'on_abort' procedure:
on_abort

The only idea that comes to my mind is to hard code the workaround in here but that seems rather crude.

from linuxcnc.

Sigma1912 avatar Sigma1912 commented on June 9, 2024

Further testing shows that after an abort the MDI command:
;py,import linuxcnc;s=linuxcnc.stat();s.poll();print(s.g92_offset)
gives
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
So the .stat.g92 offsets values have been cleared, hence the DRO also shows zero, which is wrong.

while the parameters will show the offset (correctly):
5210: 1.000000; 5211: -100.000000

If we issue MDI command 'm2':
the .stat.g92 offsets values remain unchanged (still wrong) but the parameter values are reset to zero (now also wrong, due to lines 4684-87 in 'interp_conver.cc' as shown above):
5210: 0.000000; 5211: 0.000000

If we manipulate WCS by (eg MDI command 'G59' the .stat.g92 offsets values come back (now correct) :
(-100.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)`

while the parameter values remain zero (still wrong):
5210: 0.000000; 5211: 0.000000

now we issue MDI g92.3 (should activate G92 with the stored values):
.stat.g92 offsets values :
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
parameters:
5210: 1.000000; 5211: 0.000000
So g92.3 takes the value from parameter 5211 to restore the offset.

As a conclusion:
There are at least three states for the g92 offset:

  1. An internal state that is actually used for the motion
  2. The .stat.g92 offsets values user for the DRO in the GUI
  3. The parameter values 5211...5219 from which offset values are restored from

All of these seem to be updated independently and unfortunately also inconsistenly.

from linuxcnc.

Sigma1912 avatar Sigma1912 commented on June 9, 2024

I really wonder where the values on the status channel are written to in the source code.

;py,import linuxcnc;s=linuxcnc.stat();s.poll();print(s.g92_offset)
gives me (which is the values before running the aborting gcode program):
(-99.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)

while at the same time I get these from a printout in 'interp_write.cc' line 216:
settings->parameters[5211], settings->axis_offset_x -100.000000, -100.000000
which both show the correct x-offset value.

from linuxcnc.

Sigma1912 avatar Sigma1912 commented on June 9, 2024

I guess the basic problem is that the program aborts when the read-ahead ingests an abort condition, while execution is still somewhere behind.
Because some information is updated by the read ahead and some is updated sometime later by motion there is always a discrepancy for a short time but on abort this can become a problem that needs to be handled in the 'on_abort' command as the information in the GUI can not be trusted to reflect the state of the controller.

from linuxcnc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.