diff --git a/manipulation/wave.py b/manipulation/wave.py index be38b72..4e35736 100644 --- a/manipulation/wave.py +++ b/manipulation/wave.py @@ -3,9 +3,9 @@ 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°) 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, each move to a stop; the swings run back to back. 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 +-> look). The way up goes like arm_route.goto, each move to a stop, the last one (into wave_start) at ARRIVE_SPEED; +the swings run back to back. 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 head. @@ -23,7 +23,8 @@ from robot import agv, arm, gripper, motion START = "wave_start" # hand above the head; the wave starts and ends here SWING = "wave" # START with J3 −14.7° SWINGS = 2 # times START -> SWING -> START -SWING_SPEED = "normal" # motion.JOINT_SPEED of the swings; the way up is arm_route.move (as goto) +SWING_SPEED = "normal" # motion.JOINT_SPEED of the swings; the way up is arm_route.SPEED ... +ARRIVE_SPEED = "normal" # ... but its last move, into START: at route speed it stopped there hard (J1 60°) # Why Lumi does not wave, (English, Korean) OFF = ("Please enable my arm first.", "먼저 제 팔을 켜 주세요.") @@ -96,7 +97,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 + if route: # up as arm_route.goto, a stop at each pose; softer into START + t0 = time.time() + log(f"arm to {' -> '.join(n for n, _ in route)}") + motion.move_path([(j, arm_route.SPEED) for _, j in route[:-1]] + [(route[-1][1], ARRIVE_SPEED)]) + log(f"arm at {START} after {time.time() - t0:.1f} s") 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() diff --git a/tests/test_wave.py b/tests/test_wave.py index 78459ee..e53c8ed 100644 --- a/tests/test_wave.py +++ b/tests/test_wave.py @@ -96,7 +96,10 @@ a.j = list(LOOK) wave.wave() 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 == [("joint_move", route, False), ("get_data", None, False)] * 2 + \ +arrive = motion.JOINT_SPEED[wave.ARRIVE_SPEED] # into wave_start softer than the route speed +assert arrive < route and wave.ARRIVE_SPEED == "normal" +assert sent == [("joint_move", route, False), ("get_data", None, False), ("joint_move", arrive, False), + ("get_data", None, False)] + \ [("joint_move", swing_s, False)] * 2 * wave.SWINGS + [("get_data", None, False)], sent # swings back to back assert wave.SWING_SPEED == "normal" arm.cmd = a