Schallbert / macro_edingCNC_sorotec

macros for Eding's Computerized Numerical Controllers, specialized for Sorotec portal milling machines
GNU General Public License v3.0
0 stars 0 forks source link

sub zero_z: Set Z0 is ignored when hover position (5mm above probe) is above max. Z height #1

Open Schallbert opened 1 year ago

Schallbert commented 1 year ago

Precondition:

Action:

Expectation:

Actual behavior:

krizleebear commented 1 year ago

I'm not sure whether this is a macro problem. The instruction order in macro seems fine: first store z0, then move above

G92 Z[#4510]                ; Z-Nullpunkt übernehmen
G0 Z[#4510 + 5]             ; Taster 5mm Freifahren

https://github.com/Schallbert/macro_edingCNC_sorotec/blob/main/macro.cnc#237

krizleebear commented 1 year ago

Here's the extract from Eding log: EdingCNC even states: OFFSET AND PLANE SAVED TO INI FILE I also see in log that I was forced to re-home all axes after the error. Maybe that's the point where things went sideways? But somehow I still assume that this problem is closely related to your 'reset z after emergency stop' problem.

Maybe I'll reproduce the problem and add some more logging to the macro.

7-12 16:06:31->CNC_EC_INFO CNC_RC_OK RunLine:cnccommand.cpp(2684):Enter state =<READY>, line=<gosub xhc_probe_z>
17-12 16:06:31->CNC_EC_INFO CNC_RC_OK RunLine:cnccommand.cpp(2734):gosub xhc_probe_z
17-12 16:06:31->CNC_EC_INFO CNC_RC_OK RunGosub:cnccommand.cpp(2338):Enter state=<READY>
17-12 16:06:31->CNC_EC_INFO CNC_RC_OK RunGosub:cnccommand.cpp(2441):Leave state=<RUNNING_SUB>
17-12 16:06:31->CNC_EC_INFO CNC_RC_OK Msg:intdefcmd.cpp(35):taster wird angefahren
17-12 16:06:31->CNC_EC_INFO CNC_RC_OK MotSetCaptureMode:motion.cpp(7496):MOT_CAPTURE_PROBE
17-12 16:06:33->CNC_EC_INFO CNC_RC_OK Generate:motion.cpp(9963):Position Captured->stopping
17-12 16:06:33->CNC_EC_INFO CNC_RC_OK MotSetCaptureMode:motion.cpp(7561):MOT_CAPTURE_NONE
17-12 16:06:33->CNC_EC_INFO CNC_RC_OK MotSetCaptureMode:motion.cpp(7496):MOT_CAPTURE_PROBE
17-12 16:06:34->CNC_EC_INFO CNC_RC_OK Generate:motion.cpp(9963):Position Captured->stopping
17-12 16:06:34->CNC_EC_INFO CNC_RC_OK MotSetCaptureMode:motion.cpp(7561):MOT_CAPTURE_NONE
17-12 16:06:34->CNC_EC_INFO CNC_RC_OK BackupFile:cncmem.cpp(44):Path <C:\CNC4.03\backup> already existing

17-12 16:06:34->CNC_EC_INFO CNC_RC_USER_INFO SetOriginOffsets:intgcodecmd.cpp(2081):OFFSET AND PLANE SAVED TO INI FILE
17-12 16:06:34->CNC_EC_STOP CNC_RC_ERR_MOT UpdateCncStatus:motion.cpp(11301):Z SOFTWARE POSITION LIMIT CROSSED
17-12 16:06:34->CNC_EC_INFO CNC_RC_OK Generate:motion.cpp(9968):SW limit reached->stopping
17-12 16:06:35->CNC_EC_INFO CNC_RC_OK CncAbortJob:cnccommand.cpp(596):Enter state=<RUNNING_SUB>
17-12 16:06:35->CNC_EC_INFO CNC_RC_OK CncAbortJob:cnccommand.cpp(603):Leave state=<RUNNING_SUB>
17-12 16:06:46->CNC_EC_INFO CNC_RC_OK Tracking or Hand-wheel:cnccommand.cpp(4408):Enter state=<ABORTED>
17-12 16:06:46->CNC_EC_WARNING CNC_RC_ERR_STATE Tracking or Hand-wheel:cnccommand.cpp(4570):Tracking or Hand-wheel Not allowed in state ABORTED
17-12 16:06:46->CNC_EC_INFO CNC_RC_OK Tracking or Hand-wheel:cnccommand.cpp(4574):Leave state=<ABORTED>
17-12 16:06:46->CNC_EC_INFO CNC_RC_OK Tracking or Hand-wheel:cnccommand.cpp(4408):Enter state=<ABORTED>
17-12 16:06:46->CNC_EC_WARNING CNC_RC_ERR_STATE Tracking or Hand-wheel:cnccommand.cpp(4570):Tracking or Hand-wheel Not allowed in state ABORTED
17-12 16:06:46->CNC_EC_INFO CNC_RC_OK Tracking or Hand-wheel:cnccommand.cpp(4574):Leave state=<ABORTED>
17-12 16:06:47->CNC_EC_INFO CNC_RC_OK Tracking or Hand-wheel:cnccommand.cpp(4408):Enter state=<ABORTED>
17-12 16:06:47->CNC_EC_WARNING CNC_RC_ERR_STATE Tracking or Hand-wheel:cnccommand.cpp(4570):Tracking or Hand-wheel Not allowed in state ABORTED
17-12 16:06:47->CNC_EC_INFO CNC_RC_OK Tracking or Hand-wheel:cnccommand.cpp(4574):Leave state=<ABORTED>
17-12 16:06:53->CNC_EC_INFO CNC_RC_OK RunLine:cnccommand.cpp(2684):Enter state =<ABORTED>, line=<gosub xhc_macro_5>
17-12 16:06:53->CNC_EC_WARNING CNC_RC_ERR_STATE RunLine:cnccommand.cpp(2949):Not allowed in state ABORTED
17-12 16:06:53->CNC_EC_INFO CNC_RC_OK RunLine:cnccommand.cpp(2953):Leave state=<ABORTED>
17-12 16:06:58->CNC_EC_INFO CNC_RC_OK Reset:cnccommand.cpp(1441):Enter state=<ABORTED>
17-12 16:06:58->CNC_EC_STOP CNC_RC_ERR_MOT UpdateCncStatus:motion.cpp(11301):Z SOFTWARE POSITION LIMIT CROSSED
17-12 16:06:58->CNC_EC_INFO CNC_RC_OK SetMCAGuardON:CCncKins.cpp(1313):MCAGuard switched ON
17-12 16:06:58->CNC_EC_INFO CNC_RC_OK SetTCAGuardON:CCncKins.cpp(1290):TCAGuard switched ON
17-12 16:06:58->CNC_EC_INFO CNC_RC_ERR ParseExecute:intline.cpp(1410):5->SpindleOff
17-12 16:06:58->CNC_EC_INFO CNC_RC_ERR ParseExecute:intline.cpp(1410):4->MistOff
17-12 16:06:58->CNC_EC_INFO CNC_RC_ERR ParseExecute:intline.cpp(1410):3->FloodOff
17-12 16:06:58->CNC_EC_INFO CNC_RC_USER_INFO feedov:intgcodecmd.cpp(4020):Feed OV enabled
17-12 16:06:58->CNC_EC_INFO CNC_RC_ERR ParseExecute:intline.cpp(1410):2->feedov
17-12 16:06:58->CNC_EC_INFO CNC_RC_USER_INFO speedov:intgcodecmd.cpp(4134):Speed OV enabled
17-12 16:06:58->CNC_EC_INFO CNC_RC_ERR ParseExecute:intline.cpp(1410):1->speedov
17-12 16:06:58->CNC_EC_INFO CNC_RC_OK Reset:cnccommand.cpp(1711):Ready for operation
17-12 16:06:58->CNC_EC_INFO CNC_RC_OK InitHandwheelFeedOV:fsovrunpausetask.cpp(740):curFeedOv = 1.000, m_handwheelCounterFOV = 0 m_virtualHandwheelCounterFOV = 200
17-12 16:06:58->CNC_EC_INFO CNC_RC_OK Reset:cnccommand.cpp(1732):Leave state=<READY>
17-12 16:06:58->CNC_EC_INFO CNC_RC_OK RunLine:cnccommand.cpp(2684):Enter state =<READY>, line=<gosub home_all>
krizleebear commented 1 year ago

I tried, but couldn't reproduce the problem. Also my additional logs show the right values for G92 z offset. I guess it's still a good idea to adapt the macro to not drive into a position limit.

Schallbert commented 1 year ago

OK, thanks for the update. The macro file looks pretty distinct here, as you wrote above: G0 Z[#4510 + 5] ; Taster 5mm Freifahren This command is executed after setting the non-volatile variable. But of course there could be a race condition: Imagine the save-to-ini is done in another thread that doesn't join but detach before running that line. Imagine further that saving to .ini takes a couple of seconds for whatever reason, and you'll run into the issue the title states.

This would also explain that reproducability is bad.

Nonetheless, a safe way would be to check if we have that 5mm headroom so we can ignore this line if we are above limit.

krizleebear commented 1 year ago

I like both your theory and the possible solution. Maybe a possible implementation is to store the absolute z-height (machine coords) when entering the sub-macro and returning to this height after probing.