Skip to content

Commit 65dfc15

Browse files
committed
fix blend test race: terminate chain with r=0 for immediate flush
When all commands in a blend chain have r>0, the planner subprocess only flushes on a 100ms queue timeout. On slow CI machines this delay can cause wait_motion_complete to return before motion starts. Using r=0 on the final command triggers an immediate flush while producing an identical blended trajectory (last command's radius is unused).
1 parent 70dc7af commit 65dfc15

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

‎tests/integration/test_blend_lookahead.py‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ class TestJointBlendLookahead:
1212
"""Joint-space blending with N-command lookahead."""
1313

1414
def test_three_moveJ_blended_reaches_final_target(self, client, server_proc):
15-
"""Three moveJ with r>0 should blend and reach the last target."""
15+
"""Three moveJ with blend zones should reach the last target."""
1616
targets = [
1717
[80, -80, 170, 5, 5, 170],
1818
[70, -70, 160, 10, 10, 160],
1919
[60, -60, 150, 15, 15, 150],
2020
]
2121

22-
# Queue all without waiting (wait=False so they stack in the queue)
23-
for t in targets:
24-
assert client.moveJ(t, speed=0.5, r=30.0, wait=False) >= 0
22+
# r>0 on intermediate commands creates blend zones; r=0 on the last
23+
# command terminates the chain and triggers immediate planner flush.
24+
for i, t in enumerate(targets):
25+
r = 30.0 if i < len(targets) - 1 else 0.0
26+
assert client.moveJ(t, speed=0.5, r=r, wait=False) >= 0
2527

2628
# Wait for everything to finish
2729
assert client.wait_motion_complete(timeout=15.0)
@@ -77,7 +79,7 @@ class TestCartesianBlendLookahead:
7779
"""Cartesian (moveL) blending with N-command lookahead."""
7880

7981
def test_three_moveL_blended_reaches_final_target(self, client, server_proc):
80-
"""Three moveL with r>0 should blend and reach the last target."""
82+
"""Three moveL with blend zones should reach the last target."""
8183
start = client.get_pose_rpy()
8284
assert start is not None
8385

@@ -88,8 +90,12 @@ def test_three_moveL_blended_reaches_final_target(self, client, server_proc):
8890
[start[0], start[1] + 45, start[2], start[3], start[4], start[5]],
8991
]
9092

91-
for t in targets:
92-
assert client.moveL(t, speed=0.5, r=20.0, wait=False) >= 0
93+
# r>0 on intermediate commands creates blend zones; r=0 on the last
94+
# command terminates the blend chain and triggers immediate flush
95+
# (avoids a planner-timeout race with wait_motion_complete on slow CI).
96+
for i, t in enumerate(targets):
97+
r = 20.0 if i < len(targets) - 1 else 0.0
98+
assert client.moveL(t, speed=0.5, r=r, wait=False) >= 0
9399

94100
assert client.wait_motion_complete(timeout=15.0)
95101

0 commit comments

Comments
 (0)