feat(lane_route): keep a preferred footprint gap on lattice paths (R2.5)

The lattice tier first finds a path with the minimum gap, as before, so
coverage cannot drop. If that path is not legal under
lattice_preferred_gap_m (0.15 m) away from the ends, a bounded upgrade
search (lattice_preferred_time_fraction of the rung slice) tries a wider
path and replaces it on success. Smoothing keeps the margin of the
returned path. PlanInfo, eval JSON and the plugin debug/fallback line
report the gap pass, the minimum gap and the upgrade time. The plugin
loads the preferred-gap and smoother keys.

regress7 (3 s): coverage equal to R2c (hook_150 1718, kit 1709),
graph-only output identical, middle gap >= 0.15 m on 133/153 and
128/190 lattice paths (R2c 88 and 89), Python recheck 0 bad.
This commit is contained in:
2026-11-09 17:42:48 +07:00
parent b0a3954541
commit d27cff23bd
11 changed files with 308 additions and 13 deletions

View File

@@ -56,6 +56,7 @@ struct LatticeContext
LatticeMemory& memory;
uint64_t* smooth_checks = nullptr;
uint64_t smooth_limit = 0;
double gap_scan_margin_m = 0.0; ///< [m] Additional gap reporting range; minimum search keeps the original scan.
bool cancelled() const { return request.cancel && request.cancel->load(std::memory_order_relaxed); }
bool expired() const { return cancelled() || Clock::now() >= deadline || (smooth_checks && *smooth_checks >= smooth_limit); }
@@ -121,6 +122,8 @@ class LatticeCSpace
{
public:
explicit LatticeCSpace(LatticeContext& context);
void setGapMargin(double margin);
double gapMargin() const { return gap_margin_; }
bool poseFree(double x, double y, double yaw, double sweep_margin = 0.0, double centre_sweep = 0.0);
bool segmentLegal(const PathPoint& a, const PathPoint& b);
bool spinLegal(double x, double y, double from, double to);
@@ -137,6 +140,7 @@ private:
bool prefix_ready_ = false;
double start_floor_ = 0.0; // [m] Gap margin allowed near the start, see endFloor().
double goal_floor_ = 0.0; // [m] Same near the goal.
double gap_margin_; // [m] Away from endpoints; changing it invalidates tile samples.
double endFloor(const Pose2& pose) const;
bool buildBlockedPrefix();
uint32_t blockedCount(int32_t x0, int32_t y0, int32_t x1, int32_t y1) const;