Skip to content

Commit ef0ffb6

Browse files
committed
sharpen 04 vs 09 differentiation (keep both)
GPT Pro's curriculum review suggested merging 04_online_replanning_astar into 09_blocked_path_recovery. After re-reading both examples I disagree: the trigger for replanning is genuinely different. 04 plans optimistically through UNKNOWN cells and replans when the lidar *observes* a hidden wall. The replan trigger is passive observation; no action ever fails. 09 plans on a fully known map. A dynamic blocker appears mid-run. The agent tries to step into that cell, the world returns Failure(kind='blocked_path'), and the agent has to recover (step back, mark the cell) before replanning. These are two distinct lessons: observation-driven belief revision versus execution-failure recovery. Both stay. The docstrings and the navigation README now state the contrast explicitly, and the gap audit records the keep-both decision.
1 parent a21512a commit ef0ffb6

4 files changed

Lines changed: 54 additions & 5 deletions

File tree

docs/implementation_gap_audit.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ continuous-control Gymnasium adapter, and the curiosity exploration example.
2828
| `09_active_viewpoint_for_grasp.py` | Viewpoint selection by expected reliability under pose belief. |
2929
| `21_object_permanence_toy.py` | Memory persists across an occluder. |
3030
| `22_where_did_i_see_it.py` (removed) | The "explore -> memorize -> query -> revisit" loop overlapped `21_object_permanence_toy.py` without adding a different lesson; removed after a GPT Pro curriculum review. |
31+
| `04_online_replanning_astar.py` (kept) | GPT Pro suggested merging into 09. After review, kept because the trigger for replanning is *passive observation* of an unknown wall, while 09's trigger is *execution failure*. Both docstrings and READMEs were updated to make the distinction explicit. |
3132
| `23_model_error_recovery.py` | Regime shift detection then short system-identification probe. |
3233
| `24_information_gain_navigation.py` | Active scout to reveal a gate before A* with full info. |
3334
| `25_clear_path_before_pick.py` | Precondition failure recovery by clearing an obstacle. |

examples/navigation/04_online_replanning_astar.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
"""Online A* replanning when new obstacles are observed."""
1+
"""Online A* replanning when new obstacles are observed.
2+
3+
The agent plans through UNKNOWN cells under the optimistic assumption that
4+
they are free. When a hidden wall enters the lidar field of view it is
5+
revealed as OCCUPIED, the path becomes invalid, and A* runs again on the
6+
updated map.
7+
8+
Success: robot reaches the goal cell.
9+
Failure: timeout (terminal).
10+
11+
Compare to `09_blocked_path_recovery.py`. That example triggers replanning
12+
through an *execution failure* (the agent tried to step into a blocked
13+
cell and got back a `Failure`). This example triggers replanning through
14+
*passive observation* (the lidar reveals a wall before the agent ever
15+
touches it).
16+
"""
217

318
from __future__ import annotations
419

examples/navigation/09_blocked_path_recovery.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
"""Detect a blocked path, recover, and replan around it."""
1+
"""Detect a blocked path, recover, and replan around it.
2+
3+
The map is fully known. A dynamic blocker appears mid-run on the planned
4+
path. When the agent tries to step into that cell the world returns
5+
`Failure(kind="blocked_path", recoverable=True)`. The agent steps back,
6+
marks the cell, and replans on a map that treats the blocked cell as
7+
occupied.
8+
9+
Success: robot reaches the goal cell.
10+
Failure: blocked_path (recoverable), collision (recoverable), timeout
11+
(terminal).
12+
13+
Compare to `04_online_replanning_astar.py`. That example triggers
14+
replanning through *passive observation* (lidar reveals an unknown wall).
15+
This example triggers replanning through *execution failure* (the agent
16+
attempts a step, the world rejects it, and the agent has to recover
17+
before replanning).
18+
"""
219

320
from __future__ import annotations
421

examples/navigation/README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,15 @@ observe moving obstacle -> predict next cell -> choose safe move -> observe agai
114114
### What this teaches
115115

116116
A plan is only valid relative to the robot's current map. The agent plans
117-
through unknown cells, observes a hidden wall, invalidates the path, and runs
118-
A* again.
117+
optimistically through unknown cells, observes a hidden wall through the
118+
lidar, invalidates the path, and runs A* again. The trigger for replanning
119+
is *passive observation*, not action failure.
120+
121+
Success: robot reaches the goal cell.
122+
Failure: timeout (terminal).
123+
124+
Compare to `09_blocked_path_recovery.py`, where the trigger is execution
125+
failure rather than observation.
119126

120127
### Run
121128

@@ -287,7 +294,16 @@ observe obstacle -> roll out candidate controls -> choose lowest cost -> act ->
287294
### What this teaches
288295

289296
Failure is part of the API. A path can become blocked during execution, and the
290-
robot should detect that failure, update memory, recover, and replan.
297+
robot should detect that failure, update memory, recover, and replan. The
298+
trigger for replanning is *execution failure* (`Failure(kind="blocked_path")`),
299+
not observation.
300+
301+
Success: robot reaches the goal cell.
302+
Failure: blocked_path (recoverable), collision (recoverable), timeout
303+
(terminal).
304+
305+
Compare to `04_online_replanning_astar.py`, where the trigger is observation
306+
of a previously unknown wall before the agent ever touches it.
291307

292308
### Run
293309

0 commit comments

Comments
 (0)