开源改变世界

执行 G2 的线性 Z 移动。没有出现在G3 #2169

推推 grbl 3年前 (2023-01-31) 315次浏览
关闭
tlight9 打开了这个问题 2022 年 11 月 30 日 · 3条评论
关闭

执行 G2 的线性 Z 移动。没有出现在G3#2169

tlight9 打开了这个问题 2022 年 11 月 30 日 · 3条评论

注释

执行 G2 的线性 Z 移动。没有出现在G3 #2169

以下是我重现该问题所遵循的步骤:

  1. 在 LCNC 2.9.0 中,在归位后的任何其他
    运动 之前 使用 G2 运行
    此 程序F1000 M30 %

这是我预期会发生的情况:我希望顺时针螺旋

这就是发生的事情:请参阅 AXIS SIm 中预期路径和实际路径的附加文件

在此之前它工作正常:相信这个错误可能是在2.8.0版本后期引入的

关于我的硬件和软件的信息:Intel(R) Core(TM) i5-6600 CPU @ 3.30GHz

也在 Rpi4 上进行了测试,结果相同

  • 我正在使用这个 Linux 发行版和版本(通常用 表示lsb_release -a):

  • 我正在使用这个内核版本(显示为uname -a):Linux 书虫 6.0.0-3-rt-amd64使用 Tcl_SetResult 和 Tcl_GetStringResult  #1 SMP PREEMPT_RT Debian 6.0.7-1 (2022-11-05) x86_64 GNU/Linux

  • 我正在使用此用户界面 (GUI)(例如 AXIS、Touchy、gmoccapy 等):AXIS Sim

执行 G2 的线性 Z 移动。没有出现在G3 #2169

执行 G2 的线性 Z 移动。没有出现在G3 #2169
powerio25 评论了 2022 年 12 月 3 日  

你好。
前段时间我遇到了这个问题,因为我在我的主人身上添加了补丁:
#1528非常大半径的短弧被解释为完整的……。
我撤销了补丁,问题消失了。

这是补丁,返回时 – 情况和问题都消失了。

src/emc/rs274ngc/gcodemodule.cc
@@ -24,6 +24,7 @@
#include "interp_return.hh"
#include "canon.hh"
#include "config.h"             // LINELEN
+#include "units.h"

int _task = 0; // control preview behaviour when remapping

@@ -998,11 +999,17 @@ static PyObject *rs274_arc_to_segments(PyObject
*self, PyObject *args) {

    double theta1 = atan2(o[Y]-cy, o[X]-cx);
    double theta2 = atan2(n[Y]-cy, n[X]-cx);
-
-   if(rot < 0) {
-        while(theta2 - theta1 > -CIRCLE_FUZZ) theta2 -= 2*M_PI;
-    } else {
-        while(theta2 - theta1 < CIRCLE_FUZZ) theta2 += 2*M_PI;
 +   /* Issue #1528 1/2/22 andypugh */
 +   /*_posemath checks for small arcs too, but uses config units */
 +   double len = hypot(o[X]-n[X], o[Y]-n[Y]) * (25.4 *
GET_EXTERNAL_LENGTH_UNITS());
    /* If the signs of the angles differ, make them the same to allow
monotonic progress through the arc */
 +   /* If start and end points are nearly identical, then interpret as
a full turn */
  + if(rot < 0) { // CW G2
  +     if (theta1 < theta2) theta2 -= 2*M_PI;
  +      if (len < CART_FUZZ) theta2 -= 2*M_PI;
  +  } else { // CCW G3
  +      if (theta1 > theta2) theta2 += 2*M_PI;
  +      if (len < CART_FUZZ) theta2 += 2*M_PI;
    }

    // if multi-turn, add the right number of full circles
10



src/libnml/posemath/_posemath.c
@@ -1812,6 +1812,7 @@ int pmCircleInit(PmCircle * const circle,
    } else {
        circle->angle = acos(dot);
    }

    /* now angle is in range 0..PI . Check if cross is antiparallel to
       normal. If so, true angle is between PI..2PI. Need to subtract
from
       2PI. */
@@ -1820,8 +1821,10 @@ int pmCircleInit(PmCircle * const circle,
    if (d < 0.0) {
        circle->angle = PM_2_PI - circle->angle;
    }
-
-   if (circle->angle > -(CIRCLE_FUZZ) && circle->angle <
(CIRCLE_FUZZ)) {
 +   /* Issue #1528 24-Jan-2022. Additional test for nearly-
straight   *
  +   * short arcs of very large radius becoming
circles               */
   + pmCartCartDisp(start, end, &d);
   + if (d < CART_FUZZ){
        circle->angle = PM_2_PI;
    }

@@ -1830,6 +1833,9 @@ int pmCircleInit(PmCircle * const circle,
        circle->angle += turn * 2.0 * PM_PI;
    }

   + /* FIXME: some code has an unguarded division by circle->angle */
   +if (circle->angle == 0) circle->angle += CIRCLE_FUZZ;
   +
    //Default to invalid
/* if 0'ed out while not debugging*/
#if 0
1
src/libnml/posemath/posemath.h
@@ -713,6 +713,7 @@ extern "C" {
// FIXME setting this to be an order of magnitude smaller than canon's
shortest
// allowed segment. This is still larger than TP's smallest position,
so it may
// be silently causing trouble.
// andypugh 5/2/22 This seems to be interpreted to be in config units.
#define CART_FUZZ (1.0e-8)
/* how close a cartesian vector's magnitude must be for it to be
considered
   a zero vector */
执行 G2 的线性 Z 移动。没有出现在G3 #2169
合作者
安迪普 评论了 2022 年 12 月 3 日  

我开始觉得这是一个比我想象的更严重的问题,或者它已经指出了一个更严重的问题。

使用此 G 代码(似乎没有要求在归位后立即执行此操作,它是可重复的)

%
G21
G90
G2 X0 Y0 Z-1 J4 F1000
G2 X0 Y0 Z-2 J4 F1000
G2 X0 Y0 Z-3 J4 F1000
G2 X0 Y0 Z-4 J4 F1000
G0 X0 Y0 Z0
M30
%

这应该是一个简单的螺旋线,可能用于螺纹铣削(通过不知道 P 参数的 CAM)

当前的 2.9 版本提供:

执行 G2 的线性 Z 移动。没有出现在G3 #2169

认为由故障补丁添加的这一行:

    /* FIXME: some code has an unguarded division by circle->angle */
    if (circle->angle == 0) circle->angle += CIRCLE_FUZZ;

而且那个0+CIRCLE_FUZZ不小于CIRCLE_FUZZ(别处的测试)我试过了

    /* FIXME: some code has an unguarded division by circle->angle */
    if (circle->angle == 0) circle->angle += CIRCLE_FUZZ / 2;

这使:
执行 G2 的线性 Z 移动。没有出现在G3 #2169

哪个更糟。

然后我尝试注释掉整行:

    /* FIXME: some code has an unguarded division by circle->angle */
    //if (circle->angle == 0) circle->angle += CIRCLE_FUZZ / 2;

那更糟。

执行 G2 的线性 Z 移动。没有出现在G3 #2169

螺旋主要被忽略。

这条特殊的线可能是转移注意力,因为真正的问题似乎是螺旋端点之间的笛卡尔距离从不小,测试应该仅限于圆弧平面。令人惊讶的可能是它完全有效。

今天我不能再做更多了,但明天会试着看看。

执行 G2 的线性 Z 移动。没有出现在G3 #2169
合作者

最初的记者用f72bd0b确认了这个问题