Fix come here and reach for a person seen far away
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+16
-3
@@ -713,6 +713,17 @@ class Vision(threading.Thread):
|
||||
near = [t for t in self.tracks if t.distance <= 3.0]
|
||||
return near[0] if len(near) == 1 else None
|
||||
|
||||
def visible(self, track):
|
||||
"""Is this person tracked now, at any distance ("come here" is for far people; present() ends at STAY_MAX)?"""
|
||||
with self.lock:
|
||||
return track in self.tracks
|
||||
|
||||
def only_seen(self):
|
||||
"""The one person tracked, at any distance (4.7 m away, "do you see me?" yes, "come here" said "I can't see
|
||||
you", 2026-10-28), else None."""
|
||||
with self.lock:
|
||||
return self.tracks[0] if len(self.tracks) == 1 else None
|
||||
|
||||
def anyone_near(self):
|
||||
with self.lock:
|
||||
return any(t.distance <= STAY_MAX for t in self.tracks)
|
||||
@@ -2168,8 +2179,8 @@ class Lumi:
|
||||
pass
|
||||
track = None
|
||||
if self.vision:
|
||||
track = self.current if self.current and self.vision.present(self.current) else \
|
||||
self.vision.near_angle(self.voice_angle) if self.voice_trusted else self.vision.only_person()
|
||||
track = self.current if self.current and self.vision.visible(self.current) else \
|
||||
self.vision.near_angle(self.voice_angle) if self.voice_trusted else self.vision.only_seen()
|
||||
if track is not None and track.distance > REACH_COME_M: # far: go to them first, never reach from afar
|
||||
if not self.modes.drive:
|
||||
self.fetch_say(*COME_CLOSER_SAY)
|
||||
@@ -3335,8 +3346,10 @@ class Lumi:
|
||||
if not self.modes.drive:
|
||||
mouth.say("Sorry, driving is switched off.")
|
||||
return
|
||||
if track is None or not self.vision or not self.vision.present(track):
|
||||
if track is None or not self.vision or not self.vision.visible(track):
|
||||
track = self.find_caller(self.voice_angle, self.voice_trusted) # look where the voice came from
|
||||
if track is None and self.vision: # the voice unsure: the one person in view, also far
|
||||
track = self.vision.only_seen()
|
||||
if track is None:
|
||||
mouth.say("I can't see you. Could you wave or step in front of me?" if self.lang == "en"
|
||||
else "보이지 않아요. 손을 흔들거나 제 앞으로 와 주시겠어요?")
|
||||
|
||||
+21
-2
@@ -40,11 +40,17 @@ class Vision:
|
||||
def present(self, t):
|
||||
return t in self.tracks
|
||||
|
||||
visible = present
|
||||
|
||||
def only_seen(self):
|
||||
return self.tracks[0] if len(self.tracks) == 1 else None
|
||||
|
||||
def to_greet(self):
|
||||
return next((t for t in self.tracks if not t.greeted), None)
|
||||
|
||||
def only_person(self):
|
||||
return self.tracks[0] if len(self.tracks) == 1 else None
|
||||
def only_person(self): # as lumi.Vision: within 3 m
|
||||
near = [t for t in self.tracks if t.distance <= 3.0]
|
||||
return near[0] if len(near) == 1 else None
|
||||
|
||||
def nearest_greeted(self):
|
||||
return next((t for t in self.tracks if t.greeted), None)
|
||||
@@ -166,6 +172,19 @@ L.come_to(L.current, say=True)
|
||||
settle()
|
||||
assert moves and set(moves) == {S * -19}, moves
|
||||
|
||||
# ---- "come here" to the one person seen 4.7 m away, the voice unsure: drives to them (live 2026-10-28 17:42: "do you
|
||||
# see me?" yes, "come here" said "I can't see you": present() ends at STAY_MAX, only_person() at 3 m) ----
|
||||
goals = []
|
||||
lumi.agv.go_point = lambda *a: goals.append(a) or (True, "")
|
||||
L = fresh(Track(13, 187.0, 4.7))
|
||||
L.current, L.voice_angle, L.voice_trusted = None, 244.0, False
|
||||
base["move_status"] = "running"
|
||||
threading.Timer(1.0, lambda: base.update(move_status="succeeded")).start()
|
||||
L.come_to(L.current, say=True)
|
||||
settle()
|
||||
assert goals == [(2.0, 0.0, 0.0)] and L.current is not None and L.current.id == 13, (goals, L.current)
|
||||
lumi.agv.go_point = lambda *a: (True, "")
|
||||
|
||||
# ---- after turning to the voice: the person nearest its side, not the nearest one far off it ----
|
||||
heads = []
|
||||
lumi.time.sleep, real_sleep = (lambda s: None), lumi.time.sleep
|
||||
|
||||
@@ -119,7 +119,7 @@ class Track:
|
||||
|
||||
|
||||
class Vision:
|
||||
present = lambda self, t: True
|
||||
present = visible = lambda self, t: True
|
||||
|
||||
|
||||
lumi.agv.pose = lambda: (0.0, 0.0, 0.0)
|
||||
|
||||
@@ -189,7 +189,8 @@ fetch.give_bearing = lambda: 0.0
|
||||
L.fetch_finish = lambda how, **k: moved.append(how)
|
||||
L.skill_thread, L.voice_trusted = None, False
|
||||
person = types.SimpleNamespace(angle=35.0, distance=1.0, id=8)
|
||||
L.vision = types.SimpleNamespace(present=lambda t: False, near_angle=lambda a, d=25: None, only_person=lambda: person)
|
||||
L.vision = types.SimpleNamespace(present=lambda t: False, near_angle=lambda a, d=25: None, only_person=lambda: person,
|
||||
visible=lambda t: False, only_seen=lambda: person)
|
||||
L.turn_head = lambda yaw=None, pitch=None, force=False: moved.append(("head", yaw))
|
||||
for patrol, angle, want in ((False, 35.0, [35.0]), (True, 35.0, [35.0]), (False, -40.0, [-40.0]), (False, -8.0, [0.0]),
|
||||
(True, -8.0, [0.0])):
|
||||
|
||||
Reference in New Issue
Block a user