Wave along the taught poses: look, wave_out, wave_start, three swings to wave

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 17:34:00 +09:00
co-authored by Claude Opus 5.5
parent a50fdc9c0d
commit 19325ee3b6
5 changed files with 85 additions and 43 deletions
+22 -21
View File
@@ -1,27 +1,27 @@
"""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_start`, the hand away from the
head, then `wave`, raised), swings one wrist joint there and STAYS at `wave`: the next arm task takes it back down
the same way (wave -> wave_start -> look). 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.
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` (J5 +21.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). 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.
python manipulation/wave.py check # plan and check from where the arm is now; moves nothing
python manipulation/wave.py run # wave (slow; the owner at the STOP)
Teach the route first, arm moved by hand in Cobo π: python robot/motion.py teach wave_start / teach wave
Teach the poses first, arm moved by hand in Cobo π: python robot/motion.py teach wave_out / wave_start / wave
"""
import sys
from manipulation import arm_route, skills
from robot import agv, arm, gripper, motion
TOP = "wave" # the raised pose (arm_route.EDGES: look - wave_start - wave)
WAVE_JOINT = 4 # joint index swung at the raised pose (4 = J5); check on the first slow run
WAVE_DEG = 15.0 # deg each way from the raised pose
WAVE_SWINGS = 2 # times there and back
WAVE_SPEED = arm_route.SPEED # motion.JOINT_SPEED; the route and the swings
START = "wave_start" # hand above the head; the wave starts and ends here
SWING = "wave" # START with J5 +21.7 deg (taught 2026-10-21)
SWINGS = 3 # times START -> SWING -> START
SWING_SPEED = "slow" # motion.JOINT_SPEED of the swings; the way up is arm_route.SPEED
# Why Lumi does not wave, (English, Korean)
OFF = ("Please enable my arm first.", "먼저 제 팔을 켜 주세요.")
@@ -71,12 +71,12 @@ def plan():
raise WaveError(*HOLDING)
now = motion.joints()
try:
route = arm_route.plan(TOP, now=now) # up along the graph ([] when it is up already)
start = route[-1][1] if route else now
top = motion.nearest(motion.poses()[TOP], start)
i = WAVE_JOINT
swings = [top[:i] + [top[i] + s * WAVE_DEG] + top[i + 1:] for _ in range(WAVE_SWINGS) for s in (1, -1)]
seq = [j for _, j in route] + arm_route.check_moves(start, ([] if route else [top]) + swings + [top])
route = arm_route.plan(START, now=now) # up along the graph ([] when it is there already)
p = motion.poses()
if SWING not in p:
raise arm_route.RouteError(*arm_route.NOT_TAUGHT)
seq = [j for _, j in route] + arm_route.check_moves(route[-1][1] if route else now,
[p[SWING], p[START]] * SWINGS)
except arm_route.RouteError as e:
raise WaveError(*{arm_route.UNKNOWN: UNKNOWN_POSE, arm_route.NOT_TAUGHT: NOT_TAUGHT,
arm_route.BLOCKED: NOT_TAUGHT, arm_route.NEAR_HEAD: NEAR_HEAD}.get(e.args, UNSURE)) from e
@@ -84,7 +84,7 @@ def plan():
def wave(on_start=None):
"""Plan, check and wave; the arm stays at TOP. `on_start()` is called once the plan is checked.
"""Plan, check and wave; the arm stays at START. `on_start()` is called once the plan is checked.
Raises WaveError (refused) or motion.MotionError (stopped / failed while moving: the arm stays where it stopped)."""
try:
seq = plan()
@@ -94,8 +94,9 @@ def wave(on_start=None):
log(f"wave: {len(seq)} joint moves, checked")
if on_start:
on_start()
for t in seq:
motion.move_joints(t, WAVE_SPEED)
up = len(seq) - 2 * SWINGS # the moves before are the way up along the graph
for k, t in enumerate(seq):
motion.move_joints(t, arm_route.SPEED if k < up else SWING_SPEED)
if __name__ == "__main__":