Commit Graph

2 Commits

Author SHA1 Message Date
471d13410c feat(sbpl): rebuild the direction table when the field deviation changes
The per-action mask table records the deviation it was built with. When
a ready field carries another value, rebuild before attaching it and
plan from scratch; on failure keep the old table, detach the field and
refuse to plan.
2026-11-04 08:52:00 +07:00
47dd76f39e feat(sbpl): plan only along allowed directions of the direction field
DirectionalEnvironmentNAVXYTHETALAT overrides GetActionCost: after the
base obstacle cost, it rejects an action when a cell the primitive's
reference point crosses has a direction code whose mask forbids that
segment's displacement (dot(v, d) >= 0 allowed), or when the cell is
outside the grid. Per-action (dx, dy, mask) tables are precomputed with
the shared DDA once per environment init; near-integer grid coordinates
are snapped to avoid sliver cells from binary rounding.

makePlan reads the LayeredCostmap direction snapshot once and keeps it
for the whole call: PENDING or a geometry mismatch refuses to plan, a
state/generation change forces planning from scratch, and the path is
discarded if the field changed during the search. Environment init
failure now returns false instead of exit(1).

Tests: direction_environment_test (4) passes, including forward and
backward ARA* detours and the no-solution case.
2026-11-03 16:55:23 +07:00