Skip to main content

Module safe_decode_nav

Module safe_decode_nav 

Source
Expand description

SafeDec-lite: STL-shielded constrained decoding for grid navigation.

This reproduces the core idea of constrained decoding for safe navigation policies without a learned model: a base navigation policy proposes a score for each discrete action, and a shield expressed in Signal Temporal Logic (STL) keeps the decoded action sequence safe.

  • The base policy here is a deterministic greedy goal-seeker — it always prefers the action that most reduces distance to the goal, which happily cuts straight through a hazard.
  • The shield is a set of STL specifications reusing crate::stl_cbs primitives: an always-avoid geofence over a time interval (a hard constraint — candidates entering it are pruned) and an eventually-reach goal region (a soft reward that shapes the beam).
  • SafeDecoder::decode runs a deterministic constrained beam search and returns both the greedy (unshielded) path and the shielded path, so the number of steps where the shield overrode the greedy choice — and the resulting robustness gain — is directly measurable.

Everything is deterministic: ties are broken by action index and the beam is sorted with a stable total order.

Structs§

SafeDecodePlan
Result of a shielded decode, paired with the greedy baseline.
SafeDecoder
STL-shielded constrained decoder over a grid navigation policy.
SafeNavConfig
Configuration for the STL-shielded navigation decoder.
TimedRegion
A timed STL specification rectangle.