Answer waving people at once while driving with the hand raised

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 11:04:26 +09:00
co-authored by Claude Opus 5.5
parent 57a0160f38
commit 2d92ba1f13
2 changed files with 17 additions and 7 deletions
+11 -6
View File
@@ -547,6 +547,8 @@ LOW_BATTERY, RESUME_BATTERY = 5, 60 # %
PAUSE_AT_END = 3.0 # s to wait at each patrol point PAUSE_AT_END = 3.0 # s to wait at each patrol point
PASSER_WAVE_EVERY_S = 15.0 # s; a drive with the hand up stops to wave at people at most this often (else the PASSER_WAVE_EVERY_S = 15.0 # s; a drive with the hand up stops to wave at people at most this often (else the
# same person is waved at again and again; estimate) # same person is waved at again and again; estimate)
WAVER_AGAIN_S = 3.0 # s after a drive's swings before someone waving stops it again (they are still
# waving at the swings they got; estimate)
DOCK_QUIET_M = 2.0 # m; on the way to the dock nearer than this no stop for a wave (the docking starts DOCK_QUIET_M = 2.0 # m; on the way to the dock nearer than this no stop for a wave (the docking starts
# there and a stop undid it; estimate) # there and a stop undid it; estimate)
PASSER_MARKERS = "line" # drives to markers named so stop to wave at everyone passing; to the others only at PASSER_MARKERS = "line" # drives to markers named so stop to wave at everyone passing; to the others only at
@@ -881,6 +883,7 @@ class Patrol:
self.dock_leg = False # this leg goes to the dock: a stop near it undid the docking (dock_far) self.dock_leg = False # this leg goes to the dock: a stop near it undid the docking (dock_far)
self.waving = None # the thread swinging for people passing (wave_greet.passer_wave) self.waving = None # the thread swinging for people passing (wave_greet.passer_wave)
self.wave_after = 0.0 # no wave for passers before this (PASSER_WAVE_EVERY_S) self.wave_after = 0.0 # no wave for passers before this (PASSER_WAVE_EVERY_S)
self.waver_after = 0.0 # nor for someone waving (WAVER_AGAIN_S after the last swings)
self.mode = "patrol" # patrol | going_home | charging | done self.mode = "patrol" # patrol | going_home | charging | done
self.moving = False # a move that we started is running self.moving = False # a move that we started is running
self.progress = None # (pose, time) of the last movement, to notice a stuck drive self.progress = None # (pose, time) of the last movement, to notice a stuck drive
@@ -925,12 +928,12 @@ class Patrol:
return return
if self.moving: if self.moving:
if ms == "running" and self.hand_up and now >= self.wave_after and wave_greet_on(): if ms == "running" and self.hand_up and now >= self.waver_after and wave_greet_on():
self.wave_after = now + 1.0 # asked about once a second while driving target = self.route[self.i] # someone waving: answered every time (WAVER_AGAIN_S);
target = self.route[self.i] waver = wave_greet._waver() and (not self.dock_leg or self.dock_far(st)) # anyone else on the
waver = wave_greet._waver() and (not self.dock_leg or self.dock_far(st)) passer = now >= self.wave_after and not self.dock_leg and isinstance(target, str) and \
if waver or not self.dock_leg and isinstance(target, str) and target.startswith(PASSER_MARKERS) and \ target.startswith(PASSER_MARKERS) and wave_greet._someone_within(wave_greet.GREET_M) # lines
wave_greet._someone_within(wave_greet.GREET_M): if waver or passer:
self.pause() # the base stops; the next tick drives on to the same marker self.pause() # the base stops; the next tick drives on to the same marker
self.wave_after = now + PASSER_WAVE_EVERY_S self.wave_after = now + PASSER_WAVE_EVERY_S
self.waving = threading.Thread(target=self.passer_wave, daemon=True) self.waving = threading.Thread(target=self.passer_wave, daemon=True)
@@ -1016,6 +1019,8 @@ class Patrol:
except Exception as e: except Exception as e:
log(f"patrol ended: the arm stopped ({e!r})") log(f"patrol ended: the arm stopped ({e!r})")
self.mode = "done" self.mode = "done"
finally:
self.waver_after = time.time() + WAVER_AGAIN_S
class Modes: class Modes:
+6 -1
View File
@@ -58,7 +58,9 @@ IDLE_WAVE_EVERY_S = 15.0 # s between two waves while nothing is asked of Lum
IDLE_SWINGS = 3 # swings of such a wave IDLE_SWINGS = 3 # swings of such a wave
IDLE_CLEAR_M = 1.0 # m; nobody this near in either camera when such a wave starts (one coming closer while the IDLE_CLEAR_M = 1.0 # m; nobody this near in either camera when such a wave starts (one coming closer while the
# arm goes up still stops it: _too_close); estimate # arm goes up still stops it: _too_close); estimate
IDLE_RETRY_S = 1.0 # s between two asks whether Lumi is idle (it asks the base whether it charges) RAISE_WAIT_S = 10.0 # s a drive waits for someone right by the arm to step back before the hand goes up
# (else it drives in look); estimate
IDLE_RETRY_S = 1.0 # s between two asks whether Lumi is idle (it asks the base whether it charges)
CLOSE_FRESH_S = 1.5 # s a camera service detection counts for the too-close check CLOSE_FRESH_S = 1.5 # s a camera service detection counts for the too-close check
_seen = {c: {"t": 0.0, "wavers": []} for c in CAMERAS} # wavers: [(bearing deg from the waist's front, + left; _seen = {c: {"t": 0.0, "wavers": []} for c in CAMERAS} # wavers: [(bearing deg from the waist's front, + left;
@@ -373,6 +375,9 @@ def raise_for_drive():
return False return False
if arm_route.where() in arm_route.WAVE_POSES: if arm_route.where() in arm_route.WAVE_POSES:
return True return True
end = time.time() + RAISE_WAIT_S # someone right by the arm (the one who sent Lumi): they step back
while _too_close() and time.time() < end: # first, else the guard stops the way up and the greeting is off
time.sleep(0.2)
if _too_close(): if _too_close():
log("a drive: someone right by me, the hand stays down") log("a drive: someone right by me, the hand stays down")
return False return False