feat(lane_route): smooth lattice paths (R2) and expose the lattice tier in the plugin (R3)

- lane_route_core: port of the S3 smoother for lattice paths (direct,
  greedy and bounded graph improvement over witness anchors, then
  clothoid corners when budget remains), shape metrics and smoother
  diagnostics in PlanInfo and lane_route_eval.
- lane_route_planner: loads the lattice keys from YAML, logs a config
  summary at start-up and one debug/fallback line per lattice request.

regress7: coverage unchanged from R1, every lattice path smoothed, 0 bad
in the independent recheck. Local snapshot for history only; not pushed.
This commit is contained in:
2026-11-09 16:11:34 +07:00
parent 24822f5408
commit b0a3954541
13 changed files with 946 additions and 20 deletions

View File

@@ -40,6 +40,30 @@ PlanResult planRoute(const GraphProvider& graphs, const RouteRequest& request, c
result.path.clear();
result.info.reason = "cancelled";
}
if (result.ok)
{
int previous_sign = 0;
double straight = 0.0;
for (std::size_t i = 1; i < result.path.size(); ++i)
{
const PathPoint& a = result.path[i - 1];
const PathPoint& b = result.path[i];
const double length = std::hypot(b.x - a.x, b.y - a.y);
if (length < 1e-9) continue;
const double turn = wrapAngle(b.yaw - a.yaw);
const double arc = std::abs(turn) < 1e-9 ? length : length * std::abs(turn) / (2.0 * std::abs(std::sin(turn / 2.0)));
result.info.path_length_m += arc;
const double curvature = turn / arc;
const int sign = curvature > 0.001 ? 1 : curvature < -0.001 ? -1 : 0;
if (sign == 0) straight += arc;
else
{
if (previous_sign != 0 && sign != previous_sign) ++result.info.curvature_sign_changes;
previous_sign = sign;
}
}
if (result.info.path_length_m > 0.0) result.info.straight_share = straight / result.info.path_length_m;
}
return result;
};
const std::string config_error = config.validate();
@@ -144,7 +168,7 @@ PlanResult planRoute(const GraphProvider& graphs, const RouteRequest& request, c
break;
}
const TimePoint rung_deadline = now + (fallback_deadline - now) / static_cast<Clock::duration::rep>(rungs.size() - rung);
if (detail::planLatticeTier({ request, live, config, deviation, rung_deadline },
if (detail::planLatticeTier({ request, live, config, deviation, rung_deadline, fallback_deadline },
{ result.path, result.check, result.info }))
{
result.ok = true;