feat(lane_route): radius ladder and failure dumps (R2.6)

Radius ladder: the first graph pass, the lattice and the smoother use
only radii at or above regular_turn_radius_m (1.06 m), as before. When
min_turn_radius_m is lower, the graph runs a second pass with all
corner_radii_m if the first fails or returns a long detour, and keeps
it only when at least 20% shorter. Optional lattice tight arcs exist
behind lattice_tight_arcs (off: they cost many queries to timeouts).
C++ defaults keep the old 1.06 m floor; regress7 output is identical.
With a 0.4 m floor: graph-only coverage +5 (hook_150) and +8 (kit),
none lost; with fallback, coverage unchanged and 27/29 queries move
from lattice to graph; tight corners used 0.9 m.

Failure dumps: with debug/dump_dir set, the plugin writes each failed
query as lane_route_eval input (static cost, master cost, direction
codes, poses, settings), at most debug/dump_max_files per session.
This commit is contained in:
2026-11-09 20:09:43 +07:00
parent d27cff23bd
commit 907fa0c4dc
8 changed files with 149 additions and 14 deletions

View File

@@ -117,7 +117,8 @@ GridRef gridOf(const MapData& map, const std::vector<uint8_t>& cost, const uint1
return grid;
}
/** Offline tuning without a rebuild: LANE_ROUTE_EVAL_SET="name=value,name=value" overrides lattice and fallback fields.
/** Offline tuning without a rebuild: LANE_ROUTE_EVAL_SET="name=value,name=value" overrides lattice, fallback and turn radius
* fields.
* Unknown names are an error, so a typo cannot silently run the defaults. */
void applyOverrides(PlannerConfig* config)
{
@@ -139,6 +140,9 @@ void applyOverrides(PlannerConfig* config)
{ "lattice_field_time_fraction", &config->lattice_field_time_fraction },
{ "fallback_time_limit_s", &config->fallback_time_limit_s },
{ "lattice_end_relax_radius_m", &config->lattice_end_relax_radius_m },
{ "min_turn_radius_m", &config->min_turn_radius_m },
{ "regular_turn_radius_m", &config->regular_turn_radius_m },
{ "lattice_tight_turn_cost_m", &config->lattice_tight_turn_cost_m },
};
const std::map<std::string, int*> ints{
{ "lattice_heading_bins", &config->lattice_heading_bins },
@@ -155,6 +159,7 @@ void applyOverrides(PlannerConfig* config)
};
const std::map<std::string, bool*> bools{
{ "lattice_smooth_enabled", &config->lattice_smooth_enabled },
{ "lattice_tight_arcs", &config->lattice_tight_arcs },
};
std::stringstream stream(text);
std::string item;
@@ -173,6 +178,15 @@ void applyOverrides(PlannerConfig* config)
*longs.at(key) = std::stoll(value);
else if (bools.count(key) != 0)
*bools.at(key) = std::stoi(value) != 0;
else if (key == "corner_radii_m")
{
// A list inside the comma-separated overrides uses '/', e.g. corner_radii_m=1.9/1.3/0.6, largest first.
std::stringstream radii(value);
std::string radius;
config->corner_radii_m.clear();
while (std::getline(radii, radius, '/'))
config->corner_radii_m.push_back(std::stod(radius));
}
else
throw std::runtime_error("unknown LANE_ROUTE_EVAL_SET key: " + key);
std::cerr << "override " << key << "=" << value << std::endl;
@@ -357,7 +371,7 @@ int main(int argc, char** argv)
<< ",\"lattice_ms\":" << info.lattice_ms
<< ",\"lattice_smooth_ms\":" << info.lattice_smooth_ms << ",\"lattice_smooth_checks\":" << info.lattice_smooth_checks
<< ",\"lattice_smoothed\":" << info.lattice_smoothed << ",\"curvature_sign_changes\":" << info.curvature_sign_changes
<< ",\"path_length_m\":" << info.path_length_m << ",\"straight_share\":" << info.straight_share
<< ",\"graph_radius_pass\":\"" << info.graph_radius_pass << "\"" << ",\"max_curvature\":" << result.check.max_curvature << ",\"path_length_m\":" << info.path_length_m << ",\"straight_share\":" << info.straight_share
<< ",\"lattice_smooth_connectors_tried\":" << info.lattice_smooth_connectors_tried
<< ",\"lattice_smooth_connectors_ok\":" << info.lattice_smooth_connectors_ok
<< ",\"lattice_smooth_candidates\":" << info.lattice_smooth_candidates