Skip to content

Commit c8c0cfb

Browse files
committed
add conformal ask-for-help example
A new manipulation example that demonstrates calibrated uncertainty as a runtime "ask for help" signal. The agent offline-calibrates a conformal threshold q_hat from a small holdout, then for each item on a toy conveyor builds a prediction set {c : score_c >= 1 - q_hat}. Singletons are placed directly; non-singletons trigger an ask of a toy oracle that returns the true label. This is structurally different from 08_belief_grasp_selection.py and 09_active_viewpoint_for_grasp.py, which reduce uncertainty by acting in the world (another grasp, another viewpoint). Here uncertainty is reduced by deferring to a human. Exposes counters q_hat, sorted_count, help_request_count, correct_no_help_count, correct_after_help_count, wrong_sort_count, and coverage_violation_count. Structured failures: wrong_sort (recoverable - the agent committed without asking and got the wrong bin), timeout, invalid_action. Tests: smoke test pins seed=0 and asserts sorted_count=16, help_request_count>=1, no wrong sorts or coverage violations, that the ask action (2) actually appears, and that both singleton and non-singleton prediction sets are produced. A second test verifies empirical 1-alpha coverage on the calibration set by construction. Counts: 33 examples / 32 GIFs / 82 tests / 11 manipulation examples.
1 parent 25cf0cc commit c8c0cfb

11 files changed

Lines changed: 638 additions & 16 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ robotics loops rather than standalone algorithms.
1111

1212
## Current Status
1313

14-
- 32 runnable examples
14+
- 33 runnable examples
1515
- 20 learning-path roadmap examples
16-
- 31 README GIFs generated from runnable examples
17-
- 80 smoke and regression tests
16+
- 32 README GIFs generated from runnable examples
17+
- 82 smoke and regression tests
1818
- Core dependencies only: `numpy` and `matplotlib`
1919

2020
See `docs/status.md` for the implementation snapshot and `docs/plan.md` for
165 KB
Loading

docs/implementation_gap_audit.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ continuous-control Gymnasium adapter, and the curiosity exploration example.
66

77
## Current Stable Surface
88

9-
- 32 runnable examples
10-
- 20 numbered learning-path examples plus 12 extras
11-
- 31 generated README GIFs with nonblank checks
12-
- 80 smoke, adapter, and regression tests
9+
- 33 runnable examples
10+
- 20 numbered learning-path examples plus 13 extras
11+
- 32 generated README GIFs with nonblank checks
12+
- 82 smoke, adapter, and regression tests
1313
- CI green on Python 3.10, 3.11, and 3.12
1414
- Gymnasium-style adapters for `GridWorld2D`, `DynamicObstacleGridWorld`,
1515
`BlockedPathWorld`, `MovingObstacleWorld`, and `Tabletop2D`
@@ -35,6 +35,8 @@ continuous-control Gymnasium adapter, and the curiosity exploration example.
3535
| `27_multi_agent_avoidance.py` | A* over predicted-next cells of two goal-seeking agents. |
3636
| `MovingObstacleWorld` extraction | Moved from the example file into `pir/worlds/moving_obstacle.py`, with `MovingObstacleWorldGymnasiumAdapter` and five adapter tests. |
3737
| `28_curiosity_grid_exploration.py` | Visit-count-driven novelty target selection with A* commitment. |
38+
| `29_safety_filter_cbf.py` | Runtime CBF safety filter on a nominal go-to-goal policy; `dh/dt >= -alpha * h` projection per obstacle. |
39+
| `30_conformal_ask_for_help.py` | Offline conformal calibration; place when the prediction set is a singleton, defer to a toy oracle when not. Counters: `q_hat`, `help_request_count`, `coverage_violation_count`. |
3840

3941
## Ranked Next Work
4042

docs/learning_paths.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
7. `examples/navigation/10_localization_uncertainty_recovery.py`
2020
8. `examples/navigation/24_information_gain_navigation.py`
2121
9. `examples/navigation/27_multi_agent_avoidance.py`
22+
10. `examples/navigation/29_safety_filter_cbf.py`
2223

2324
## Manipulation Intelligence
2425

@@ -32,6 +33,7 @@
3233
8. `examples/manipulation/08_belief_grasp_selection.py`
3334
9. `examples/manipulation/09_active_viewpoint_for_grasp.py`
3435
10. `examples/manipulation/25_clear_path_before_pick.py`
36+
11. `examples/manipulation/30_conformal_ask_for_help.py`
3537

3638
## Embodied AI
3739

docs/plan.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ first-run experience small, fast, and failure-aware.
88

99
The repository currently has:
1010

11-
- 32 runnable examples
11+
- 33 runnable examples
1212
- 20 numbered learning-path examples
13-
- 12 extra examples outside the original learning-path roadmap
14-
- 31 generated README GIFs
15-
- 80 smoke and regression tests
13+
- 13 extra examples outside the original learning-path roadmap
14+
- 32 generated README GIFs
15+
- 82 smoke and regression tests
1616
- GitHub Actions CI for Python 3.10, 3.11, and 3.12
1717
- core dependencies limited to `numpy` and `matplotlib`
1818
- optional Gymnasium-style adapters for `GridWorld2D`,

docs/status.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ see what exists, what is verified, and what should come next.
55

66
## Snapshot
77

8-
- Runnable examples: 32
8+
- Runnable examples: 33
99
- Learning-path roadmap examples: 20
10-
- README GIFs: 31
11-
- Smoke and regression tests: 80
10+
- README GIFs: 32
11+
- Smoke and regression tests: 82
1212
- Core dependencies: `numpy`, `matplotlib`
1313
- Contributor extra: `pip install -e ".[dev]"`
1414
- CI: Python 3.10, 3.11, 3.12
@@ -30,7 +30,7 @@ goal-command example. The numbered 20-example roadmap is tracked in
3030
| --- | ---: | --- |
3131
| Runtime | 2 | smallest observe-act-observe loop, trace replay |
3232
| Navigation | 12 | reactive avoidance, dynamic obstacles, replanning, exploration, belief, active SLAM, MPC, recovery, localization recovery, information-gain detour, multi-agent avoidance, CBF safety filter |
33-
| Manipulation | 10 | retry, reactive grasping, IK servo, moving target reaching, search, push recovery, suction sorting, belief grasp selection, active viewpoint grasp, clear path before pick |
33+
| Manipulation | 11 | retry, reactive grasping, IK servo, moving target reaching, search, push recovery, suction sorting, belief grasp selection, active viewpoint grasp, clear path before pick, conformal ask-for-help |
3434
| Embodied AI | 6 | controlled goals, memory, POMDP search, tiny VLA loop, object permanence, curiosity exploration |
3535
| World models | 2 | action-conditioned dynamics, prediction error, model update, replanning, regime-shift detection, system identification |
3636

examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Run any example headless with its `--no-render` flag when available.
4343
| `manipulation/08_belief_grasp_selection.py` | `python examples/manipulation/08_belief_grasp_selection.py` | pose belief -> grasp choice -> miss -> update -> retry |
4444
| `manipulation/09_active_viewpoint_for_grasp.py` | `python examples/manipulation/09_active_viewpoint_for_grasp.py` | choose view -> reduce occlusion -> grasp |
4545
| `manipulation/25_clear_path_before_pick.py` | `python examples/manipulation/25_clear_path_before_pick.py` | try pick -> precondition fails -> clear obstacle -> retry |
46+
| `manipulation/30_conformal_ask_for_help.py` | `python examples/manipulation/30_conformal_ask_for_help.py` | conformal calibration -> prediction set -> ask oracle when ambiguous |
4647

4748
## Embodied AI
4849

0 commit comments

Comments
 (0)