Arm switched off: clear message, drives / turns / follow work without an enabled arm; no goodbye into an empty room; "look behind" stays 60 s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 18:42:29 +09:00
co-authored by Claude Opus 5.5
parent 48724cac15
commit 50bee0b0c3
6 changed files with 85 additions and 36 deletions
+11 -6
View File
@@ -247,7 +247,7 @@ assert wait_end(1.0) and said and "charger" in said[0] and all(c[1:] == (0.0, 0.
fetch._charging = lambda: False
print("charger: refused")
# the arm switched off but in look: follows with the arm still; not in look: refused with the reason, never driven
# the arm switched off: follows with the arm still, in look or not; powered off (joints 0): refused, never driven
def arm_off():
raise motion.MotionError("arm is not powered / enabled")
@@ -262,16 +262,21 @@ assert follow.running() and any(c[1] > 0 for c in w.cmds)
follow.stop()
assert wait_end(0.5)
fetch._at_pose = lambda name: False
assert follow.ready() == follow.ARM_OFF
real_joints, fetch.skills._joints = fetch.skills._joints, lambda: [5.0] * 6
assert follow.ready() is None
fetch.skills._joints = lambda: [0.0] * 6
assert follow.ready() == fetch.ARM_UNSEEN
said.clear()
w = World()
follow.start(w.see, say)
assert wait_end(1.0) and said == [follow.ARM_OFF[0]] and all(c[1:] == (0.0, 0.0) for c in w.cmds), said
assert wait_end(1.0) and said == [fetch.ARM_UNSEEN[0]] and all(c[1:] == (0.0, 0.0) for c in w.cmds), said
fetch.skills._joints = real_joints
motion._ready = lambda: (_ for _ in ()).throw(motion.MotionError("a Cobo π program is running"))
assert follow.ready() == follow.ARM_BUSY
fetch._at_pose = lambda name: (_ for _ in ()).throw(ConnectionError("no answer"))
assert follow.ready() == follow.NO_ARM
fetch._at_pose, motion._ready = (lambda name: True), forbid
print("arm off: follows in look, refuses otherwise")
print("arm off: follows, powered off refuses")
# any other failure in prepare: said, the base at 0, the head free again, the thread ends
said.clear()
@@ -554,9 +559,9 @@ L.modes.drive, L.skill_busy = True, lambda: True
L.follow_me()
assert not started and "on a task" in spoken[-1]
L.skill_busy, real_ready = (lambda: False), follow.ready
follow.ready = lambda: follow.ARM_OFF # checked before "Okay"
follow.ready = lambda: fetch.ARM_UNSEEN # checked before "Okay"
L.follow_me()
assert not started and spoken[-1] == follow.ARM_OFF[0] and not any("follow you" in x for x in spoken[-1:])
assert not started and spoken[-1] == fetch.ARM_UNSEEN[0] and not any("follow you" in x for x in spoken[-1:])
follow.ready = real_ready
follow.start = real_start
print("lumi hooks: ok")
+7 -3
View File
@@ -127,9 +127,9 @@ L.lang = "ko"
lumi.Lumi.receive_from_hand(L, "cup")
assert said == [lumi.ARM_OFF_SAY[1]]
L.lang = "en"
assert lumi.wave_mod.OFF == follow.ARM_OFF == lumi.ARM_OFF_SAY
assert lumi.wave_mod.OFF == fetch.arm_route.OFF == lumi.ARM_OFF_SAY
# follow: an enabled arm never refuses; a disabled one only when it must move to look
# follow: an enabled arm never refuses; a disabled one follows where it is; powered off (joints 0) asks
follow.fetch._charging = lambda: False
at_look = [True]
follow.fetch._at_pose = lambda name: at_look[0]
@@ -140,7 +140,11 @@ assert follow.ready() is None
at_look[0] = False
assert follow.ready() is None # enabled: it may go to look
arm_state.update(enable=0)
assert follow.ready() == follow.ARM_OFF # off and not at look: ask
real_joints, follow.fetch.skills._joints = follow.fetch.skills._joints, lambda: [5.0] * 6
assert follow.ready() is None # off and not at look: follows, the arm stays
follow.fetch.skills._joints = lambda: [0.0] * 6
assert follow.ready() == follow.fetch.ARM_UNSEEN # powered off: where the arm is is not known
follow.fetch.skills._joints = real_joints
at_look[0] = True
assert follow.ready() is None # off but already at look: follows