Improve follow and drive speed, reach toward the person, and name and repeat answers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -2824,7 +2824,12 @@ HELP_OFFER = re.compile(r"\b(how|what) (can|may) i (help|assist|do for) you\b|\b
|
||||
r"(?:더 |또 )?궁금한 (?:게|거|것이|점이?) (?:더 |또 )?(?:있으시면|생기면|있으면)|언제든(?:지)? (?:물어|말씀)", re.I) # owner: never tacked on after an answer
|
||||
SAY_AGAIN = re.compile(r"\b(say (it|that) again|repeat (it|that|please)|again,? please|one more time|come again|"
|
||||
r"pardon|say again)\b|^\s*again\s*\??\s*$|다시 ?(한 ?번|말해|말씀|해 ?줘)|한 ?번 ?더|"
|
||||
r"^\s*뭐라고(요)?\s*\??\s*$", re.I)
|
||||
r"^\s*뭐라고(요)?\s*\??\s*$|"
|
||||
# "What did you say?" went to the LLM, which repeated the answer before the last (2026-10-28)
|
||||
r"^\W*(?:(?:sorry|okay|ok|and|so|wait)\W+)?what did you (?:just )?say\W*$|"
|
||||
r"^\W*(?:sorry\W+)?what was that\W*$|"
|
||||
r"^\W*(?:방금|아까|지금)?\s*뭐라고\s*(?:했어|했어요|했니|했지|했죠|하셨어요|하셨죠|말했어|말했어요|그랬어|그랬어요)\s*\??\s*$",
|
||||
re.I)
|
||||
IN_LANGUAGE = re.compile(r"^\s*(and |then |now |okay,? |and say it |say (it|that) )?(in|into) (korean|english)\b|"
|
||||
r"\b(say|tell me) (it|that) in (korean|english)\b|"
|
||||
r"^\s*(그거|그걸|그럼|다시|이번엔|이제)?\s*(한국어|영어|korean|english)\s?로(?!.*(대화|할 ?수|할 ?줄|돼요\?|되나))"
|
||||
|
||||
+32
-15
@@ -132,7 +132,8 @@ WAKE = re.compile(rf"\b(hi|hey|hello|okay|ok|hai|high|{WAKE_UP_EN})?[\s,.!]*(lum
|
||||
# ^ "Hey Lumi", "Lumi", "wake up (Lumi)", "Lumi, wake up", "루미야", "헤이 루미", "루미야 일어나", "일어나세요";
|
||||
# a bare "wake up" / "일어나" only as the whole utterance ("I wake up at 7" is no call)
|
||||
WAKE_REPLY = {"en": "Yes? How can I help?", "ko": "네? 무엇을 도와드릴까요?"}
|
||||
NAME_ONLY = re.compile(r"^\s*(hi |hey |hello )?(lumi|loomi|rumi|루미)[\s,.!?]*$", re.I)
|
||||
NAME_ONLY = re.compile(r"^\s*(?:(?:hi|hey|hello|헤이|하이)[\s,]+)?(?:lumi|loomi|rumi|루미|누미)(?:야|아)?[\s,.!?~]*$", re.I)
|
||||
# ^ only the name, also "루미야" / "헤이 루미" (went to the LLM: "안녕하세요! 제 이름 불러 주셔서 기뻐요." after 2.3 s)
|
||||
FETCH_STOP = re.compile(r"\b(sto+pp?|stob|halt|freeze|don'?t move)\b|^\W*(?:lumi\W+)?stopped\W*$|스탑|스텁|멈추(?:세요|십시오)|^\W*abort\W*$|\babort (?:the |this |your )?(?:mission|task|trip)\b|\bcancel (?:the |this |your )?(?:mission|task|trip)\b|"
|
||||
r"머+엄*춰|머+엄*추(?:세요|십시오)|멈춰|멈추(?:게|시게|게나|시오|어라)|그만|정지|스톱|스땁|스떱|미션 ?취소|작업 ?취소|"
|
||||
r"거기 ?서(?: ?봐| ?있어)?(?=[\s!.~,]*$)|(?:^|[\s,])서(?:라|요)?(?=[\s!.~,]*$)|\bhold it(?: right)? (?:there|here)\b|"
|
||||
@@ -183,13 +184,14 @@ def needs_arm(action, target=""):
|
||||
return action in ARM_TASKS or action == "arm" and target not in ("open", "close")
|
||||
|
||||
|
||||
def reach_turn(angle):
|
||||
def reach_turn(angle, hand=0.0):
|
||||
"""Waist turn (deg, + left) before "reach out to me" to a person at the waist-frame `angle` (None: nobody seen or
|
||||
heard): 0 within REACH_FRONT_DEG of the front, else the angle. Greeter only turns the waist for it too: the base
|
||||
stays (fetch.reach)."""
|
||||
heard) that brings the hand, held out at `hand` deg in give (fetch.give_bearing), onto them: 0 within
|
||||
REACH_FRONT_DEG, else angle - hand. Greeter only turns the waist for it too: the base stays (fetch.reach)."""
|
||||
if angle is None:
|
||||
return None
|
||||
return 0.0 if abs(angle) <= REACH_FRONT_DEG else float(angle)
|
||||
turn = float(angle) - hand
|
||||
return 0.0 if abs(turn) <= REACH_FRONT_DEG else turn
|
||||
|
||||
|
||||
_waist_lock = threading.Lock() # one waist return at a time (a conversation's end and the drive after it)
|
||||
@@ -393,9 +395,12 @@ FOLLOW_SORRY_S = 20.0 # s; "Sorry, I'm following someone" at most t
|
||||
COME_STOP = 1.1 # m; driving to a person stops when the camera sees them this close
|
||||
COME_TIMEOUT = 60.0 # s
|
||||
MAX_MOVE_M = 3.0 # m; "move forward N metres" is limited to this
|
||||
REACH_FRONT_DEG = 20.0 # deg; "reach out to me": a person further to the side than this is turned to first
|
||||
# (the waist, Greeter or Patrol). Estimate: the reach after give moves at most
|
||||
# fetch.RECEIVE_REACH_MM sideways
|
||||
REACH_FRONT_DEG = 10.0 # deg; "reach out to me": a person further than this from where the hand points is
|
||||
# turned to first (the waist, Greeter or Patrol); the reach after give moves at most
|
||||
# fetch.RECEIVE_REACH_MM sideways (estimate)
|
||||
REACH_COME_M = 1.5 # m; a person further than this is driven to first (come_to, COME_STOP), the hand is
|
||||
# never held out from afar (owner, 2026-10-28)
|
||||
COME_CLOSER_SAY = ("Please come a little closer.", "조금 더 가까이 와 주세요.")
|
||||
STAND_IN_FRONT_SAY = ("Please stand in front of me.", "제 앞에 서 주세요.")
|
||||
REACH_HOLD_S = 30.0 # s the hand stays held out after a reach, then the arm folds back to look (estimate)
|
||||
REACH_DONE = re.compile(r"\b(?:thanks?|thank you|thx|ok(?:ay)?|got it|done|that'?s (?:it|all|enough)|enough|good|great|"
|
||||
@@ -2147,8 +2152,9 @@ class Lumi:
|
||||
|
||||
def reach_out(self, held):
|
||||
""""Reach out to me", "give me your hand", "손 내밀어": something in the hand = hand it over. Else toward the
|
||||
person (the tracked one, else the one the voice came from, else the voice's direction): the head turns to
|
||||
them; further to the side than REACH_FRONT_DEG the waist turns first (reach_turn, Greeter only too: the base
|
||||
person (the tracked one, else the one the voice came from, else the voice's direction): further than
|
||||
REACH_COME_M the base comes to them first (come_to); the head turns to them; the hand further from them than
|
||||
REACH_FRONT_DEG: the waist turns first, until the hand (not the waist's front) points at them (reach_turn, Greeter only too: the base
|
||||
stays); then fetch.reach (give pose along the graph, a short checked move toward their hand). The arm folds back on "thanks" / "okay" or after REACH_HOLD_S (reach_done).
|
||||
True when started, None when refused or handed over (said)."""
|
||||
from tasks import fetch
|
||||
@@ -2164,9 +2170,20 @@ class Lumi:
|
||||
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()
|
||||
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)
|
||||
return None
|
||||
log(f" reach: person #{track.id} {track.distance:.2f} m away: coming closer first")
|
||||
self.come_to(track)
|
||||
if not self.vision.present(track) or track.distance > REACH_COME_M:
|
||||
self.fetch_say(*COME_CLOSER_SAY)
|
||||
return None
|
||||
angle = track.angle if track else self.voice_angle if self.voice_trusted else None
|
||||
turn = reach_turn(angle)
|
||||
log(f" reach: person at {'?' if angle is None else f'{angle:+.0f}'} deg, waist turn {turn}")
|
||||
hand = safe(fetch.give_bearing, default=0.0) or 0.0
|
||||
turn = reach_turn(angle, hand)
|
||||
log(f" reach: person at {'?' if angle is None else f'{angle:+.0f}'} deg, hand at {hand:+.0f} deg, "
|
||||
f"waist turn {turn}")
|
||||
if turn is None:
|
||||
self.fetch_say(*STAND_IN_FRONT_SAY)
|
||||
return None
|
||||
@@ -2174,7 +2191,7 @@ class Lumi:
|
||||
self.turn_head(HEAD_SIGN * max(-head.YAW_LIMIT, min(head.YAW_LIMIT, angle)), force=True) # it raced it
|
||||
self.stay()
|
||||
try:
|
||||
fetch.reach(turn, say=self.fetch_say)
|
||||
fetch.reach(turn, say=self.fetch_say, look=angle)
|
||||
except fetch.FetchError as e:
|
||||
log(f" reach refused: {e}")
|
||||
self.fetch_say(e.args[0], e.args[1] if len(e.args) > 1 else "죄송해요, 지금은 할 수 없어요.")
|
||||
@@ -3455,9 +3472,9 @@ class Lumi:
|
||||
self.current, track.greeted = track, True
|
||||
self.follow_by_clip = getattr(getattr(self, "last_u", None), "source", None) == "clip"
|
||||
log(f"FOLLOW person #{track.id} at {track.distance:.2f} m {track.angle:+.0f} deg")
|
||||
mouth.say("Okay, I'll follow you. Say stop when you want me to stay." if en
|
||||
else "네, 따라갈게요. 멈추려면 멈춰라고 하세요.")
|
||||
follow.start(lambda: self.vision.follow_view(track), say=self.fetch_say, people=self.vision.follow_views)
|
||||
mouth.say("Okay, I'll follow you." if en else "네, 따라갈게요.") # while it already moves (owner: no waiting
|
||||
# for a long sentence first)
|
||||
self.keep_listening()
|
||||
|
||||
def follow_stop(self, text):
|
||||
|
||||
@@ -39,8 +39,8 @@ KINDS = {
|
||||
"이름이 뭐야", "이름이 뭐예요", "이름이 어떻게 돼요", "너 이름 뭐야", "성함이 어떻게 되세요", "이름 알려 줘", "이름이 뭡니까",
|
||||
"넌 이름이 뭐니", "이름 있어요", "뭐라고 부르면 돼요", "니 이름 머야", "너 이름이 뭐꼬", "이름이 뭐당가", "네임이 뭐야",
|
||||
"your name 뭐야", "이 로봇 이름이 뭐예요",
|
||||
], {"en": ["I'm Lumi.", "My name is Lumi.", "Lumi. Nice to meet you."],
|
||||
"ko": ["저는 루미예요.", "제 이름은 루미예요.", "루미라고 해요. 반가워요."]}),
|
||||
], {"en": ["I'm Lumi.", "My name is Lumi."], # no "nice to meet you": only asked, nobody introduced
|
||||
"ko": ["저는 루미예요.", "제 이름은 루미예요.", "루미라고 해요."]}), # themselves (that is the LLM's, from the talk)
|
||||
"name_meaning": ([
|
||||
"what does your name mean", "why are you called lumi", "where does the name lumi come from", "what does lumi mean",
|
||||
"meaning of your name", "why lumi", "who named you lumi", "루미가 무슨 뜻이야", "이름이 무슨 뜻이에요", "왜 이름이 루미예요",
|
||||
|
||||
+6
-1
@@ -95,6 +95,9 @@ NAME_ONLY = re.compile(r"\W*(lumi|루미야?)\W*", re.I)
|
||||
# (2026-10-21 12:00-13:50) were a clap, a thud, music or "はい" without the prompt. Such a text is checked once more
|
||||
# without the prompt and dropped when no word there sounds like the name.
|
||||
CALL_ONLY = re.compile(r"\W*(?:(?:hi|hey|hello|안녕)\W*)?(lumi|루미야?)\W*", re.I)
|
||||
CYRILLIC = str.maketrans("абвгдежзийклмнопрстуфхцчшщыэюяАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЫЭЮЯ", # without the prompt
|
||||
"abvgdejziiklmnoprstufhcchsyeuaABVGDEJZIIKLMNOPRSTUFHCCHSYEUA") # the clip mic's "Lumi" came
|
||||
# back Cyrillic ("Луны", "Думай", logs/heard 2026-10-28) and was dropped as no name
|
||||
KO_BONUS = 0.3 # another language named: asked in Korean and in English, a Hangul answer's average
|
||||
# log-probability counts this much more (tests/asr_check.py: +3 of 898 cases)
|
||||
ODD_KO_BONUS = 0.3 # English text with a word no dictionary has: Korean asked too, taken when written in
|
||||
@@ -216,7 +219,9 @@ def _letters(text):
|
||||
|
||||
|
||||
def lumi_like(text):
|
||||
"""A word that may be the name as whisper writes it without the prompt ("Louie", "Lumen", "Remia", "루미")."""
|
||||
"""A word that may be the name as whisper writes it without the prompt ("Louie", "Lumen", "Remia", "루미"; from
|
||||
the clip mic also in Cyrillic: "Луны", "Думай", read in Latin letters)."""
|
||||
text = text.translate(CYRILLIC)
|
||||
if re.search(r"루미|루(?![가-힣])|ルミ|미야|민희|^\W*이미|\b[lr]e?mi|\bb?l[ou]{1,2}m|\bl[ou]{1,2}n(?:e?y|i|e)\b", text,
|
||||
re.I): # "안녕 민희야", "Bloomy", "Looney" (logs/heard 18:35:10)
|
||||
return True
|
||||
|
||||
+2
-1
@@ -133,6 +133,7 @@ print(agv("/api/robot_status"))
|
||||
|
||||
- **One command lasts 0.5 s**, then the base stops. Send at > 2 Hz (10 Hz recommended) for continuous motion.
|
||||
- Overrides navigation (`/api/move`).
|
||||
- Also capped by `max_speed_linear` (`/api/set_params`, default 0.3 m/s): 0.5 commanded drives 0.30 until it is raised.
|
||||
- Vendor keyboard example: every 0.1 s, v = 0.5 m/s, w = 0.3 rad/s.
|
||||
|
||||
```python
|
||||
@@ -190,7 +191,7 @@ Keep the socket open to receive the callbacks.
|
||||
|
||||
| Command | Notes |
|
||||
|---|---|
|
||||
| `/api/set_params?max_speed_linear=0.3&max_speed_angular=0.5` | 0.1–1.0 m/s, 0.5–3.5 rad/s; reset at restart; always answers `OK`, confirm with `/api/get_params` |
|
||||
| `/api/set_params?max_speed_linear=0.3&max_speed_angular=0.5` | 0.1–1.0 m/s, 0.5–3.5 rad/s; caps navigation and `joy_control`; reset at restart (0.3 / 0.3), so `robot/agv.py` sends it before every move; always answers `OK`, confirm with `/api/get_params` |
|
||||
| `/api/estop?flag=true` / `false` | Software E-stop (motors free, base can be pushed). Separate from the hardware E-stop; neither releases the other; reset to false at restart |
|
||||
| `/api/map/list`, `/api/map/get_current_map` (resolution, width, height, origin), `/api/map/set_current_map?map_name=..&floor=..`, `/api/map/list_info` | Maps (setting a map restarts the base service) |
|
||||
| `/api/map/accessible_point_query?x=..&y=..`, `/api/map/distance_probe?x=..&y=..` | Nearest reachable point; distance to obstacles |
|
||||
|
||||
+3
-3
@@ -55,7 +55,7 @@ Every value here is a constant at the top of its file, with a comment on what it
|
||||
| `assistant/lumi.py` | `FOCUS_EVERY_S`, `FOCUS_DEG`, `FOCUS_REFIND_DEG` | 0.5 s, 8°, 15° | Keeping the head on the person Lumi talks with: checked this often, followed once they are this far off the head's direction; a lost track's person is taken again as a new track within this angle |
|
||||
| `assistant/lumi.py` | `FOLLOW_VOICE_DEG`, `FOLLOW_SORRY_S` | 35°, 20 s | While following, a voice this near the followed person's angle is theirs (estimate); the "I'm following someone" line at most this often |
|
||||
| `tasks/follow.py` | `FOLLOW_GAP_M`, `NEAR_STOP_M` | 1.0 m, 0.8 m | "Follow me": camera distance kept to the person (nearer: no forward); nearer than `NEAR_STOP_M` no turn either. Estimate |
|
||||
| `tasks/follow.py` | `FOLLOW_MAX_MS`, `SPEED_GAIN` | 0.5 m/s, 0.8 /s | Follow speed cap (joy_control's own clamp, [05_AGV_BASE.md](05_AGV_BASE.md)); speed = their walking speed + this per m beyond the gap |
|
||||
| `tasks/follow.py` | `FOLLOW_MAX_MS`, `SPEED_GAIN` | 0.5 m/s, 0.8 /s | Follow speed cap (joy_control's own clamp, [05_AGV_BASE.md](05_AGV_BASE.md); the base's `max_speed_linear` is raised to it while following); speed = their walking speed + this per m beyond the gap |
|
||||
| `tasks/follow.py` | `ACCEL_MS2`, `DECEL_MS2` | 0.5, 0.8 m/s² | Speeding up / slowing down limits; never faster than lets the base stop at the gap with `DECEL_MS2` after `REACT_S`. Estimates |
|
||||
| `tasks/follow.py` | `REACT_S` | 0.3 s | From the person stopping to the base braking (frame, track, tick, command); with `DECEL_MS2` it sets the follow distance while walking (~1.3 m at 0.5 m/s). Estimate |
|
||||
| `tasks/follow.py` | `TURN_GAIN`, `TURN_MAX_RS`, `TURN_ACCEL_RS2`, `TURN_DEAD_DEG`, `TURN_ONLY_DEG` | 1.5, 0.6 rad/s, 2.0 rad/s², 5°, 35° | Turning toward the person: gain, cap, change limit, no turn within, no forward beyond (turn first) |
|
||||
@@ -119,7 +119,7 @@ Every value here is a constant at the top of its file, with a comment on what it
|
||||
| `tasks/fetch.py` | `MOVE_SPEED` | 0.10 m/s | Speed of a mission `move` (straight, joy_control). Estimate |
|
||||
| `tasks/fetch.py` | `SHORT_MOVE_M` | 0.10 m | A shorter `move` goes at `AXIS_SPEED` |
|
||||
| `tasks/fetch.py` | `SPEED_STEP`, `SPEED_MIN`, `SPEED_MAX` | 0.2, 0.4, 1.6 | "Faster" / "slower" by voice: step and limits as parts of the normal speed (moves `MOVE_SPEED` × it). Estimates |
|
||||
| `tasks/fetch.py` | `NAV_SPEED_MPS`, `NAV_TURN_RADS` | 0.3 m/s, 0.3 rad/s | Navigation's own limits (`/api/get_params`) = normal; voice only lowers the linear one (`/api/set_params`) |
|
||||
| `tasks/fetch.py` | `NAV_SPEED_MPS`, `NAV_TURN_RADS` | 0.5 m/s, 0.3 rad/s | Navigation's limits, sent with every move (`/api/set_params`; the base's own 0.3 m/s returns at its restart) = normal; the base plans its speed under them (full on clear straight ways, slower into turns); voice only lowers the linear one |
|
||||
| `assistant/driving.py` | `MOVE_MAX_M`, `MOVE_MIN_M` | 3 m, 0.01 m | Longest / shortest drive by voice; outside is refused with the limit |
|
||||
| `assistant/driving.py` | `TINY_M`, `SPAN_M`, `STEP_M`, `LITTLE_M`, `DEFAULT_M` | 0.05, 0.2, 0.5, 0.5, 1 m | "A tiny bit" / 살짝, 한 뼘, one step, "a little" / 조금, no amount said. Estimates |
|
||||
| `tasks/fetch.py` | `RECEIVE_WAIT_S` | 30 s | `receive`: nothing put in the hand by then, the mission fails with the hand open |
|
||||
@@ -129,7 +129,7 @@ Every value here is a constant at the top of its file, with a comment on what it
|
||||
| `assistant/steps.py` | `WAIT_ORDER_S` | 5 min | "do what they tell you": no instruction by then, the mission goes on with its rest |
|
||||
| `tasks/fetch.py` | `RECEIVE_REACH_MM`, `RECEIVE_SHORT_MM`, `RECEIVE_MIN_MM` | 150, 100, 20 mm | "Take this from my hand" and "reach out to me": the hand moves at most this far from `give` towards the thing in the hand (or their hand), stops this far before it, leaves out a shorter move. Estimates |
|
||||
| `tasks/fetch.py` | `REACH_BODY_MM` | 300 mm | "Reach out to me" with no hand of theirs seen: the hand stops this far before the person's body. Estimate |
|
||||
| `assistant/lumi.py` | `REACH_FRONT_DEG` | 20° | "Reach out to me": a person further to the side is turned to first with the waist (Greeter or Patrol; the base stays). Estimate |
|
||||
| `assistant/lumi.py` | `REACH_FRONT_DEG`, `REACH_COME_M` | 10°, 1.5 m | "Reach out to me": a person further than this from where the hand points in `give` is turned to with the waist until the hand points at them (Greeter or Patrol; the base stays); a person further away is driven to first (`COME_STOP`). Estimates |
|
||||
| `assistant/lumi.py` | `REACH_HOLD_S` | 30 s | The hand stays held out this long after a reach without "thanks" / "okay", then the arm folds back to `look`. Estimate |
|
||||
| `tasks/fetch.py` | `POINT_STEPS_MM` | 0, ±50, ±100 mm | "Put it here" with pointing: spot grid around the pointed point |
|
||||
| `tasks/fetch.py` | `RECEIVE_DI_S` | 0.5 s | `receive`: the finger sensor (DI_1) must see something this long before Lumi asks the person to let go (the hand closes on their "okay") |
|
||||
|
||||
@@ -23,6 +23,15 @@ _conn_lock = threading.Lock()
|
||||
# robot/nav_guard.py's state of the navigation move this process sent: gen counts go / go_point / cancel (a guard
|
||||
# whose gen is old stops); held: the guard cancelled it until the way is clear; reason: (en, ko) why it ended it.
|
||||
_guard = {"gen": 0, "held": False, "reason": None}
|
||||
# max_speed_linear / max_speed_angular (m/s, rad/s) sent before every navigation move (tasks/fetch.py sets them): the
|
||||
# base caps navigation and joy_control by them and forgets them at its restart (its own 0.3 m/s; follow asked 0.5 and
|
||||
# drove 0.30, 2026-10-28). None: the base's own.
|
||||
max_speed = {"linear": None, "angular": None}
|
||||
|
||||
|
||||
def set_max_speed(linear, angular):
|
||||
"""Cap navigation and joy_control at `linear` m/s, `angular` rad/s (/api/set_params, 0.1-1.0 / 0.5-3.5)."""
|
||||
return request(f"/api/set_params?max_speed_linear={linear:g}&max_speed_angular={angular:g}")
|
||||
|
||||
|
||||
def _ask(command, tag, timeout):
|
||||
@@ -82,6 +91,8 @@ def _move(command):
|
||||
"""Send a navigation move (cancelling one that runs) and guard the arm along it (robot/nav_guard.py)."""
|
||||
if status().get("move_status") == "running":
|
||||
cancel()
|
||||
if max_speed["linear"]:
|
||||
set_max_speed(max_speed["linear"], max_speed["angular"])
|
||||
r = request(command)
|
||||
ok = r.get("status") == "OK"
|
||||
_guard.update(gen=_guard["gen"] + 1, held=False, reason=None)
|
||||
|
||||
+24
-5
@@ -180,7 +180,9 @@ SHORT_MOVE_M = 0.10 # m; a shorter move goes at AXIS_SPEED (0.100 m dri
|
||||
SPEED_STEP = 0.2 # "faster" / "slower" by voice changes the drive speed by this part of the normal speed ...
|
||||
SPEED_MIN = 0.4 # ... down to this part of it ...
|
||||
SPEED_MAX = 1.6 # ... up to this (moves 0.16 m/s; estimate, still below navigation's NAV_SPEED_MPS)
|
||||
NAV_SPEED_MPS = 0.3 # m/s; navigation's max_speed_linear as the base has it (get_params, 2026-10-21) = normal;
|
||||
NAV_SPEED_MPS = 0.5 # m/s; navigation's max_speed_linear (sent before every move, robot/agv.py) = normal: the
|
||||
# base plans its own speed under it, full on a clear straight way, slower into turns and
|
||||
# near obstacles (its own value is 0.3, owner 2026-10-28: faster on straight ways);
|
||||
NAV_TURN_RADS = 0.3 # rad/s; its max_speed_angular, sent unchanged. Navigation is only ever slowed, never faster
|
||||
RECEIVE_WAIT_S = 30.0 # s; receive: nothing put in the hand by then -> the mission fails, hand open
|
||||
RECEIVE_DI_S = 0.5 # s; DI_1 (finger sensor) sees something this long -> Lumi asks the person to let go;
|
||||
@@ -1225,6 +1227,7 @@ def _fitted(task, obj):
|
||||
|
||||
|
||||
speed_factor = 1.0 # the drive speed by voice: x MOVE_SPEED for moves, x NAV_SPEED_MPS (at most 1) for navigation
|
||||
agv.max_speed.update(linear=NAV_SPEED_MPS, angular=NAV_TURN_RADS)
|
||||
|
||||
|
||||
def set_speed(factor):
|
||||
@@ -1234,8 +1237,9 @@ def set_speed(factor):
|
||||
global speed_factor
|
||||
factor = round(min(SPEED_MAX, max(SPEED_MIN, factor)), 2)
|
||||
nav = round(NAV_SPEED_MPS * min(factor, 1.0), 3)
|
||||
agv.max_speed.update(linear=nav, angular=NAV_TURN_RADS) # every later move; and the one running now:
|
||||
if nav != round(NAV_SPEED_MPS * min(speed_factor, 1.0), 3):
|
||||
agv.request(f"/api/set_params?max_speed_linear={nav}&max_speed_angular={NAV_TURN_RADS}")
|
||||
agv.set_max_speed(nav, NAV_TURN_RADS)
|
||||
speed_factor = factor
|
||||
log(f"drive speed x{factor:g} (moves {MOVE_SPEED * factor:.3f} m/s, navigation {nav:g} m/s)")
|
||||
return factor
|
||||
@@ -2937,13 +2941,28 @@ def _person_point():
|
||||
return p.get("position_mm"), REACH_BODY_MM
|
||||
|
||||
|
||||
def reach(angle=0.0, say=None):
|
||||
def give_bearing():
|
||||
"""Where the hand points in `give` (deg, + left, waist frame: from the waist's axis, the waist at the front): the
|
||||
taught pose holds it 21 deg to the right, so a waist turned straight at the person held the hand out beside them
|
||||
(owner, 2026-10-28). 0 when the arm's place on the base is not measured."""
|
||||
try:
|
||||
cal = json.loads(CALIB_FILE.read_text())
|
||||
yaw, xy = float(cal["arm_yaw_in_base_deg"]), np.array(cal["arm_xy_in_base_m"], float)
|
||||
except (FileNotFoundError, ValueError, KeyError):
|
||||
return 0.0
|
||||
from robot import kinematics
|
||||
hand = _rot(yaw) @ (np.array(kinematics.pose(motion.poses()["give"])[:2]) / 1000.0) + xy
|
||||
return math.degrees(math.atan2(hand[1], hand[0]))
|
||||
|
||||
|
||||
def reach(angle=0.0, say=None, look=None):
|
||||
"""Hold the hand out to the person ("reach out to me", "손 내밀어"): first, when `angle` (deg, + left, waist
|
||||
frame: the person tracker's) is not 0, the waist turns to face them (_waist_to, also with Patrol off: the base
|
||||
stays; its arm sweep checked; past the waist's limits they are asked to stand in front; the waist stays turned
|
||||
after; the head turns with it onto them and stays on them, also after), then the arm along the pose graph to give
|
||||
(arm_route, every move checked), then at most RECEIVE_REACH_MM straight towards their hand or body
|
||||
(_person_point, _reach_to_hand). The arm stays out; "fold" brings it back to look."""
|
||||
(_person_point, _reach_to_hand). The arm stays out; "fold" brings it back to look. `look`: the person's angle the
|
||||
head stays on when the waist turns by another `angle` (to bring the hand, not the waist's front, onto them)."""
|
||||
if "give" not in motion.poses():
|
||||
raise FetchError("I haven't learned how to reach out yet.", "아직 손 내미는 법을 못 배웠어요.")
|
||||
_adopt()
|
||||
@@ -2958,7 +2977,7 @@ def reach(angle=0.0, say=None):
|
||||
if angle: # the waist, not the base: the person stays where they are
|
||||
lo, hi = head.AXIS_LIMITS[1]
|
||||
if not lo <= head.status()[1] + angle <= hi or \
|
||||
not _waist_to(angle + _waist_turn(), in_place=True, look=angle):
|
||||
not _waist_to(angle + _waist_turn(), in_place=True, look=angle if look is None else look):
|
||||
raise FetchError(*TURN_TO_PERSON)
|
||||
_pose("give")
|
||||
_reach_to_hand(*_person_point())
|
||||
|
||||
+2
-1
@@ -340,7 +340,8 @@ def _run(see, say, people):
|
||||
if _fresh(got):
|
||||
person.seen(_to_map(_seen_from(agv.pose(), fetch._waist_turn()), *got[:2]), time.time() - got[2])
|
||||
arm_pts = prepare()
|
||||
lift, waist, yaw = head.status()[:3]
|
||||
agv.set_max_speed(FOLLOW_MAX_MS, fetch.NAV_TURN_RADS) # joy_control is capped by it too (the next
|
||||
lift, waist, yaw = head.status()[:3] # navigation move sends its own again)
|
||||
turned = fetch._waist_turn()
|
||||
front, gaze = waist - turned, turned + yaw # the waist's reading at the front; where the head looks
|
||||
waist_free = bool(arm_pts) # its sweep can be checked ...
|
||||
|
||||
@@ -117,6 +117,15 @@ assert f == fetch.SPEED_MIN and sent[-1].startswith(f"/api/set_params?max_speed_
|
||||
assert all(float(c.split("=")[1].split("&")[0]) <= fetch.NAV_SPEED_MPS for c in sent)
|
||||
f = fetch.set_speed(1.0)
|
||||
assert sent[-1].startswith(f"/api/set_params?max_speed_linear={fetch.NAV_SPEED_MPS:g}") and f == 1.0
|
||||
sent.clear() # every navigation move sends the speed first: the base forgets it
|
||||
real_status = fetch.agv.status # at its restart (0.3 m/s of its own, 2026-10-28)
|
||||
fetch.agv.status = lambda: {"move_status": "idle"}
|
||||
fetch.agv.request = lambda cmd, timeout=3.0: sent.append(cmd) or {"status": "FAIL"}
|
||||
fetch.agv.go("p1")
|
||||
assert sent == [f"/api/set_params?max_speed_linear={fetch.NAV_SPEED_MPS:g}&max_speed_angular={fetch.NAV_TURN_RADS:g}",
|
||||
"/api/move?marker=p1"], sent
|
||||
fetch.agv.status = real_status
|
||||
fetch.agv.request = lambda cmd, timeout=3.0: sent.append(cmd) or {}
|
||||
assert driving.say_speed(1, 1.2, True) == "Okay, a bit faster: 120 percent of my normal speed."
|
||||
assert driving.say_speed(1, fetch.SPEED_MAX, False) == "I'm already at my top speed."
|
||||
|
||||
|
||||
@@ -53,6 +53,9 @@ assert ears.transcribe(AUDIO) == "" and asked == [None, "no prompt"], asked
|
||||
# the name really said: kept
|
||||
asked = fake({None: ("Hey Lumi.", "english", 0.9, -0.05), "no prompt": ("Hey, Liumu!", "english", 0.9, -0.8)})
|
||||
assert ears.transcribe(AUDIO) == "Hey Lumi." and asked == [None, "no prompt"], asked
|
||||
for plain in ("Луны.", "Думай.", "Lume"): # the name from the clip mic without the prompt (logs/heard 16:18:21)
|
||||
asked = fake({None: ("Lumi.", "english", 0.9, -0.05), "no prompt": (plain, "russian", 0.5, -0.6)})
|
||||
assert ears.transcribe(AUDIO) == "Lumi.", plain
|
||||
# tagged Korean but written in Latin letters (understood() would refuse it): asked in English, the same words kept
|
||||
asked = fake({None: ("Wait.", "korean", 0.6, -0.01), "en": ("Wait.", "english", None, -0.02)})
|
||||
assert ears.transcribe(AUDIO) == "Wait." and ears.understood() and asked == [None, "en"], asked
|
||||
|
||||
@@ -93,6 +93,9 @@ class World:
|
||||
self.t = now
|
||||
|
||||
def request(self, cmd):
|
||||
if cmd.startswith("/api/set_params?"): # the base's cap on joy_control: follow raises it to FOLLOW_MAX_MS
|
||||
self.cap = float(re.search(r"max_speed_linear=([\d.]+)", cmd)[1])
|
||||
return {"status": "OK"}
|
||||
m = re.match(r"/api/joy_control\?linear_velocity=(-?[\d.]+)&angular_velocity=(-?[\d.]+)$", cmd)
|
||||
if not m:
|
||||
forbid()
|
||||
@@ -156,6 +159,7 @@ w = World(person=(2.2, 0.4), walk=(0.3, 0.05), walk_s=2.0)
|
||||
follow.start(w.see, say)
|
||||
time.sleep(6.0)
|
||||
assert follow.running()
|
||||
assert w.cap == follow.FOLLOW_MAX_MS, getattr(w, "cap", None) # else the base's own 0.3 caps it (2026-10-28)
|
||||
assert follow.stop() and wait_end(0.5)
|
||||
vs, ws = [c[1] for c in w.cmds], [c[2] for c in w.cmds]
|
||||
assert max(vs) <= follow.FOLLOW_MAX_MS + 1e-9 and max(vs) > 0.85 * follow.FOLLOW_MAX_MS, max(vs) # capped, and it got there
|
||||
|
||||
@@ -150,6 +150,14 @@ if __name__ == "__main__":
|
||||
b.history = [("what's a lidar?", "ACTION: none -\nA laser scanner.")]
|
||||
assert b._after({"action": "quiet", "target": ""}, "에이, 거짓말하지 마")["action"] == "none"
|
||||
assert b.again("one more time") == "same" and b._after({"action": "none", "target": ""}, "again")["action"] == "none"
|
||||
# "What did you say?" repeats the LAST answer (a seeing one too), not the one before (live 2026-10-28 16:42)
|
||||
b.history = [("What is in my hand?", "ACTION: none -\nYou're holding a grey remote in your right hand."),
|
||||
("What is the color of my t-shirt?", "ACTION: none -\nYour t-shirt looks grey.")]
|
||||
for t in ("What did you say?", "Sorry, what did you say?", "what was that?", "방금 뭐라고 했어?", "뭐라고 하셨어요?"):
|
||||
assert b.again(t) == "same", t
|
||||
assert list(b.repeat("What did you say?", "same"))[1:] == ["Your t-shirt looks grey."]
|
||||
for t in ("What did you say about the arm?", "What do you say?", "what was that song?"):
|
||||
assert not b.again(t), t
|
||||
from assistant import driving # "more" right after a look: the head a step further (live 2026-10-23)
|
||||
looked = driving.last_command([("Look at the left side.", "ACTION: look left")])
|
||||
for said in ("More again.", "Look at more.", "Look at the left side more.", "more", "a bit more", "again", "더", "조금 더",
|
||||
|
||||
@@ -58,6 +58,8 @@ class Base:
|
||||
if cmd == "/api/move/cancel":
|
||||
self.status = "canceled" if self.status == "running" else self.status
|
||||
return {"status": "OK"}
|
||||
if cmd.startswith("/api/set_params?"): # the speed, sent before every move (robot/agv.py)
|
||||
return {"status": "OK"}
|
||||
if cmd == "/api/get_planned_path":
|
||||
return {"results": {"path": [[self.x + k * 0.05, 0.0] for k in range(int((self.goal - self.x) / 0.05) + 1)]
|
||||
if self.status == "running" else []}}
|
||||
|
||||
@@ -121,6 +121,10 @@ def through_answer():
|
||||
|
||||
def main():
|
||||
bad = 0
|
||||
for said in sum(qa.KINDS["name"][1].values(), []): # only asked: "nice to meet you" comes from the talk (LLM)
|
||||
if re.search(r"nice to meet|반가", said, re.I):
|
||||
bad += 1
|
||||
print(f"FAIL name answer {said!r}: nobody introduced themselves")
|
||||
for words, want in KIND.items():
|
||||
got = qa.kind_of(words)
|
||||
if got != want:
|
||||
|
||||
+27
-8
@@ -177,24 +177,43 @@ assert moved == ["start_trip"]
|
||||
follow.stop, fetch.stop = real_follow_stop, real_fetch_stop
|
||||
|
||||
# ---------- "reach out to me": toward the person; the waist turns to them with Greeter only too (the base stays) ----
|
||||
assert lumi.reach_turn(None) is None and lumi.reach_turn(10.0) == 0.0
|
||||
assert lumi.reach_turn(None) is None and lumi.reach_turn(8.0) == 0.0
|
||||
assert lumi.reach_turn(-35.0) == -35.0 and lumi.reach_turn(35.0) == 35.0
|
||||
reached = []
|
||||
real_reach = fetch.reach
|
||||
fetch.reach = lambda angle=0.0, say=None: reached.append(angle)
|
||||
# the hand held out 21 deg right of the waist's front (give): the waist turns until the hand, not its front, points
|
||||
# at the person (live 2026-10-28: turned straight at them, the hand went out beside them)
|
||||
assert lumi.reach_turn(36.0, -21.0) == 57.0 and lumi.reach_turn(-15.0, -21.0) == 0.0 and lumi.reach_turn(0.0, -21.0) == 21.0
|
||||
reached, looked = [], []
|
||||
real_reach, real_bearing = fetch.reach, fetch.give_bearing
|
||||
fetch.reach = lambda angle=0.0, say=None, look=None: reached.append(angle) or looked.append(look)
|
||||
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)
|
||||
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.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, -12.0, [0.0]),
|
||||
(True, -12.0, [0.0])):
|
||||
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])):
|
||||
L.modes.patrol, person.angle = patrol, angle
|
||||
reached.clear(), said.clear(), moved.clear()
|
||||
got = L.reach_out(False)
|
||||
# a waist turn takes the head onto them (fetch._waist_to look); a head turn here raced it (looked away live)
|
||||
head_cmds = [] if want[0] else [("head", lumi.HEAD_SIGN * angle)]
|
||||
assert got and reached == want and moved == head_cmds and not said, (patrol, angle, reached, moved, said)
|
||||
fetch.give_bearing = lambda: -21.0 # the hand right of the front: turned further, the head on them
|
||||
person.angle = 36.0
|
||||
reached.clear(), looked.clear()
|
||||
assert L.reach_out(False) and reached == [57.0] and looked == [36.0], (reached, looked)
|
||||
person.angle, person.distance = 0.0, 3.0 # far away: come to them first, then reach
|
||||
came = []
|
||||
L.vision.present = lambda t: True
|
||||
L.come_to = lambda t: came.append(t.id) or setattr(t, "distance", 1.1)
|
||||
reached.clear(), said.clear()
|
||||
assert L.reach_out(False) and came == [8] and reached == [21.0], (came, reached)
|
||||
person.distance, L.modes.drive = 3.0, False # far and driving switched off: asked to come, no reach
|
||||
reached.clear(), said.clear(), came.clear()
|
||||
assert L.reach_out(False) is None and not reached and not came and said == [lumi.COME_CLOSER_SAY[0]], (said, reached)
|
||||
L.modes.drive, person.distance = True, 1.0
|
||||
fetch.give_bearing = lambda: 0.0
|
||||
L.turn_head = lambda *a, **k: moved.append("head")
|
||||
L.vision = None # nobody seen, the voice's direction not trusted: ask
|
||||
reached.clear(), said.clear()
|
||||
@@ -212,7 +231,7 @@ said.clear(), moved.clear()
|
||||
assert lumi.Lumi.arm_pose(L, "open") and moved == ["open"] and not said, (moved, said)
|
||||
lumi.gripper.open_, fetch.check_hand = real_open, real_check
|
||||
L.fetch_status = lambda: None
|
||||
fetch.reach = real_reach
|
||||
fetch.reach, fetch.give_bearing = real_reach, real_bearing
|
||||
|
||||
# ---------- the waist back to the front (waist_home): in place, Greeter only too; never with the arm out or a task ----
|
||||
real = {n: getattr(fetch, n) for n in ("_waist_turn", "state", "_at_pose", "_waist_to")}
|
||||
|
||||
@@ -132,6 +132,10 @@ for heard in ("Let's make music.", "What is that?", "We make it.", "Let's.", "It
|
||||
L.mic = Mic(U(heard))
|
||||
assert not L.check_wake(), heard # 16:57:00, 17:05:03 live: "(no wake word)"
|
||||
assert not lumi.call_only("Lumi, what time is it?") and not lumi.call_only("루미야 노래 불러줘")
|
||||
for call in ("Lumi.", "Lumi?", "Hey, Lumi!", "루미야.", "루미야?", "루미!", "헤이 루미", "하이 루미야", "누미야"): # in a talk:
|
||||
assert lumi.NAME_ONLY.match(call), call # "Yes?" / "네?" at once, no LLM
|
||||
for heard in ("How are you?", "Hi.", "안녕하세요.", "루미야 노래 불러줘", "Lumi, wake up."):
|
||||
assert not lumi.NAME_ONLY.match(heard), heard
|
||||
assert not lumi.WAKE.search("I wake up at 7 every day") and not lumi.WAKE.search("일어나서 밥 먹었어") # no call
|
||||
L = fresh() # "How are you?" is answered, not "Yes? How can I help?"
|
||||
L.mic = Mic(U("How are you?"))
|
||||
|
||||
Reference in New Issue
Block a user