Tool radius compensation error originally reported on dev mail list.
msg: "Tool radius not less than arc radius with comp"
observed in 2.5.4 and master 9c339d7
Reproduced with simplified example:
$ cat arcfail.ngc
; simple test using g42.1 try with/without block_delete
; interp_convert.cc CHKS fabs cos A_ang
g17 (xy plane)
g21 (mm)
g40 (cancel cutter radius compensation)
g49 (cancel tool lengthoffset)
g90 (absolute distance mode)
g94 (units/min feedrate)
g54 (Coordinate system 1 default)
o1 if [ #5400 NE 0]
(debug, use no tool for this test: g42.1)
m2
o1 endif
f 100
g0 x 5.0005 y 5.0005
g0 x 5.0005 y 0.0000
/ g42.1 D 10
g2 x 0.0000 y 5.0005 i 0.0000 j 5.0005
g40
m2
msg: "Tool radius not less than arc radius with comp"
debug output using debug print statements below:
emc/rs274ngc/interp_arc.cc:119 arc_radius=5.000500 tool_radius=5.000000
ok
emc/rs274ngc/interp_convert.cc:695 A_ang=-1.570696 cos=0.000100 fabs(cos)=0.000100 TOLERANCE_EQUAL=0.000100
(fails)
example debug print statements:
diff --git a/src/emc/rs274ngc/interp_arc.cc b/src/emc/rs274ngc/interp_arc.cc
index 5011430..4d3bbdc 100644
--- a/src/emc/rs274ngc/interp_arc.cc
+++ b/src/emc/rs274ngc/interp_arc.cc
@@ -116,9 +116,11 @@ int Interp::arc_data_comp_ijk(int move, //!<either G_2 (cw arc) or G_3 (ccw arc
a, end_x, b, end_y, arc_radius, radius2,
abs_err, rel_err*100);
+fprintf(stdout,"%s:%d arc_radius=%f tool_radius=%f\n",FILE,LINE ,arc_radius,tool_radius);
CHKS(((arc_radius <= tool_radius) && (((side == LEFT) && (move == G_3)) ||
((side == RIGHT) && (move == G_2)))),
NCE_TOOL_RADIUS_NOT_LESS_THAN_ARC_RADIUS_WITH_COMP);
+fprintf(stdout,"ok\n");
/ This catches an arc too small for the tool, also /
if (move == G_2)
diff --git a/src/emc/rs274ngc/interp_convert.cc b/src/emc/rs274ngc/interp_convert.cc
index 4319334..d40d589 100644
--- a/src/emc/rs274ngc/interp_convert.cc
+++ b/src/emc/rs274ngc/interp_convert.cc
@@ -692,7 +692,9 @@ int Interp::convert_arc_comp1(int move, //!< either G_2 (cw arc) or G_3 (ccw ar
double AB_ang = atan2(center_y - end_y, center_x - end_x);
double A_ang = atan2(cy - end_y, cx - end_x) - AB_ang;
sourceforge changed _FILE_,_LINE_ in fprintf above
Last edit: Dewey Garrett 2014-01-27
The arcfail.ngc program needs "g91.1 (relative arc centers)" in the preamble.
Chris and I discussed this on IRC some: http://psha.org.ru/irc/%23emc-devel/2014-01-28.html#00:39:02
We both came to the conclusion that arcfail.ngc is supposed to be rejected by the current interpreter because the compensated arc is smaller than the smallest allowed arc: the arc radius is below the minimum arc radius of 0.001 mm. (See http://www.linuxcnc.org/docs/2.5/html/gcode/gcode.html#_center_format_arcs )
Chris pointed out that the error message could be much better, and that there may be an improvement possible that would allow the program to be accepted.
quoted from the IRC log: a separate check for this case that gives an error like "Arc entry move is degenerate because arc and tool radii are nearly the same", or a special case that lets it decay into a line, would be the two possible fixes I can picture
I'm leaving this open but postponing. Possibly we can fix it in a later branch, one of these two ways.