Improve follow responsiveness and obstacle handling
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -58,7 +58,7 @@ Every value here is a constant at the top of its file, with a comment on what it
|
||||
| `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) |
|
||||
| `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 (the base's `max_speed_angular` is raised to it while following), change limit, no turn within, no forward beyond (turn first) |
|
||||
| `tasks/follow.py` | `STALE_S`, `COAST_S`, `LOST_S` | 0.4 s, 1.0 s, 3 s | A sighting older than `STALE_S` is not new; unseen, the base drives on toward where they should be for `COAST_S`, then slows; "I lost you" after `LOST_S` |
|
||||
| `tasks/follow.py` | `VEL_TAU_S`, `WALK_MAX_MS` | 0.5 s, 2 m/s | Walking-velocity filter time constant; faster estimates are noise |
|
||||
| `tasks/follow.py` | `JUMP_M`, `GATE_GROW_MS`, `SWITCH_M`, `RELOCK_LOOK` | 0.5 m, 0.7 m/s, 0.15 m, 0.6 | Keeping the person: a sighting further than `JUMP_M` (+ `GATE_GROW_MS` per s unseen) from where they should be is someone else; another track must be `SWITCH_M` nearer to be taken; clothes `reid.same` below `RELOCK_LOOK` never taken. Estimates |
|
||||
|
||||
+5
-2
@@ -164,9 +164,12 @@ def blocked(v, w, arm_pts, pose=None):
|
||||
if ahead < BASE_CLEAR_M and ahead < agv.clearance(x, y):
|
||||
return f"an obstacle {ahead:.2f} m from the base's way"
|
||||
c, s = math.cos(th2), math.sin(th2)
|
||||
c0, s0 = math.cos(th), math.sin(th)
|
||||
for p in arm_pts:
|
||||
px, py = x2 + c * p[0] - s * p[1], y2 + s * p[0] + c * p[1]
|
||||
if agv.clearance(px, py) < ARM_CLEAR_M:
|
||||
near = agv.clearance(px, py)
|
||||
# as the base's: only coming nearer counts (beside a wall, driving along it stopped the follow, 2026-10-28)
|
||||
if near < ARM_CLEAR_M and near < agv.clearance(x + c0 * p[0] - s0 * p[1], y + s0 * p[0] + c0 * p[1]):
|
||||
return f"my arm would hit something at ({px:.2f}, {py:.2f})"
|
||||
return None
|
||||
|
||||
@@ -340,7 +343,7 @@ 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()
|
||||
agv.set_max_speed(FOLLOW_MAX_MS, fetch.NAV_TURN_RADS) # joy_control is capped by it too (the next
|
||||
agv.set_max_speed(FOLLOW_MAX_MS, TURN_MAX_RS) # 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
|
||||
|
||||
@@ -748,4 +748,17 @@ for k in range(300): # 0.1
|
||||
assert v > 0.45, (t, v) # keeps up with a 0.5 m/s walk
|
||||
assert v == 0.0 and gap < follow.FOLLOW_GAP_M + 0.2, (v, gap)
|
||||
|
||||
# the arm close beside a wall: driving along it goes on, driving at it stops (live 18:03:25: stopped beside one)
|
||||
real_clear, real_pose = agv.clearance, agv.pose
|
||||
arm = [np.array([0.4, -0.3])] # the hand out to the right
|
||||
agv.pose = lambda: (0.0, 0.0, 0.0)
|
||||
agv.clearance = lambda x, y: y + 0.36 # a wall along x at y = -0.36: the hand 0.06 m off it
|
||||
assert follow.blocked(0.5, 0.0, arm) is None # along the wall: no nearer
|
||||
assert follow.blocked(0.5, -0.6, arm) # turning the hand into it: stops
|
||||
agv.clearance = lambda x, y: 1.0 - x # a wall ahead at x = 1.0, the hand 0.6 m from it
|
||||
assert follow.blocked(0.5, 0.0, arm) is None # far yet
|
||||
agv.clearance = lambda x, y: 0.7 - x # ... at x = 0.7: the hand 0.3 m, then 0.05 m
|
||||
assert follow.blocked(0.5, 0.0, arm) is not None and "arm" in follow.blocked(0.5, 0.0, arm)
|
||||
agv.clearance, agv.pose = real_clear, real_pose
|
||||
|
||||
print("all follow checks passed")
|
||||
|
||||
@@ -44,6 +44,7 @@ fetch._turn = lambda deg, **kw: (fetch._head_to(-30.0, 0.0), True)[1] # the tu
|
||||
fetch._pose = lambda name: moved.append(name)
|
||||
fetch._person_point = lambda: ((0.0, 600.0, 0.0), 100.0)
|
||||
fetch._reach_to_hand = lambda *a: moved.append("hand")
|
||||
fetch._sweep_blocked = lambda *a, **k: False # never the real base's pose and map (it failed at the charger)
|
||||
|
||||
fetch.reach(-22.7)
|
||||
time.sleep(0.3)
|
||||
|
||||
Reference in New Issue
Block a user