feat(lane_route): heuristic-only standability relax for the lattice field (R2.9)

- lattice_field_standability_relax_m (default 0): shrinks the inflated
  footprint half sizes for the lattice heuristic field only; graph
  reference, C-space and verification stay strict.
- Plugin loads it, prints it on the fallback boot line; README and eval
  override key.
- Measured 10/11: with extra field clearance 0 any relax reopens the sim
  post gaps (dumps 1, 2, 4 time out); with extra clearance 0.1 a relax of
  0.035 keeps them and gains one kit query.
This commit is contained in:
2026-11-10 10:36:02 +07:00
parent ebb7b01333
commit 53a0686b48
3 changed files with 16 additions and 2 deletions

View File

@@ -47,6 +47,9 @@ Keys (defaults from `PlannerConfig`):
`min_turn_radius_m`; off because they cost many regress7 queries to timeouts.
- `lattice_field_extra_clearance_m: 0.0`: extra clearance a cell needs in the lattice heuristic field only, so the field
stays out of gaps barely wider than the robot; when that closes the only way to the start, the plain field is rebuilt.
- `lattice_field_standability_relax_m: 0.0` [m]: shrink each inflated footprint half size for the lattice field's
standability test only. Higher values can reopen blocked gaps and improve the guide, but can also guide search into
impossible gaps. The extra-clearance filter remains separate; search and final footprint checks keep the full gap.
- `debug/dump_dir: ""`, `debug/dump_max_files: 20`: when the directory is set, each failed query
writes its static cost, master cost, direction codes and poses as `lane_route_eval` input
(`<stem>.grid`, `.live`, `.scene`, `.txt`), at most that many per session. Off by default because

View File

@@ -95,6 +95,7 @@ SessionConfig loadSessionConfig(const robot::NodeHandle& nh)
load("lattice_analytic_near_goal_m", p.lattice_analytic_near_goal_m, d.lattice_analytic_near_goal_m);
load("lattice_analytic_goal_headings", p.lattice_analytic_goal_headings, d.lattice_analytic_goal_headings);
load("lattice_field_extra_clearance_m", p.lattice_field_extra_clearance_m, d.lattice_field_extra_clearance_m);
load("lattice_field_standability_relax_m", p.lattice_field_standability_relax_m, d.lattice_field_standability_relax_m);
load("lattice_field_time_fraction", p.lattice_field_time_fraction, d.lattice_field_time_fraction);
load("lattice_field_cell_factor", p.lattice_field_cell_factor, d.lattice_field_cell_factor);
int field_max_cells = static_cast<int>(d.lattice_field_max_cells);
@@ -166,10 +167,10 @@ bool LaneRoutePlanner::initialize(std::string name, robot_costmap_2d::Costmap2DR
robot::log_info("[lane_route_planner] %s: time_limit=%.2fs min_radius=%.3fm clearance_margin=%.3fm gap=%.3fm debug_plan=%d debug_state=%d",
name.c_str(), p.time_limit_s, p.min_turn_radius_m, config_.clearance_min_margin_m,
p.footprint_min_gap_m, config_.debug_plan, config_.debug_state);
robot::log_info("[lane_route_planner] fallback: lattice_enabled=%d fallback_time_limit_s=%.2f lattice_preferred_gap_m=%.3f lattice_preferred_time_fraction=%.2f lattice_smooth_enabled=%d lattice_smooth_max_checks=%lld lattice_heuristic_weight=%.2f lattice_heading_bins=%d lattice_max_memory_mb=%lld debug/fallback=%d",
robot::log_info("[lane_route_planner] fallback: lattice_enabled=%d fallback_time_limit_s=%.2f lattice_preferred_gap_m=%.3f lattice_preferred_time_fraction=%.2f lattice_smooth_enabled=%d lattice_smooth_max_checks=%lld lattice_heuristic_weight=%.2f lattice_heading_bins=%d lattice_max_memory_mb=%lld lattice_field_standability_relax_m=%.3f debug/fallback=%d",
p.lattice_enabled, p.fallback_time_limit_s, p.lattice_preferred_gap_m, p.lattice_preferred_time_fraction,
p.lattice_smooth_enabled, static_cast<long long>(p.lattice_smooth_max_checks), p.lattice_heuristic_weight, p.lattice_heading_bins,
static_cast<long long>(p.lattice_max_memory_mb), config_.debug_fallback);
static_cast<long long>(p.lattice_max_memory_mb), p.lattice_field_standability_relax_m, config_.debug_fallback);
robot::log_info("[lane_route_planner] radii: min_turn_radius_m=%.3f corner_radii_m=%zu values %.3f..%.3f regular_turn_radius_m=%.3f max_kink_deg=%.1f lattice_tight_arcs=%d lattice_tight_turn_cost_m=%.3f",
p.min_turn_radius_m, p.corner_radii_m.size(), p.corner_radii_m.front(), p.corner_radii_m.back(),
p.regular_turn_radius_m, p.max_kink_deg, p.lattice_tight_arcs, p.lattice_tight_turn_cost_m);

View File

@@ -253,6 +253,7 @@ TEST(AdapterConfig, LatticeYamlReachesPlannerConfig)
lattice_analytic_interval: 123
lattice_analytic_near_goal_m: 1.5
lattice_analytic_goal_headings: 8
lattice_field_standability_relax_m: 0.035
lattice_field_time_fraction: 0.3
lattice_field_cell_factor: 2
lattice_field_max_cells: 123456
@@ -285,6 +286,7 @@ TEST(AdapterConfig, LatticeYamlReachesPlannerConfig)
EXPECT_EQ(p.lattice_analytic_interval, 123);
EXPECT_DOUBLE_EQ(p.lattice_analytic_near_goal_m, 1.5);
EXPECT_EQ(p.lattice_analytic_goal_headings, 8);
EXPECT_DOUBLE_EQ(p.lattice_field_standability_relax_m, 0.035);
EXPECT_DOUBLE_EQ(p.lattice_field_time_fraction, 0.3);
EXPECT_EQ(p.lattice_field_cell_factor, 2);
EXPECT_EQ(p.lattice_field_max_cells, 123456);
@@ -303,6 +305,7 @@ TEST(AdapterConfig, LatticeYamlReachesPlannerConfig)
EXPECT_EQ(defaults.planner.lattice_smooth_enabled, expected.lattice_smooth_enabled);
EXPECT_EQ(defaults.planner.lattice_smooth_max_checks, expected.lattice_smooth_max_checks);
EXPECT_DOUBLE_EQ(defaults.planner.fallback_time_limit_s, expected.fallback_time_limit_s);
EXPECT_DOUBLE_EQ(defaults.planner.lattice_field_standability_relax_m, 0.0);
EXPECT_EQ(defaults.planner.lattice_field_max_cells, expected.lattice_field_max_cells);
EXPECT_EQ(defaults.planner.lattice_max_memory_mb, expected.lattice_max_memory_mb);
EXPECT_TRUE(defaults.debug_fallback);
@@ -350,6 +353,13 @@ TEST(AdapterConfig, InvalidLatticeRejectsPluginInitialization)
EXPECT_FALSE(disabled_smooth.initialize("LaneRouteDisabledSmoothTest", nullptr));
const std::string disabled_smooth_log = testing::internal::GetCapturedStdout();
EXPECT_NE(disabled_smooth_log.find("invalid configuration"), std::string::npos);
root.setParam("LaneRouteBadFieldRelaxTest", YAML::Load("{lattice_enabled: false, lattice_field_standability_relax_m: -0.001}"));
LaneRoutePlanner bad_field_relax;
testing::internal::CaptureStdout();
EXPECT_FALSE(bad_field_relax.initialize("LaneRouteBadFieldRelaxTest", nullptr));
const std::string bad_field_relax_log = testing::internal::GetCapturedStdout();
EXPECT_NE(bad_field_relax_log.find("lattice_field_standability_relax_m"), std::string::npos);
}
TEST(AdapterLog, FallbackSwitchDoesNotSuppressFailure)