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
+13 -9
View File
@@ -12,7 +12,8 @@ from vision import head_cam
fetch.STATE_FILE = Path(tempfile.mkdtemp()) / "lumi_task.json" # never the real /dev/shm file
POSES = {"look": [0.0] * 6, "carry": [20.0, 0, 0, 0, 0, 0], "give": [40.0, 0, 0, 0, 0, 0],
"wave_start": [0.0, -20, 0, 0, 0, 0], "wave": [0.0, -20, 20, 0, 0, 0], "ready": [0.0, 0, -20, 0, 0, 0],
"wave_out": [0.0, -20, 0, 0, 0, 0], "wave_start": [0.0, -20, 20, 0, 0, 0],
"wave": [0.0, -20, 20, 0, 20, 0], "ready": [0.0, 0, -20, 0, 0, 0],
"tuck": [-20.0, 0, 0, 0, 0, 0]}
FAR = np.array([0.0, 0.0, 5000.0]) # the head far away: nothing near it
head = {"centre": FAR}
@@ -78,15 +79,18 @@ use(POSES["give"])
assert arm_route.goto("look") == ["carry", "look"] # after giving: give -> carry -> look
assert arm_route.goto("give") == ["carry", "give"] # to give: look -> carry -> give
use(POSES["wave"])
assert arm_route.goto("tuck") == ["wave_start", "look", "tuck"] # fold: through look
assert arm_route.goto("tuck") == ["wave_start", "wave_out", "look", "tuck"] # fold: through look
use(POSES["look"])
assert arm_route.goto("wave_start") == ["wave_out", "wave_start"] # up: never look -> wave_start directly
assert {"look", "wave_start"} not in [set(e) for e in arm_route.EDGES]
# ---------- after a wave the arm stays up; the next pick goes wave -> wave_start -> look first ----------
fake = use(POSES["wave"])
# ---------- after a wave the arm stays at wave_start; the next pick goes down through wave_out first ----------
fake = use(POSES["wave_start"])
skills._prepare()
assert fake.sent == [POSES["wave_start"], POSES["look"]], fake.sent
fake = use(POSES["wave"])
assert fake.sent == [POSES["wave_out"], POSES["look"]], fake.sent
fake = use(POSES["wave_start"])
fetch._pose("look")
assert fake.sent == [POSES["wave_start"], POSES["look"]], fake.sent
assert fake.sent == [POSES["wave_out"], POSES["look"]], fake.sent
# ---------- an unknown pose near a known one: a checked joint move to it, then on ----------
near = [3.0, 2.0, -4.0, 5.0, 0.0, 0.0] # 5 deg from look (free drive)
@@ -113,7 +117,7 @@ for start in (POSES["look"], near, POSES["give"]):
refused(arm_route.NEAR_HEAD, arm_route.goto, "give" if start != POSES["give"] else "look")
assert fake.sent == [], fake.sent
fake = use(POSES["look"])
assert arm_route.goto("wave") == ["wave_start", "wave"] # another edge: clear of it
assert arm_route.goto("wave") == ["wave_out", "wave_start", "wave"] # other edges: clear of it
head["centre"] = None # the head not measured: nothing moves
refused(arm_route.UNSURE, arm_route.goto, "look")
head["centre"] = FAR
@@ -125,7 +129,7 @@ POSES["give"] = [40.0, 0, 0, 0, 0, 0]
del POSES["wave_start"]
refused(arm_route.NOT_TAUGHT, arm_route.goto, "wave") # no way to wave without wave_start
refused(arm_route.NOT_TAUGHT, arm_route.goto, "nowhere")
POSES["wave_start"] = [0.0, -20, 0, 0, 0, 0]
POSES["wave_start"] = [0.0, -20, 20, 0, 0, 0]
# ---------- Cobo π programs only from look; hand_shaking never ----------
fake = use(POSES["carry"])