Follow: head tracks round to ±180 and the base turns after it; speed matches the walk; dashboard errors only in the bell
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -53,7 +53,7 @@ BASE_CLEAR_M = fetch.BASE_HALF_M + fetch.CLEAR_M # m; base centre kept this fa
|
||||
TICK_S = 0.1 # s between commands, steady (joy_control wants > 2 Hz; a tick takes ~10-30 ms)
|
||||
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
|
||||
HEAD_YAW_MAX = 120.0 # deg; the head turns toward the person up to this far (+ left; body API allows 180)
|
||||
HEAD_YAW_MAX = 180.0 # deg; the head turns toward the person up to this far (+ left; body API range, head.AXIS_LIMITS)
|
||||
HEAD_PITCH = 10.0 # deg; head pitch while following, a little up toward a standing person (as "look at me")
|
||||
HEAD_STEP_DEG = 3.0 # deg; a new head move only when the target is this far from where the head was sent
|
||||
HEAD_LEAD_S = 0.3 # s; the head is sent where the person will be this much later (a moveto takes time)
|
||||
@@ -292,8 +292,13 @@ def _run(see, say, people):
|
||||
if person.p is None: # not seen yet (only before the first sighting)
|
||||
cmd, d, a, walk = (0.0, 0.0), 0.0, 0.0, 0.0
|
||||
else:
|
||||
# angles taken on from the head's last target, not -180..180: right behind, +179 and -179 are
|
||||
# the same place, the head must not swing round and the base not turn the other way
|
||||
ref = target[0][0] if target[0] else 0.0
|
||||
d, a = _rel(pose, person.at(now))
|
||||
a = ref + (a - ref + 180.0) % 360.0 - 180.0
|
||||
yaw = _rel(pose, person.at(now + HEAD_LEAD_S))[1]
|
||||
yaw = ref + (yaw - ref + 180.0) % 360.0 - 180.0
|
||||
target[0] = (max(-HEAD_YAW_MAX, min(HEAD_YAW_MAX, yaw)), HEAD_PITCH)
|
||||
walk = float(person.vel @ np.array([math.cos(pose[2]), math.sin(pose[2])]))
|
||||
cmd = speeds(d, a, v, w, walk, go=now - person.t <= COAST_S, dt=TICK_S)
|
||||
|
||||
Reference in New Issue
Block a user