Keep words said after Lumi's own voice, search wider for callers and follow round blocked turns
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -718,7 +718,7 @@ INTENTS = [ # (action, pattern) checked in order on what the visitor said
|
||||
("come", r"\bcome (?:back )?(here|hear|to me|closer|over here|over|this way)\b|\bcome\b(?! back for (?:me|us)\b).*\bme\b|이리 ?(?:좀 ?)?(?:돌아 ?)?(?:와|오세요|오십시오|올래)|"
|
||||
r"(?:여기로|이쪽으로) ?(?:좀 ?)?(?:돌아 ?)?(?:와|오세요|오십시오)|가까이 ?(?:좀 ?)?(?:와|오세요)|"
|
||||
r"나한테 ?(?:돌아 ?)?와"),
|
||||
("go_home", r"\bgo (back )?(home|to (the |your )?(dock(?!2)|charger|charging))|\bhead (back )?to (the |your )(dock(?!2)|charger)\b|\bgo (re)?charge|충전하러|차지하러|집(?:에|으로) ?가|충전기로"),
|
||||
("go_home", r"\bgo (back )?(home|to (the |your )?(dock(?!2)|charger|charging))|\bhead (back )?to (the |your )(dock(?!2)|charger)\b|\bgo (re)?charg(e|ing)\b|충전하러|차지하러|집(?:에|으로) ?가|충전기로"),
|
||||
("go_point", r"\b(?:go|drive|move|head|come|return|walk|roll|run|proceed|navigate|travel|hurry|make your way|get|take yourself)"
|
||||
r"(?: back)?(?: over| on| ahead)?(?: to| too| 2|to) (?:the )?(?:point |marker )?([a-z][a-z0-9_]*|[가-힣][가-힣0-9_]*?)\b|(\d+)\s*번\s*(?:으로|포인트)"
|
||||
r"|^\W*(?:(?:루미야?|lumi|hey lumi)\W*)?(?:[a-z][a-z0-9_]*\s*말고\s+)?(?:좀\s*)?(?:point\s+)?([a-z][a-z0-9_]*|[가-힣][가-힣0-9_]*?)\s*(?:포인트\s*)?(?:앞|쪽|방향|지점|위치)?\s*"
|
||||
@@ -1858,7 +1858,7 @@ def _recase(t, text):
|
||||
# ---------- fetch tasks (docs/16 §4): strict parsing, nothing is guessed ----------
|
||||
_HERE = r"here|me|여기|이쪽|나한테|저한테|나에게|저에게"
|
||||
_HOME = r"home|charger|charging station|dock|충전기|충전소"
|
||||
_CHARGER_WORD = r"\bcharg(?:er|ing)\b|\bgo (?:re)?charge\b|충전|차지하러" # the charger, not home, when the map has one
|
||||
_CHARGER_WORD = r"\b(?:re)?charg(?:er|ing)\b|\bgo (?:re)?charge\b|충전|차지하러" # the charger, not home, when the map has one
|
||||
|
||||
|
||||
def charger(markers):
|
||||
|
||||
+29
-10
@@ -390,6 +390,8 @@ LOOK_ME_PITCH = 0.0 # deg, head pitch of the first turn to a pers
|
||||
LOOK_ME_SETTLE_S = 0.6 # s after a head move before its camera is asked who is there
|
||||
LOOK_ME_MAX_M = 6.0 # m; "look at me" finds callers up to this far (others count only within STAY_MAX)
|
||||
LOOK_ME_BODY_DEG = 5.0 # deg past the head's yaw limit before the body turns to face the person
|
||||
LOOK_ME_SWEEP_DEG = 110.0 # deg the head turns to each side looking for a caller nobody sees (its range is
|
||||
# +-180; following people stays within head.YAW_LIMIT): the cameras then cover ~+-155
|
||||
LOOK_ME_WAIST_DEG = 15.0 # deg; nobody seen with the waist turned more than this: it goes to the front first
|
||||
LOOK_ME_TOP_ROW = 0.08 # share of the image height from the top where the person's head should be
|
||||
LOOK_ME_EDGE_PX = 8 # a box edge this near the frame edge is cut by it
|
||||
@@ -908,6 +910,13 @@ class Modes:
|
||||
pass
|
||||
|
||||
|
||||
def _said_words(seconds):
|
||||
"""A test for one word (lower case): did Lumi say it (or a word it starts, or that starts it) in the last
|
||||
`seconds`? (Lumi.own_echo, Lumi.after_own_voice)"""
|
||||
said = set(re.findall(r"\w+", mouth.recent_speech(seconds).lower()))
|
||||
return lambda w: w in said or len(w) >= 4 and any(len(s) >= 4 and (s.startswith(w) or w.startswith(s)) for s in said)
|
||||
|
||||
|
||||
class Lumi:
|
||||
chain_thread = None # several commands of one sentence done in order (chain_run)
|
||||
chain_stop = threading.Event() # set by "stop" or anything new said: the rest of the chain is not done
|
||||
@@ -1160,8 +1169,8 @@ class Lumi:
|
||||
return min((s for s in seen if abs(s[0] - angle) <= SPEAKER_MATCH_DEG),
|
||||
key=lambda s: abs(s[0] - angle), default=None)
|
||||
|
||||
def face(angle, pitch=LOOK_ME_PITCH):
|
||||
safe(head.turn, HEAD_SIGN * max(-head.YAW_LIMIT, min(head.YAW_LIMIT, angle)), pitch)
|
||||
def face(angle, pitch=LOOK_ME_PITCH, limit=head.YAW_LIMIT):
|
||||
safe(lambda: head.turn(HEAD_SIGN * max(-limit, min(limit, angle)), pitch, limit=limit))
|
||||
|
||||
recent = time.time() - getattr(self, "voice_at", 0.0) <= VOICE_KEEP_S # this turn's sound too weak: the
|
||||
voice = self.voice_angle if self.voice_trusted or recent else None # caller's last sure direction
|
||||
@@ -1178,9 +1187,9 @@ class Lumi:
|
||||
|
||||
def sweep(first): # the head camera looks to `first`'s side, then the other
|
||||
side = 1.0 if first >= 0 else -1.0
|
||||
for a in (side * head.YAW_LIMIT, -side * head.YAW_LIMIT):
|
||||
for a in (side * LOOK_ME_SWEEP_DEG, -side * LOOK_ME_SWEEP_DEG):
|
||||
log(f" look me: nobody seen, looking at {a:+.0f} deg")
|
||||
face(a)
|
||||
face(a, limit=LOOK_ME_SWEEP_DEG)
|
||||
time.sleep(LOOK_ME_SETTLE_S) # new head camera frames from there
|
||||
seen = self.vision.seen(LOOK_ME_MAX_M)
|
||||
if seen:
|
||||
@@ -2585,13 +2594,22 @@ class Lumi:
|
||||
"""The clip mic also hears Lumi: ignore what overlaps with what it said in the last `seconds`. A word counts
|
||||
when said, or when it starts a said word or a said word starts it ("temperature" / "temperatures", "over" /
|
||||
"overcast": whisper cuts and bends the echo)."""
|
||||
said = set(re.findall(r"\w+", mouth.recent_speech(seconds).lower()))
|
||||
heard = _said_words(seconds)
|
||||
words = re.findall(r"\w+", text.lower())
|
||||
|
||||
def heard(w):
|
||||
return w in said or len(w) >= 4 and any(len(s) >= 4 and (s.startswith(w) or w.startswith(s)) for s in said)
|
||||
return bool(words) and sum(map(heard, words)) / len(words) >= share
|
||||
|
||||
@staticmethod
|
||||
def after_own_voice(text, seconds=30.0, share=0.6):
|
||||
"""What the person said right after Lumi's own words in one utterance (the clip mic heard Lumi's answer end
|
||||
and "Let's come here" at once and it was all dropped as Lumi's voice, 2026-10-30): the end of `text` when
|
||||
what comes before it is mostly Lumi's words and the end itself hardly any (at least 2 words), else None."""
|
||||
heard = _said_words(seconds)
|
||||
found = list(re.finditer(r"\w+", text))
|
||||
flags = [heard(m.group().lower()) for m in found]
|
||||
cuts = [(sum(flags[k:]), k) for k in range(1, len(found) - 1) # where Lumi's words end: the fewest of
|
||||
if sum(flags[:k]) / k >= share and sum(flags[k:]) / (len(found) - k) <= 1 / 3] # them after it
|
||||
return text[found[min(cuts)[1]].start():].strip() if cuts else None
|
||||
|
||||
# ---------- interrupts ----------
|
||||
def interrupted(self):
|
||||
"""Stop listening/speaking: the person left. Never for a newcomer: the answer is finished first, then
|
||||
@@ -2662,8 +2680,9 @@ class Lumi:
|
||||
# (muted while Lumi talks); a longer head-array sentence is the visitor ("okay go to P9" after a list with
|
||||
# p9, 2026-10-21). A clip-mic utterance begun after Lumi stopped is the visitor: "Lumi.", "Can you see
|
||||
# me?" seconds after a greeting were dropped 20 times on 2026-10-21
|
||||
log(f" ignored own voice: {text!r}")
|
||||
text = None
|
||||
rest = self.after_own_voice(text)
|
||||
log(f" ignored own voice: {text!r}" + (f", kept what came after it: {rest!r}" if rest else ""))
|
||||
text = rest
|
||||
if text and NOISE_WORDS.fullmatch(text.strip()): # a cough, a beep, "um": not worth "say it again"
|
||||
log(f" ignored a sound: {text!r}")
|
||||
text = None
|
||||
|
||||
+3
-3
@@ -53,10 +53,10 @@ def status():
|
||||
return [j["pos"] for j in _call("status")]
|
||||
|
||||
|
||||
def turn(yaw, pitch=None, vel=VEL, acc=ACC):
|
||||
"""Move the head; blocks until the motion ends. Returns the controller's reply."""
|
||||
def turn(yaw, pitch=None, vel=VEL, acc=ACC, limit=YAW_LIMIT):
|
||||
"""Move the head, yaw within +-`limit`; blocks until the motion ends. Returns the controller's reply."""
|
||||
lift, waist, _, cur_pitch = status()
|
||||
yaw = max(-YAW_LIMIT, min(YAW_LIMIT, yaw))
|
||||
yaw = max(-limit, min(limit, yaw))
|
||||
pitch = cur_pitch if pitch is None else max(PITCH_RANGE[0], min(PITCH_RANGE[1], pitch))
|
||||
return moveto([lift, waist, yaw, pitch], vel, acc)
|
||||
|
||||
|
||||
+20
-1
@@ -60,6 +60,8 @@ TICK_S = 0.1 # s between commands, steady (joy_control wants > 2
|
||||
LOG_S = 1.0 # s between "follow: v ... " lines (what the next live run is read from)
|
||||
JOIN_S = 2.0 # s a new "follow me" waits for the old loop to end
|
||||
BEHIND_DEG = 180.0 # deg; the person's angle from the base is kept within +-this (right behind: one side)
|
||||
ROUND_MAX_DEG = 225.0 # deg; the arm blocked turning toward them, the base turns the other way round when that is
|
||||
# at most this far (the person within 45 deg of right behind, beside a wall)
|
||||
HEAD_REL_MAX = 30.0 # deg; a turned waist unwinds until the person is this far from the base heading, the
|
||||
# head looks for the rest (it never turns further out while following, unwind())
|
||||
WAIST_FOLLOW_MAX = 90.0 # deg from the front; a waist turned further unwinds to this first (estimate)
|
||||
@@ -381,6 +383,8 @@ def _run(see, say, people):
|
||||
head_thread.start()
|
||||
start_t = next_t = time.time() # lost counts from here: prepare() takes a few seconds
|
||||
turning, blocked_t, hold_v, log_t, odd_t, log_pose = False, None, 0.0, 0.0, 0.0, agv.pose()
|
||||
side = 0.0 # +-1: turning round the other way (one way blocked), until
|
||||
# the person is ahead again; 0: the near way
|
||||
while not _stop.is_set():
|
||||
now = time.time()
|
||||
pose = agv.pose()
|
||||
@@ -404,6 +408,8 @@ def _run(see, say, people):
|
||||
if people else [0.0]
|
||||
if got[3] is not None and all(e > JUMP_M or e < 0.05 for e in near): # alone (or themselves):
|
||||
sig = reid.blend(sig, got[3]) # these clothes are theirs
|
||||
if side:
|
||||
start_t = now # out of view while it turns round: lost counts after
|
||||
if now - max(person.t or 0.0, start_t) >= LOST_S:
|
||||
fetch.log("follow: lost the person")
|
||||
fetch._say(say, *LOST)
|
||||
@@ -414,6 +420,8 @@ def _run(see, say, people):
|
||||
# angles from the base heading, taken on from the last target, not -180..180: right behind, +179
|
||||
# and -179 are the same place, the head and waist must not swing round, the base not turn the other way
|
||||
ref = target[0][0] if target[0] else gaze
|
||||
if side: # turning round the other way: angles on that side
|
||||
ref = side * 90.0
|
||||
d, a = _rel(pose, person.at(now))
|
||||
a = ref + (a - ref + 180.0) % 360.0 - 180.0
|
||||
lead = max(HEAD_LEAD_S, min((stats["head_ms"] or 0) / 1000.0, HEAD_LEAD_MAX_S))
|
||||
@@ -421,6 +429,8 @@ def _run(see, say, people):
|
||||
pose[2] + w * lead) # the base when the head gets there (v, w: this command)
|
||||
yaw = _rel(then, person.at(now + lead))[1]
|
||||
yaw = ref + (yaw - ref + 180.0) % 360.0 - 180.0
|
||||
if side and abs(yaw) > 90.0: # the head ahead (not round past its +-180): the person
|
||||
yaw = 0.0 # comes into view as the base turns
|
||||
target[0] = (max(-BEHIND_DEG, min(BEHIND_DEG, yaw)), HEAD_PITCH)
|
||||
walk = float(person.vel @ np.array([math.cos(pose[2]), math.sin(pose[2])]))
|
||||
go = now - person.t <= COAST_S and abs(turned) < WAIST_DRIVE_DEG # forward with the waist ahead
|
||||
@@ -428,13 +438,22 @@ def _run(see, say, people):
|
||||
spot = cmd[0] == 0.0 and cmd[1] != 0.0 # a turn on the spot (the person aside or behind)
|
||||
if spot and not turning:
|
||||
hit = fetch.turn_hits(a - turned) # the arm's whole sweep toward them (it is turned already)
|
||||
if hit is not None:
|
||||
other = a - math.copysign(360.0, a) # the other way round (right behind: about as far)
|
||||
if hit is not None and not side and abs(other) <= ROUND_MAX_DEG \
|
||||
and fetch.turn_hits(other - turned) is None:
|
||||
fetch.log(f"follow: turning {a:+.0f} deg my arm would hit something at ({hit[0]:.2f}, "
|
||||
f"{hit[1]:.2f}); turning {other:+.0f} deg instead")
|
||||
side, a = math.copysign(1.0, other), other
|
||||
cmd = speeds(d, a, v, w, walk, go=go, dt=TICK_S)
|
||||
elif hit is not None:
|
||||
fetch.log(f"follow: turning {a:+.0f} deg my arm would hit something at "
|
||||
f"({hit[0]:.2f}, {hit[1]:.2f})")
|
||||
fetch._say(say, "My arm can't turn here, something is in its way.",
|
||||
"팔이 부딪힐 수 있어서 돌 수 없어요.")
|
||||
return
|
||||
turning = spot
|
||||
if side and abs(a) < TURN_ONLY_DEG:
|
||||
side = 0.0 # ahead again: angles go on from the head's target
|
||||
# stopped by something: on again only when the speed it was stopped at is clear (no creeping up to it)
|
||||
pts = [fetch._rot(turned) @ p for p in arm_pts] # the arm turned with the waist
|
||||
why = cmd != (0.0, 0.0) and blocked(max(cmd[0], hold_v) if cmd[0] else 0.0, cmd[1], pts, pose)
|
||||
|
||||
@@ -58,7 +58,7 @@ def near(a, b, tol=1.0):
|
||||
fetch._clear()
|
||||
assert not fetch.aiming()
|
||||
heads = []
|
||||
lumi.head.turn = lambda yaw, pitch=None: heads.append(round(yaw))
|
||||
lumi.head.turn = lambda yaw, pitch=None, **k: heads.append(round(yaw))
|
||||
L = lumi.Lumi.__new__(lumi.Lumi)
|
||||
L.turn_head(20)
|
||||
time.sleep(0.2)
|
||||
|
||||
@@ -137,6 +137,11 @@ _mouth._recent[:] = [(time.time() - 20, "Yes?"), (time.time() - 4, "Go to p10, w
|
||||
from assistant.lumi import ANSWER_ECHO_S, Lumi as _Lumi
|
||||
assert not _Lumi.own_echo("Yes. Yes.", ANSWER_ECHO_S) and _Lumi.own_echo("Yes. Yes.")
|
||||
assert _Lumi.own_echo("Is that right?", ANSWER_ECHO_S)
|
||||
# the clip mic heard the end of Lumi's answer and the order in one utterance: the order is kept (2026-10-30)
|
||||
_mouth._recent[:] = [(time.time() - 2, "Yes, I can see you about 1.8 metres away.")]
|
||||
assert _Lumi.after_own_voice("Yes, I can see you about 1.8 metres away. Let's come here.") == "Let's come here."
|
||||
assert _Lumi.after_own_voice("I can see you about 1.8 metres away.") is None # all Lumi's: dropped
|
||||
assert _Lumi.after_own_voice("Let's come here.") is None # no echo to cut
|
||||
_mouth._recent.clear()
|
||||
# ---------- questions about what Lumi is doing: answered from the state, not by the LLM ----------
|
||||
from assistant.lumi import STATUS_Q
|
||||
|
||||
+31
-1
@@ -126,7 +126,7 @@ class World:
|
||||
d, a = self.sight(self.person_at())
|
||||
self.dist.append(d)
|
||||
a -= body.pos[1] # lumi.Vision gives waist-frame angles
|
||||
if self.fov and abs(a - body.pos[2]) > HALF_FOV:
|
||||
if self.fov and abs((a - body.pos[2] + 180.0) % 360.0 - 180.0) > HALF_FOV:
|
||||
return None
|
||||
return d, a, 0.0, self.look
|
||||
|
||||
@@ -675,6 +675,36 @@ yaws = [m[4] for m in body.moves if m[1] == "follow head"]
|
||||
assert yaws and all(y > 0 for y in yaws[1:]), yaws
|
||||
print("right behind: one side")
|
||||
|
||||
# right behind beside a wall (live 2026-10-30): the arm blocked turning left, the base turns right round to them
|
||||
# (head ahead, out of view a while), never back the blocked way; blocked both ways: it stops and says so
|
||||
blocked_dir = [1.0]
|
||||
fetch.turn_hits = lambda d: (-5.08, 11.54) if d * blocked_dir[0] > 0 or not blocked_dir[0] else None
|
||||
said.clear()
|
||||
body.pos = [50.0, 0.0, 180.0, follow.HEAD_PITCH] # "look at the back side": the head right behind
|
||||
head._call = real_body
|
||||
w = World(person=(1.3 * math.cos(math.radians(186.0)), 1.3 * math.sin(math.radians(186.0))), fov=True)
|
||||
follow.start(w.see, say)
|
||||
t = time.time()
|
||||
while time.time() - t < 15.0 and not (abs(w.sight(w.person_at())[1]) < follow.TURN_DEAD_DEG + 1.0 and w.cmds
|
||||
and w.cmds[-1][2] == 0.0):
|
||||
time.sleep(0.05)
|
||||
follow.stop()
|
||||
assert wait_end(3.0) and not said, said
|
||||
head._call = body.call
|
||||
turn = math.degrees(w.th)
|
||||
assert -200.0 < turn < -150.0, turn # round to the right
|
||||
assert max(c[2] for c in w.cmds) < 0.1, max(c[2] for c in w.cmds) # never back toward the wall
|
||||
assert abs(w.sight(w.person_at())[1]) < follow.TURN_DEAD_DEG + 1.0, w.sight(w.person_at())
|
||||
print(f"right behind, left blocked: turned {turn:.0f} deg the other way, facing them")
|
||||
blocked_dir[0] = 0.0 # both ways blocked
|
||||
body.pos = [50.0, 0.0, 180.0, follow.HEAD_PITCH]
|
||||
w = World(person=(1.3 * math.cos(math.radians(186.0)), 1.3 * math.sin(math.radians(186.0))), fov=True)
|
||||
follow.start(w.see, say)
|
||||
assert wait_end(3.0) and any("can't turn" in x for x in said), said
|
||||
assert all(c[2] == 0.0 for c in w.cmds), w.cmds
|
||||
fetch.turn_hits = turn_hits
|
||||
print("right behind, both ways blocked: stops, says so")
|
||||
|
||||
# lumi: act("stop") ends following; follow_me locks onto the person talking, refuses when it must
|
||||
lumi.agv.cancel = lumi.skills.cancel = lumi.motion.stop = lambda: None
|
||||
w = World(person=(3.0, 0.0))
|
||||
|
||||
@@ -119,7 +119,7 @@ run["on"] = False
|
||||
L = fresh("What time is it?", -70.0)
|
||||
assert L.talk_turn() and heard == ["What time is it?"] and L.current is L.vision.stranger, (heard, L.current)
|
||||
# "look at me" / "이쪽 봐": the cameras first: the person seen (-60), whatever the voice says
|
||||
lumi.head.turn = lambda yaw, pitch=None: done.append(("head turn", round(yaw)))
|
||||
lumi.head.turn = lambda yaw, pitch=None, **k: done.append(("head turn", round(yaw)))
|
||||
lumi.LOOK_ME_SETTLE_S = 0.0
|
||||
|
||||
|
||||
|
||||
@@ -242,4 +242,11 @@ assert b._after(brain.Brain._action("ACTION: look left", "yes", []), "yes")["act
|
||||
assert b._after(brain.Brain._action("ACTION: look left", "네", []), "네")["action"] == "look"
|
||||
b.history = [("what is over there?", "ACTION: none -\nThe stage.")]
|
||||
assert b._after(brain.Brain._action("ACTION: look left", "yes", []), "yes").get("held") # no offer: talk only
|
||||
# "let's go charging" (2026-10-30: the LLM took it as a remark, "I'll be ready to go when you are!")
|
||||
CM = ["home", "charge", "p1"]
|
||||
for t in ["Let's go charging.", "Go charging.", "Lumi, go charging", "Let's go recharging", "go charge", "충전하러 가"]:
|
||||
assert brain.intent(t, CM) == ("go_to", "charge"), (t, brain.intent(t, CM))
|
||||
assert brain.intent("Let's go charging.", ["home", "p1"]) == ("go_to", "home") # no charger on the map: home
|
||||
for t in ["I want to go charging later", "Do you go charging at night?", "don't go charging"]:
|
||||
assert brain.intent(t, CM) is None, t
|
||||
print("intents ok")
|
||||
|
||||
@@ -6,7 +6,7 @@ import no_robot # noqa: F401 any connection
|
||||
from assistant import lumi
|
||||
|
||||
turns, pitches = [], []
|
||||
lumi.head.turn = lambda yaw, pitch=None: (turns.append(round(yaw)), pitches.append(pitch))
|
||||
lumi.head.turn = lambda yaw, pitch=None, **k: (turns.append(round(yaw)), pitches.append(pitch))
|
||||
lumi.LOOK_ME_SETTLE_S = 0.0
|
||||
lumi.waist_turned = lambda: 0.0 # the waist at the front unless a case says otherwise
|
||||
|
||||
@@ -52,16 +52,16 @@ for v in (128.0, -122.0, 120.0, -120.0):
|
||||
# several seen, none at the voice: the one nearest where the head looks, not one on the voice's side
|
||||
assert look([(-30.0, 1.0), (35.0, 1.0)], voice=150.0, gaze=-25.0) == [-30], turns
|
||||
# nobody seen: the head looks to the voice's side first, finds the person there
|
||||
assert look([], voice=-55.0, after=[(-50.0, 0.9)]) == [-60, -50], turns
|
||||
assert look([], voice=-55.0, after=[(-50.0, 0.9)]) == [-110, -50], turns
|
||||
# nobody seen, no voice: looks around and back
|
||||
assert look([], gaze=10.0) == [60, -60, 10], turns
|
||||
assert look([], gaze=10.0) == [110, -110, 10], turns
|
||||
# nobody seen, the voice unsure but on the right: the right first, not the side the head happens to face (2026-10-30)
|
||||
L = lumi.Lumi.__new__(lumi.Lumi)
|
||||
L.vision, L.current, L.voice_angle, L.voice_trusted, L.voice_guess = Vision([], [(-50.0, 2.0)]), None, 0.0, False, -64.0
|
||||
L.det_yaw = lambda: 0.0
|
||||
turns.clear()
|
||||
L.look_at_speaker()
|
||||
assert turns == [-60, -50], turns
|
||||
assert turns == [-110, -50], turns
|
||||
|
||||
# "Lumi" with the voice read on the left, nobody there: the head turns there, then to the person seen, else back
|
||||
heads = []
|
||||
@@ -160,7 +160,7 @@ L.modes = type("M", (), {"patrol": False})()
|
||||
turns.clear()
|
||||
L.look_at_speaker()
|
||||
assert waist["calls"] == [(120, True, 170.0)], waist
|
||||
assert turns == [60, -60, 50, 0], turns # looked around first; 170 - 120 left for the head; nobody: back
|
||||
assert turns == [110, -110, 50, 0], turns # looked around first; 170 - 120 left for the head; nobody: back
|
||||
assert not L.voice_trusted and L.voice_at == 0.0 # a direction measured before the turn is never used again
|
||||
print("look me behind: ok")
|
||||
|
||||
@@ -186,13 +186,13 @@ L.det_yaw = lambda: 0.0
|
||||
L.modes = type("M", (), {"patrol": False})()
|
||||
turns.clear()
|
||||
L.look_at_speaker()
|
||||
assert waist["calls"] == [(120, True, 150.0)] and turns == [60, -60, 30, 0], (waist, turns)
|
||||
assert waist["calls"] == [(120, True, 150.0)] and turns == [110, -110, 30, 0], (waist, turns)
|
||||
# ... and a voice read in front with nobody there is taken as its mirror behind (-55 -> -125)
|
||||
waist.update(at=0.0, calls=[])
|
||||
L.voice_angle, L.voice_trusted, L.voice_guess = -55.0, True, -55.0
|
||||
turns.clear()
|
||||
L.look_at_speaker()
|
||||
assert waist["calls"] == [(-120, True, -125.0)] and turns == [-60, 60, -5, 0], (waist, turns)
|
||||
assert waist["calls"] == [(-120, True, -125.0)] and turns == [-110, 110, -5, 0], (waist, turns)
|
||||
print("look me from behind, unsure voice: ok")
|
||||
|
||||
# the waist left turned at -73 deg, the caller on the other side (2026-10-30): nobody in either head look, so the waist
|
||||
@@ -207,5 +207,5 @@ L.det_yaw = lambda: 0.0
|
||||
L.modes = type("M", (), {"patrol": False})()
|
||||
turns.clear()
|
||||
L.look_at_speaker()
|
||||
assert turns == [60, -60, -60, -50] and waist["calls"] == [], (turns, waist)
|
||||
assert turns == [110, -110, -110, -50] and waist["calls"] == [], (turns, waist)
|
||||
print("look me with the waist turned: ok")
|
||||
|
||||
Reference in New Issue
Block a user