From 9864344307cd78c3d8722e3279cc8241739bc9fe Mon Sep 17 00:00:00 2001 From: Cutshion Date: Wed, 21 Oct 2026 18:10:25 +0900 Subject: [PATCH] Arm moves one at a time with a settle pause, gentle acceleration Co-Authored-By: Claude Opus 5.5 --- manipulation/arm_route.py | 38 +++++--------------- manipulation/wave.py | 12 ++++--- robot/motion.py | 68 ++++++++++++++---------------------- tests/test_arm_route.py | 73 ++++++++++++++++++--------------------- tests/test_fetch.py | 2 +- tests/test_wave.py | 11 +++--- 6 files changed, 83 insertions(+), 121 deletions(-) diff --git a/manipulation/arm_route.py b/manipulation/arm_route.py index 33c02a1..825498c 100644 --- a/manipulation/arm_route.py +++ b/manipulation/arm_route.py @@ -16,10 +16,8 @@ motion.MAX_TRAVEL, the gripper (flange -> grasp point -> finger tips) at least H centre (vision/head_cam.py), never more than skills.PATH_SAG_MM below both ends, and with something in the hand the cup's lean at most skills.MAX_TILT_DEG. Refusals are RouteError with the reason in English and Korean. -With an empty hand the moves of a route are sent together (motion.move_path) and the arm blends through the via-points -(TOL); it stops only at the end. The blend cuts each corner inside the halves of its two moves next to the via-point, -so that cut (half of the one move to half of the next) is checked like a move too. Holding something, the arm goes one -move at a time at HOLD_SPEED. +A route runs one move at a time (motion.move_path): each to a full stop and SETTLE_S standing, then the next; SPEED +with an empty hand, HOLD_SPEED with something in it. Cobo π programs start only from `look` (start_program); hand_shaking.jks never (it hit the head, 2026-10-21). @@ -40,9 +38,7 @@ HOME = "look" # every arm action starts here EDGES = (("give", "carry"), ("carry", "look"), ("look", "wave_out"), ("wave_out", "wave_start"), ("wave_start", "wave"), ("look", "ready"), ("look", "tuck")) # the only joint moves between named poses (both ways) SPEED = "route" # motion.JOINT_SPEED of the moves along the graph, empty hand -HOLD_SPEED = "slow" # ... with something in the hand (one move at a time, each to a full stop) -TOL = 10.0 # the controller's transition radius at each via-point, empty hand (joint_move - # `tol`; the vendor gives no unit for joint moves). Estimate; 0 stops at each one +HOLD_SPEED = "slow" # ... with something in the hand AT_POSE_DEG = 3.0 # deg; the arm is at a pose when every joint is this close (where, programs) EXACT_DEG = 1.0 # deg; further than this from the nearest pose a route first goes to it JOIN_DEG = 20.0 # deg; an arm at no pose joins the graph only this close to one (every joint) @@ -184,10 +180,9 @@ def move_problem(j0, j1, centre, holding=False): return None -def check_moves(now, targets, holding=False, blend=False): +def check_moves(now, targets, holding=False): """Joint targets of the moves now -> targets[0] -> ..., as move_joints will turn them (J1 / J4 / J6 nearest), - each checked; `blend`: also the corner cut at each via-point (half way along the move before to half way along the - move after). RouteError when one must not run.""" + each checked. RouteError when one must not run.""" centre = head_cam.head_centre() if centre is None: log("arm route: the head's place is not measured (vision/head_cam.py fit)") @@ -211,12 +206,6 @@ def check_moves(now, targets, holding=False, blend=False): raise RouteError(*done[key][0]) seq.append(t) prev = t - for a, v, b in zip([list(now)] + seq, seq, seq[1:]) if blend else (): - a, v, b = np.array(a, float), np.array(v, float), np.array(b, float) - problem = move_problem((a + v) / 2, (v + b) / 2, centre, holding) - if problem: - log(f"arm route: the corner at {_r(v)} refused: {problem[1]}") - raise RouteError(*problem[0]) return seq @@ -225,12 +214,7 @@ def plan(target, holding=False, leaf=False, now=None): now = skills._joints() if now is None else now names = hops(now, target, leaf) p = motion.poses() - return list(zip(names, check_moves(now, [p[n] for n in names], holding, blend=not holding))) - - -def moves(joints, speed=SPEED): - """motion.move_path moves of an empty-hand route through `joints`: blended at every via-point.""" - return [(j, speed, TOL) for j in joints] + return list(zip(names, check_moves(now, [p[n] for n in names], holding))) def move(seq, speed=None, holding=False): @@ -239,13 +223,9 @@ def move(seq, speed=None, holding=False): if not seq: return t0 = time.time() - if holding: - for name, _ in seq: - log(f"arm to {name}") - motion.go(name, HOLD_SPEED) - else: - log(f"arm to {' -> '.join(n for n, _ in seq)}") - motion.move_path(moves([j for _, j in seq], speed or SPEED)) + log(f"arm to {' -> '.join(n for n, _ in seq)}") + s = HOLD_SPEED if holding else speed or SPEED + motion.move_path([(j, s) for _, j in seq]) log(f"arm at {seq[-1][0]} after {time.time() - t0:.1f} s") diff --git a/manipulation/wave.py b/manipulation/wave.py index 38cf1cb..165ee30 100644 --- a/manipulation/wave.py +++ b/manipulation/wave.py @@ -1,9 +1,9 @@ """Wave the hand when someone asked for it. A greeting never moves the arm. The arm goes up along the pose graph (manipulation/arm_route.py: from `look` to `wave_out`, the hand away from the -head, then `wave_start`, the hand above the head), swings between the taught poses `wave_start` and `wave` (J3 −14.7° -deg) SWINGS times and STAYS at `wave_start`: the next arm task takes it back down the same way (wave_start -> wave_out --> look). The way up goes like arm_route.goto (queued, blended through wave_out), then the swings, queued. Before +head, then `wave_start`, the hand above the head), swings between the taught poses `wave_start` and `wave` (J3 −14.7°) +SWINGS times and STAYS at `wave_start`: the next arm task takes it back down the same way (wave_start -> wave_out +-> look). The way up goes like arm_route.goto, then the swings; each move to a stop (motion.move_path). Before anything moves, every joint move is checked (arm_route.check_moves: limits, travel, the gripper clear of the head, no dip). Refused, with the reason in English and Korean: the arm off or busy, the base driving, a task running, something in the hand, the arm at no known pose (after free drive), a pose not taught, a move too near the @@ -96,9 +96,11 @@ def wave(on_start=None): log(f"wave: {len(route) + len(swings)} joint moves, checked") if on_start: on_start() - arm_route.move(route) # up exactly as arm_route.goto: queued, blended at wave_out + arm_route.move(route) # up exactly as arm_route.goto + if route and motion._stopped.wait(motion.SETTLE_S): # stand at START first, as between any two moves + raise motion.MotionError("stopped") t0 = time.time() - motion.move_path([(t, SWING_SPEED, 0.0) for t in swings]) # the swings queued: no pause between them + motion.move_path([(t, SWING_SPEED) for t in swings]) log(f"wave: {SWINGS} swings after {time.time() - t0:.1f} s") diff --git a/robot/motion.py b/robot/motion.py index cd5c60b..ba3d72d 100644 --- a/robot/motion.py +++ b/robot/motion.py @@ -27,9 +27,8 @@ TUCK = [179.3, -88.6, -13.9, -15.8, -14.5, -121.3] # deg, arm folded beside th LIMITS = [360, 125, 130, 360, 120, 360] # deg, ± factory range per joint (docs/01_HARDWARE.md) LIMIT_MARGIN = 5.0 # deg kept away from every limit JOINT_SPEED = {"slow": 10.0, "normal": 25.0, "route": 40.0} # deg/s; route: empty-hand pose-graph moves (estimate) -JOINT_ACCEL = {"slow": 30.0, "normal": 75.0, "route": 200.0} # deg/s2 (vendor: keep under 720); route: estimate LINEAR_SPEED = {"slow": 20.0, "normal": 50.0} # mm/s -ACCEL_FACTOR = 3.0 # linear moves: accel = speed x this (per s) +ACCEL_FACTOR = 3.0 # accel = speed x this (per s) MAX_FLIP = 90.0 # deg; an IK answer turning J1 / J4 / J6 more than this is refused MAX_TRAVEL = 200.0 # deg; a joint move turning any joint further is refused FULL_TURN = (0, 3, 5) # J1, J4, J6: ±360 joints; a target and target ± 360 are the same pose @@ -42,6 +41,8 @@ SLOW_DEG_S = 5.0 # deg/s; long joint moves r STILL_S = 2.0 # s without joint motion (and not there) -> the move ended short STILL_DEG = 0.05 # joint change that counts as motion BLIND_S = 1.0 # s without a valid state reply while moving -> stop the arm +SETTLE_S = 0.3 # s the arm stands at a pose before the next move (estimate; + # going straight on shook the whole robot, 2026-10-21) _stopped = threading.Event() # set by stop(): a waiting move gives up @@ -106,19 +107,9 @@ def _ready(): raise MotionError("a Cobo π program is running") -def _queue_empty(): - """The controller has no motion command left to run (get_motion_state; an odd reply counts as not empty).""" - try: - r = arm.cmd("get_motion_state") - except (ConnectionError, OSError): - return False - return r.get("queue") == 0 and r.get("active_queue", 0) == 0 - - -def _wait(arrived, limit_s, queued=False): +def _wait(arrived, limit_s): """Wait while the arm moves, at most limit_s. Big moves run far slower than the speed asked (SLOW_DEG_S), so the - limit is generous; a move that stops short is caught by STILL_S instead. `queued`: several moves were sent, so - arrived also needs the controller's queue empty (a route can pass its last pose before, a wave does).""" + limit is generous; a move that stops short is caught by STILL_S instead.""" t0 = last_move = last_seen = time.time() last = None while time.time() - t0 < limit_s: @@ -137,14 +128,13 @@ def _wait(arrived, limit_s, queued=False): last_seen = time.time() if d.get("protective_stop") or d.get("emergency_stop"): raise MotionError("the controller stopped the arm (protective / emergency stop)") - if d.get("inpos") and arrived(d) and (not queued or _queue_empty()): + if d.get("inpos") and arrived(d): return d j = d["joint_actual_position"] if last is None or max(abs(a - b) for a, b in zip(j, last)) > STILL_DEG: last, last_move = j, time.time() elif time.time() - last_move > STILL_S and time.time() - t0 > STILL_S + 1: - if queued: - stop() # the moves still queued must not run on later + stop() # nothing may run on later raise MotionError("the arm stopped before the target") time.sleep(POLL_S) stop() @@ -164,46 +154,40 @@ def nearest(target, start): def move_joints(target, speed="slow", wait=True): """Joint move to absolute angles (deg). Returns the joints reached (or the target if wait=False).""" - return move_path([(target, speed, 0.0)], wait) + return move_path([(target, speed)], wait) def move_path(moves, wait=True): - """Joint moves [(joints, speed, tol)] sent one after another without waiting between them: the controller queues - them and starts each when the one before ends (docs/04 §10). `tol` is the controller's transition radius into the - next move (it blends through that via-point instead of stopping); the last move always ends exactly. All moves - are checked before the first is sent. Waits for the last one; stop() ends the queue. Returns the joints reached - (or the last target if wait=False).""" - for t, _, _ in moves: + """Joint moves [(joints, speed)], all checked before the first is sent, then one at a time: each waits until the + arm is there (inpos, every joint within AT_JOINT_DEG) and stands SETTLE_S before the next is sent. stop() ends + it between moves too. Returns the joints reached (wait=False: the last move is not waited for, its target).""" + for t, _ in moves: check(t) _ready() - prev, planned, travel, seq = joints(), 0.0, 0.0, [] - for t, speed, tol in moves: + prev, seq = joints(), [] + for t, speed in moves: t = nearest(t, prev) for i, (a, b) in enumerate(zip(t, prev)): if abs(a - b) > MAX_TRAVEL: raise MotionError(f"J{i + 1} would turn {a - b:+.0f} deg - refused") - deg = max(abs(a - b) for a, b in zip(t, prev)) - planned += deg / JOINT_SPEED[speed] - travel += deg - seq.append((t, speed, tol)) + seq.append((t, speed, max(abs(a - b) for a, b in zip(t, prev)))) prev = t _stopped.clear() - for k, (t, speed, tol) in enumerate(seq): - extra = {"tol": tol} if tol > 0 and k < len(seq) - 1 else {} # no tol key at all on an exact move - r = arm.cmd("joint_move", relFlag=0, jointPosition=list(t), speed=JOINT_SPEED[speed], - accel=JOINT_ACCEL[speed], **extra) - if _stopped.is_set(): # STOP pressed while sending: stop again, after this move is queued + d = None + for k, (t, speed, deg) in enumerate(seq): + if k and _stopped.wait(SETTLE_S): + raise MotionError("stopped") + deg_s = JOINT_SPEED[speed] + r = arm.cmd("joint_move", relFlag=0, jointPosition=list(t), speed=deg_s, accel=deg_s * ACCEL_FACTOR) + if _stopped.is_set(): # STOP pressed while sending: stop again, after this move stop() raise MotionError("stopped") if r.get("errorCode") != "0": - if k: - stop() # the moves already queued must not run on alone raise MotionError(f"joint_move refused: {r.get('errorMsg') or r}") - target = seq[-1][0] - if not wait: - return list(target) - d = _wait(lambda d: max(abs(a - b) for a, b in zip(d["joint_actual_position"], target)) < AT_JOINT_DEG, - max(3 * planned, travel / SLOW_DEG_S) + EXTRA_S, queued=len(seq) > 1) + if not wait and k == len(seq) - 1: + return list(t) + d = _wait(lambda d, t=t: max(abs(a - b) for a, b in zip(d["joint_actual_position"], t)) < AT_JOINT_DEG, + max(3 * deg / deg_s, deg / SLOW_DEG_S) + EXTRA_S) return d["joint_actual_position"] diff --git a/tests/test_arm_route.py b/tests/test_arm_route.py index 6140b60..841b720 100644 --- a/tests/test_arm_route.py +++ b/tests/test_arm_route.py @@ -1,6 +1,7 @@ """Self-check of the pose graph (manipulation/arm_route.py) with a fake arm and toy kinematics (no robot): python tests/test_arm_route.py""" import tempfile +import threading import time from pathlib import Path @@ -22,6 +23,7 @@ motion.poses = lambda: dict(POSES) head_cam.head_centre = lambda: head["centre"] gripper.state = lambda: {"holding": False, "ai": [160]} arm_route.log = fetch.log = lambda *a: None +motion.SETTLE_S = 0.05 # quick here; the pause itself is checked below class FakeArm: @@ -134,19 +136,19 @@ refused(arm_route.NOT_TAUGHT, arm_route.goto, "wave") # no way to refused(arm_route.NOT_TAUGHT, arm_route.goto, "nowhere") POSES["wave_start"] = [0.0, -20, 20, 0, 0, 0] -# ---------- empty hand: all moves sent at once, blended at via-points, the wait only for the end; holding: one by one -- +# ---------- every move to a stop, settled, then the next: SPEED empty, HOLD_SPEED holding, old accel, no blending ---- class QueueArm(FakeArm): - """Queues joint moves like the controller: each get_data shows the next one done (and inpos, as a stop at a - via-point could); stop_program empties the queue. `on_move(k)` / `on_poll()` run before the k-th move / a poll.""" + """Queues joint moves like the controller: each get_data shows the next one done; stop_program empties the queue. + `on_move(k)` / `on_poll()` run before the k-th move / a poll. log: (command, speed, accel, keys, time).""" def __init__(self, joints, on_move=None, on_poll=None): super().__init__(joints) self.queue, self.log, self.on_move, self.on_poll = [], [], on_move, on_poll def __call__(self, name, **a): - self.log.append((name, a.get("speed"), a.get("tol"))) + self.log.append((name, a.get("speed"), a.get("accel"), set(a), time.time())) if name == "joint_move": if self.on_move: self.on_move(len(self.sent)) @@ -158,55 +160,59 @@ class QueueArm(FakeArm): self.on_poll() if self.queue: self.j = self.queue.pop(0) - return {"joint_actual_position": list(self.j), "inpos": True} + return {"joint_actual_position": list(self.j), "inpos": not self.queue} if name == "stop_program": self.queue.clear() return {"errorCode": "0"} - if name == "get_motion_state": - return {"queue": len(self.queue), "active_queue": len(self.queue), "errorCode": "0"} return super().__call__(name, **a) def moves(self): - return [(s, t) for n, s, t in self.log if n == "joint_move"] + return [(s, acc, keys) for n, s, acc, keys, _ in self.log if n == "joint_move"] def order(fake): - return [n for n, _, _ in fake.log if n in ("joint_move", "get_data")] + return [e[0] for e in fake.log if e[0] in ("joint_move", "get_data")] fake = arm.cmd = QueueArm(POSES["look"]) assert arm_route.goto("wave_start") == ["wave_out", "wave_start"] and fake.j == POSES["wave_start"] route = motion.JOINT_SPEED[arm_route.SPEED] -assert fake.moves() == [(route, arm_route.TOL), (route, None)], fake.moves() # blended at wave_out, exact at the end -assert order(fake)[:2] == ["joint_move"] * 2 and order(fake).count("get_data") >= 2, order(fake) # inpos at wave_out -fake = arm.cmd = QueueArm(POSES["look"]) # did not end the wait -arm_route.goto("wave_start", holding=True) +keys = {"relFlag", "jointPosition", "speed", "accel"} # no tol: never blended +assert fake.moves() == [(route, route * motion.ACCEL_FACTOR, keys)] * 2, fake.moves() assert order(fake) == ["joint_move", "get_data", "joint_move", "get_data"], order(fake) -assert fake.moves() == [(motion.JOINT_SPEED[arm_route.HOLD_SPEED], None)] * 2, fake.moves() -assert motion.JOINT_SPEED[arm_route.HOLD_SPEED] < route +arrived = [e for e in fake.log if e[0] == "get_data"][0][4] +second = [e for e in fake.log if e[0] == "joint_move"][1][4] +assert second - arrived >= motion.SETTLE_S * 0.9, second - arrived # stood at wave_out first +fake = arm.cmd = QueueArm(POSES["look"]) +arm_route.goto("wave_start", holding=True) +hold = motion.JOINT_SPEED[arm_route.HOLD_SPEED] +assert order(fake) == ["joint_move", "get_data", "joint_move", "get_data"], order(fake) +assert fake.moves() == [(hold, hold * motion.ACCEL_FACTOR, keys)] * 2 and hold < route, fake.moves() -# STOP while the moves are sent, or while the arm runs them: stopped, the queue emptied after the last move sent +# STOP while a move is sent, while the arm runs it, or while it stands between two: stopped, nothing more sent fake = arm.cmd = QueueArm(POSES["look"], on_move=lambda k: k == 1 and motion.stop()) try: arm_route.goto("wave_start") raise AssertionError("went on after STOP") except motion.MotionError as e: assert str(e) == "stopped" -names = [n for n, _, _ in fake.log] -assert names[-1] == "stop_program" and names.count("joint_move") == 2, names -assert fake.queue == [] and "get_data" not in names, names +names = [e[0] for e in fake.log] +assert names[-1] == "stop_program" and names.count("joint_move") == 2 and fake.queue == [], names fake = arm.cmd = QueueArm(POSES["look"], on_poll=motion.stop) try: arm_route.goto("wave_start") raise AssertionError("went on after STOP") except motion.MotionError as e: assert str(e) == "stopped" and fake.queue == [] and fake.j == POSES["look"], (e, fake.j) - -# a route through its last pose before the end (a wave): the wait ends only with the queue empty, at the end -a_, b_ = POSES["wave_start"], POSES["wave"] -fake = arm.cmd = QueueArm(a_) -motion.move_path([(b_, "slow", 0.0), (a_, "slow", 0.0), (b_, "slow", 0.0), (a_, "slow", 0.0)]) -assert fake.queue == [] and fake.j == a_ and order(fake).count("get_data") >= 4, order(fake) +fake = arm.cmd = QueueArm(POSES["look"]) +fake.on_poll = lambda: threading.Timer(0.1, motion.stop).start() # pressed just after the arrival +motion.SETTLE_S = 0.5 +try: + arm_route.goto("wave_start") + raise AssertionError("went on after STOP") +except motion.MotionError as e: + assert str(e) == "stopped" and fake.sent == [POSES["wave_out"]], fake.sent +motion.SETTLE_S = 0.05 class SlowArm(QueueArm): @@ -234,28 +240,17 @@ class SlowArm(QueueArm): extra, still = motion.EXTRA_S, motion.STILL_S motion.EXTRA_S, motion.STILL_S = 0.0, 0.5 -fake = arm.cmd = SlowArm(POSES["look"], deg_s=8.0) # 40 deg asked at 40 deg/s: planned 1 s, takes 5 s -motion.move_path(arm_route.moves([POSES["wave_out"], POSES["wave_start"]])) +fake = arm.cmd = SlowArm(POSES["look"], deg_s=8.0) # 20 deg asked at 40 deg/s: planned 0.5 s, takes 2.5 +motion.move_path([(POSES["wave_out"], "route"), (POSES["wave_start"], "route")]) assert fake.j == POSES["wave_start"] and fake.queue == [], fake.j fake = arm.cmd = SlowArm(POSES["look"], deg_s=8.0, stall_at=[0.0, -20, 5, 0, 0, 0]) # stuck on the way: stopped try: - motion.move_path(arm_route.moves([POSES["wave_out"], POSES["wave_start"]])) + motion.move_path([(POSES["wave_out"], "route"), (POSES["wave_start"], "route")]) raise AssertionError("waited on a stalled arm") except motion.MotionError as e: assert "stopped before" in str(e) and fake.queue == [] and fake.log[-1][0] == "stop_program", (e, fake.log[-1]) motion.EXTRA_S, motion.STILL_S = extra, still -# the blend's corner cut is checked: a head inside the corner at wave_out refuses the blended route, not the one by one -f, g, tip, _ = arm_route._gripper([0.0, 0.0, 0.0] + list(skills.GRASP_RPY)) -head["centre"] = np.array([0.0, -330.0, 330.0]) + g # 270+ mm from both moves, 212 from the cut -for j0, j1 in ((POSES["look"], POSES["wave_out"]), (POSES["wave_out"], POSES["wave_start"])): - assert arm_route.profile(j0, j1, head["centre"])[0] >= arm_route.HEAD_CLEAR_MM -fake = use(POSES["look"]) -refused(arm_route.NEAR_HEAD, arm_route.goto, "wave_start") -assert fake.sent == [] -assert arm_route.goto("wave_start", holding=True) == ["wave_out", "wave_start"] -head["centre"] = FAR - # ---------- Cobo π programs only from look; hand_shaking never ---------- fake = use(POSES["carry"]) refused(arm_route.NOT_AT_LOOK, arm_route.start_program, "arm_reach.jks") diff --git a/tests/test_fetch.py b/tests/test_fetch.py index ba933fd..c9e265e 100644 --- a/tests/test_fetch.py +++ b/tests/test_fetch.py @@ -240,7 +240,7 @@ speeds = [] real_go = fetch.motion.go fetch.motion.go = lambda name, speed="slow", *a, **k: (speeds.append((name, speed)), calls.append(("pose", name))) fetch.arm_route.move, fake_move = real_move, fetch.arm_route.move -fetch.motion.move_path = lambda moves, *a, **k: speeds.extend(("carry", s) for _, s, _ in moves) +fetch.motion.move_path = lambda moves, *a, **k: speeds.extend(("carry", s) for _, s in moves) arm.update(j=[0.5] * 6) fetch._pose("carry") tilt["rpy"] = up_rpy diff --git a/tests/test_wave.py b/tests/test_wave.py index 42337f6..86ef96d 100644 --- a/tests/test_wave.py +++ b/tests/test_wave.py @@ -27,6 +27,7 @@ gripper.state = lambda: {"holding": hand["holding"]} base = {"move_status": "idle"} agv.status = lambda: dict(base) wave.log = arm_route.log = lambda *a: None +motion.SETTLE_S = 0.01 # quick here (tests/test_arm_route.py checks it) class FakeArm: @@ -89,14 +90,14 @@ a.sent.clear() a.j = list(swing) # stopped at wave: back to wave_start, then swings wave.wave() assert a.sent == [top] + [swing, top] * wave.SWINGS, a.sent -names = [] # the way up as arm_route.goto sends it, then the -arm.cmd = lambda name, **k: (names.append((name, k.get("speed"), k.get("tol"))), a(name, **k))[1] # swings, each queued +names = [] # every move to a stop, then the next; the way up +arm.cmd = lambda name, **k: (names.append((name, k.get("speed"), "tol" in k)), a(name, **k))[1] # as goto a.j = list(LOOK) wave.wave() -sent = [(n, v, t) for n, v, t in names if n in ("joint_move", "get_data")] +sent = [e for e in names if e[0] in ("joint_move", "get_data")] route, swing_s = motion.JOINT_SPEED[arm_route.SPEED], motion.JOINT_SPEED[wave.SWING_SPEED] -assert sent[:3] == [("joint_move", route, arm_route.TOL), ("joint_move", route, None), ("get_data", None, None)], sent -assert sent[3:4 + 2 * wave.SWINGS] == [("joint_move", swing_s, None)] * 2 * wave.SWINGS + [("get_data", None, None)], sent +assert sent == [x for v in [route] * 2 + [swing_s] * 2 * wave.SWINGS + for x in (("joint_move", v, False), ("get_data", None, False))], sent assert wave.SWING_SPEED == "normal" arm.cmd = a a.j = list(top)