From 07b34c8e3dc4ce7c959bad8cdec8afa5ac02afa8 Mon Sep 17 00:00:00 2001 From: Luca Toniolo <10792599+grandixximo@users.noreply.github.com> Date: Fri, 18 Sep 2026 18:26:21 +1000 Subject: [PATCH] tests: kins-switch holds the joints from the program's own switch to identity The hold started at the first sample that read identity. When the abort's G13.1 has run before the program starts, that sample is the homed zeros, and the stretch after the program's G12.1 P1 at its pose counts as every joint straying. Start in identity every run, and start the hold at the change the program makes. --- tests/kins-switch/test-ui.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/kins-switch/test-ui.py b/tests/kins-switch/test-ui.py index b5c1d1363d7..9209eb2aab5 100755 --- a/tests/kins-switch/test-ui.py +++ b/tests/kins-switch/test-ui.py @@ -59,6 +59,10 @@ def mdi(cmd): c.wait_complete(30) c.home(-1) c.wait_complete(60) +# start in identity every run, the abort's G13.1 may or may not have run yet +c.mode(linuxcnc.MODE_MDI) +c.wait_complete(30) +mdi("G13.1") c.mode(linuxcnc.MODE_AUTO) c.wait_complete(30) drain() @@ -67,6 +71,7 @@ def mdi(cmd): c.program_open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "test.ngc")) c.wait_complete(30) +last = kins_type() c.auto(linuxcnc.AUTO_RUN, 0) said = [] @@ -78,8 +83,11 @@ def mdi(cmd): s.poll() now = joints() k = kins_type() - if k == 1 and at_switch is None: - at_switch = now + # the hold starts at the program's own switch to identity, at its pose + if k != last: + last = k + if k == 1 and at_switch is None: + at_switch = now if k == 1 and at_switch is not None: for j in CARRIED: strayed[j] = max(strayed[j], abs(now[j] - at_switch[j]))