I've looked into this a bit more - it is definitely a race condition. The interpreter inner loop which reads and executes a o-word block fails to wait for a G38 to finish and immediately executes the next command which explains the erratic coordinate results observed thereafter (near emc/rs274ngc/rs274ngc_pre.cc line 241). It also behaves differently from normal main loop executing an .ngc file (no calls to emcTaskPlanSynch(),emcTaskPlanClearWait(),emcTaskPlanRead() etc).
I dont have a fix - loop behaves different from the actual main loop, but I'm unsure which code needs to be copied from where. Maybe somebody with more clue about the interpreter internals could give me a hint. I've posted these notes to the tracker at https://sourceforge.net/tracker/index.php?func=detail&aid=2847594&group_id=6744&atid=106744 . -Michael ---- reproduce by: - touch off at 0/0/0 - 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. ------------------------------------------------------------------------------ _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
