diff --git a/assistant/lumi.py b/assistant/lumi.py index d688d2f..93cd606 100644 --- a/assistant/lumi.py +++ b/assistant/lumi.py @@ -1988,7 +1988,8 @@ class Lumi: if kind == "receive": self.receive_from_hand(what, held) elif kind == "refuse": - self.fetch_say(*what) + if not (what == brain_mod.REFUSE_OPEN and self.release_giving()): + self.fetch_say(*what) elif not held: mouth.say(EMPTY_HAND_SAY[self.lang]) else: @@ -2134,6 +2135,17 @@ class Lumi: self.skill_thread.start() self.keep_listening() + @staticmethod + def release_giving(): + """The hand held out to someone (fetch's hand-over, waiting for them to take it): "open your hand", "release", + "let go" open it as "thank you" does. True when it was handing over.""" + from tasks import fetch + if (safe(fetch.state) or {}).get("step") != "giving": + return False + log(" open while handing over: releasing") + fetch.release_now() + return True + def arm_pose(self, target): """'reach': the hand out to the person (reach_out); 'fold' / 'carry' / 'ready': to look / that pose along the pose graph (arm_route, checked first, moved in the background); 'open' / 'close': the gripper, never opened on something held. True when @@ -2141,6 +2153,8 @@ class Lumi: from tasks import fetch held = target in ("reach", "open") and self.held_now() if target == "open" and held: # the model's "let go" while holding: it would fall + if self.release_giving(): + return True log(" open refused: holding something") self.fetch_say(*brain_mod.REFUSE_OPEN) return None diff --git a/docs/TUNING.md b/docs/TUNING.md index 7efb39b..5b0060c 100644 --- a/docs/TUNING.md +++ b/docs/TUNING.md @@ -6,8 +6,8 @@ Every value here is a constant at the top of its file, with a comment on what it | File | Name | Default | What it does | |---|---|---|---| -| `robot/motion.py` | `JOINT_SPEED` | slow 10, normal 25, fast 40, quick 50, route 60 °/s | Joint move speeds. "normal" / "route" are the dashboard's Arm pose card "Normal" / "Fast"; route = the Cobo π joint speed limit (60) | -| `robot/motion.py` | `LINEAR_SPEED` | slow 20, normal 50 mm/s | Straight move speeds | +| `robot/motion.py` | `JOINT_SPEED` | slow 20, normal 50, quick 50, route 60 °/s | Joint move speeds. "normal" / "route" are the dashboard's Arm pose card "Normal" / "Fast"; route = the Cobo π joint speed limit (60) | +| `robot/motion.py` | `LINEAR_SPEED` | slow 40, normal 100 mm/s | Straight move speeds | | `robot/motion.py` | `ACCEL_FACTOR` | 3.0 | Straight moves: acceleration = speed × this per second | | `robot/motion.py` | `JOINT_ACCEL_FACTOR` | 1.5 | Joint moves: acceleration = speed × this per second (route 60 °/s², normal 37.5, slow 15). Lower = softer start and stop, longer moves. Estimate | | `manipulation/arm_route.py` | `SPEED` | "route" | Joint moves along the pose graph (to `look`, `carry`, `give`, `ready`, `wave_out`, `wave_start`, `wave`) with an empty hand; the wave's way up | diff --git a/robot/motion.py b/robot/motion.py index 6df4c54..4b7e20c 100644 --- a/robot/motion.py +++ b/robot/motion.py @@ -25,8 +25,9 @@ ROOT = Path(__file__).resolve().parents[1] # the project folder POSES_FILE = ROOT / "data" / "arm_poses.json" 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, "fast": 40.0, "quick": 50.0, "route": 60.0} # deg/s; route: empty-hand pose-graph moves (the Cobo π joint speed limit, 60) -LINEAR_SPEED = {"slow": 20.0, "normal": 50.0} # mm/s +JOINT_SPEED = {"slow": 20.0, "normal": 50.0, "quick": 50.0, "route": 60.0} # deg/s; slow / normal doubled for picks and + # puts (owner, 2026-10-29); route: empty-hand pose-graph moves (the Cobo π joint speed limit, 60) +LINEAR_SPEED = {"slow": 40.0, "normal": 100.0} # mm/s; slow / normal doubled for picks and puts (owner, 2026-10-29) ACCEL_FACTOR = 3.0 # straight moves: accel = speed x this (per s) JOINT_ACCEL_FACTOR = 1.5 # joint moves: accel = speed x this (per s); estimate: x 3 # stopped at each pose with a jolt that shook the robot diff --git a/tests/test_wave.py b/tests/test_wave.py index 2b33673..6e18f5f 100644 --- a/tests/test_wave.py +++ b/tests/test_wave.py @@ -261,4 +261,14 @@ L.current = track L.end_conversation("bye bye") assert waves == [] assert calls == [], calls + +# ---------- "open your hand" while handing a thing over: released as "thank you" does; elsewhere refused ---------- +released = [] +real_state, real_rel = fetch.state, fetch.release_now +fetch.release_now = lambda: released.append(1) +fetch.state = lambda: {"step": "giving", "holding": True} +assert L.release_giving() is True and released == [1] +fetch.state = lambda: {"step": "holding", "holding": True} +assert L.release_giving() is False and released == [1] +fetch.state, fetch.release_now = real_state, real_rel print("wave ok")