Bugs item #2847594, was opened at 2009-08-31 08:17
Message generated for change (Comment added) made by nobody
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=106744&aid=2847594&group_id=6744
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: G-code Interpreter
Group: None
Status: Open
Resolution: None
Priority: 1
Private: No
Submitted By: Michael (micges)
Assigned to: Nobody/Anonymous (nobody)
Summary: Wrong gcode execution if probing is in O sub
Initial Comment:
When running attached gcode from mdi 'O<setoffset> CALL' in master there is no
repetable execution of g0 after G38.2.
after some debugging it seems that interpreter doesn't wait for probe to finish
to read probed position.
File must be in PROGRAM_PREFIX directory.
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2010-05-10 12:11
Message:
narrowing down more, I tentatively have the condition where the interpreter
should wait for a G38 to finish - I'm looking for a suggestion how to make
it actually wait
Interp::synch() isnt it - any suggestions?
-Michael
rs274_pre.cc near line 250:
logDebug("!!!KL Open file is:%s:", _setup.filename);
logDebug("MDImode = %d", MDImode);
while(MDImode && _setup.call_level) // we are still in a subroutine
{
status = read(0); // reads from current file and calls parse
logDebug("status = %d\n",status);
if (status != INTERP_OK)
{
return status;
}
int exec_status = execute();
/* the following condition is true if a G38 was issued and
* the next interpreter read should wait for it to finish
*/
if ((exec_status == INTERP_EXECUTE_FINISH) &&
(_setup.probe_flag == ON)) {
printf("execute(%s) returns INTERP_EXECUTE_FINISH ,
probe_flag ON\n",
_setup.blocktext);
/* this doesnt work: Interp::synch();
*/
}
}
----------------------------------------------------------------------
Comment By: Michael Haberler (mahsofo)
Date: 2010-05-09 21:49
Message:
This bug is a race condition. I dont have a fix yet but I'm sure about the
cause.
reproduce by:
- create and load the following probe.ngc file:
f10
g38.3 z-3
g0z0
m2
- as well as testsub.ngc
O<testsub> sub
f50
g38.3 z-3
g0z0
O<testsub> endsub
m2
Reproduce race condition as follows:
(proper behaviour:)
- gdb attach to milltask
- set breakpoint on Interp::set_probe_data just after
refresh_actual_position(settings);
( emc/rs274ngc/interp_interna.cc circa line 424):
- load and execute probe.ngc
-- the g38.3 command runs several seconds
-- after it finishes, the g0z0 is executed causing the
call to setup_probe_data and break there
-- refresh_actual_position() delivers the correct
settings.current_z = -3
(faulty behaviour:)
-- gdb attach and set breakpoint as above
-- activate MDI tab and execute 'o<testsub> call'
--> break happens immediately (even before probe move starts in preview!)
consequently refresh_actual_position(settings) cannot possibly deliver a
correct end point!
other observed different behaviour:
OK case: calls to
emcTaskPlanSynch(),emcTaskPlanClearWait(),emcTaskPlanRead() etc are done
fault case: no such calls observed
Likely fix:
The loop where commands in a o-word sub are executed (rs274ngc_pr.cc:241
needs to test and wait for the probe command to finish.
I'm just lacking context how to exactly do that.
----------------------------------------------------------------------
Comment By: Michael Haberler (mahsofo)
Date: 2009-11-18 17:58
Message:
it seems that a G38.3 failed probe interacts with O-word if/then/else
in a strange way.
reproduce by:
expected behaviour:
- touchoff x,y,z to 0
- execute in MDI:
g38.3 z-3
g0 z0
- z feed moves to -3 where probe times out without contact, g0
retracts to 0 properly.
unexpected behaviour:
- same thing done through a sub stored in a file
- save subroutine below
- call in MDI with O4711 call [1] - g1 and g0 moves work as expected
- call in MDI with O4711 call [0] - G38 probe times out, following
G0Z0 is NOT executed, z remains at -3
if the G0 Z0 move is changed to a Z value <> 0, it actually IS executed.
It seems in the else path emc thinks it actually already is at 0 while
it's actually at -3 - which doesnt happen when executed in manually in
MDI
-Michael
save this as 4711.ngc :
------------------snip------
O4711 sub
f50
O102 if [#1 GT 0]
(debug, normal g1/g0 moves)
g1 z-3
g0 z0
O102 else
(debug, probe without contact, then retract)
g38.3 z-3
; the following move is NOT executed:
g0 z0
; if z <> 0, it actually IS executed
; these ones ARE executed:
g0 x5
g0 y3
O102 endif
O4711 endsub
m2
---------------- snip ----
----------------------------------------------------------------------
Comment By: Jeff Epler (jepler)
Date: 2009-08-31 20:41
Message:
With interp list debugging turned on, the last messages are as follows:
good:
NML_INTERP_LIST::append(nml_msg{size=116,type=EMC_TRAJ_PROBE}) :
list_size=5, line_number=9
NML_INTERP_LIST::append(nml_msg{size=84,type=EMC_TRAJ_SET_OFFSET}) :
list_size=6, line_number=9
NML_INTERP_LIST::append(nml_msg{size=116,type=EMC_TRAJ_LINEAR_MOVE}) :
list_size=7, line_number=15
bad:
NML_INTERP_LIST::append(nml_msg{size=116,type=EMC_TRAJ_PROBE}) :
list_size=5, line_number=9
NML_INTERP_LIST::append(nml_msg{size=84,type=EMC_TRAJ_SET_OFFSET}) :
list_size=6, line_number=9
(ends)
----------------------------------------------------------------------
Comment By: Jeff Epler (jepler)
Date: 2009-08-31 20:38
Message:
How to reproduce:
1. Apply the attached patch, which sets up a simulated probe input that
always trips at machine Z = -1inch
2. Run configs/sim/axis.ini
3. F1 F3 ctrl-home F5
4. twice: MDI O<setoffset> call
Expected behavior: moves to 50,50,-3 (mm)
Actual behavior: half the time, stops at 0,0,~0 (mm)
Debug trace from "good" iteration:
Issuing EMC_TASK_PLAN_EXECUTE -- (+509,+268,
+20,O<setoffset>\032call,)
Outgoing motion id is 4.
Issuing EMC_TRAJ_LINEAR_MOVE -- (+220,+116,
+0,0.393701,0.393701,-0.118110,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,
+1,5.656854,5.656854,141.421356, +0,)
Outgoing motion id is 6.
Issuing EMC_TRAJ_LINEAR_MOVE -- (+220,+116,
+0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,
+1,5.782733,5.782733,144.568323, +0,)
Motion id 4 took 0.892025 seconds.
Motion id 6 took 0.479902 seconds.
Motion id 0 took 0.000004 seconds.
Issuing EMC_TRAJ_SET_OFFSET -- (+223,+84,
+0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,)
Issuing EMC_TRAJ_CLEAR_PROBE_TRIPPED_FLAG -- (+228,+12, +0,)
Outgoing motion id is 9.
Issuing EMC_TRAJ_PROBE -- (+229,+116,
+0,0.000000,0.000000,-1.968504,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,
+5,0.656168,4.000000,100.000000,\000,)
Motion id 9 took 1.558276 seconds.
Motion id 0 took 0.000003 seconds.
Issuing EMC_TRAJ_SET_OFFSET -- (+223,+84,
+0,0.000000,0.000000,-1.009471,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,)
Issuing EMC_OPERATOR_DISPLAY -- (+13,+272, +0,
+0,new\032length\032is\032-25.640570,)
Outgoing motion id is 16.
Issuing EMC_TRAJ_LINEAR_MOVE -- (+220,+116,
+0,1.968504,1.968504,-0.118110,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,
+1,5.943650,5.943650,148.591251, +0,)
Motion id 16 took 2.451898 seconds.
Motion id 0 took 0.000004 seconds.
For a bad iteration:
Issuing EMC_TASK_PLAN_EXECUTE -- (+509,+268,
+21,O<setoffset>\032call,)
Outgoing motion id is 4.
Issuing EMC_TRAJ_LINEAR_MOVE -- (+220,+116,
+0,0.393701,0.393701,-0.118110,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,
+1,5.656854,5.656854,141.421356, +0,)
Outgoing motion id is 6.
Issuing EMC_TRAJ_LINEAR_MOVE -- (+220,+116,
+0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,
+1,5.782733,5.782733,144.568323, +0,)
Motion id 4 took 1.863693 seconds.
Motion id 6 took 0.480222 seconds.
Motion id 0 took 0.000003 seconds.
Issuing EMC_TRAJ_SET_OFFSET -- (+223,+84,
+0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,)
Issuing EMC_TRAJ_CLEAR_PROBE_TRIPPED_FLAG -- (+228,+12, +0,)
Outgoing motion id is 9.
Issuing EMC_TRAJ_PROBE -- (+229,+116,
+0,0.000000,0.000000,-1.968504,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,
+5,0.656168,4.000000,100.000000,\000,)
Motion id 9 took 1.550620 seconds.
Motion id 0 took 0.000004 seconds.
Issuing EMC_TRAJ_SET_OFFSET -- (+223,+84,
+0,0.000000,0.000000,-1.009471,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,)
Issuing EMC_OPERATOR_DISPLAY -- (+13,+272, +0,
+0,new\032length\032is\032-25.640570,)
(ends here)
----------------------------------------------------------------------
Comment By: Michael (micges)
Date: 2009-08-31 08:19
Message:
more info:
http://www.linuxcnc.org/irc/irc.freenode.net:6667/emc/2009-08-28.txt
about time 13:40
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=106744&aid=2847594&group_id=6744
------------------------------------------------------------------------------
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers