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:
@@ -69,6 +69,12 @@ SessionConfig loadSessionConfig(const robot::NodeHandle& nh)
|
||||
load("live_ridge_max_cells", max_cells, max_cells);
|
||||
p.live_ridge_max_cells = max_cells;
|
||||
load("lattice_enabled", p.lattice_enabled, d.lattice_enabled);
|
||||
load("lattice_preferred_gap_m", p.lattice_preferred_gap_m, d.lattice_preferred_gap_m);
|
||||
load("lattice_preferred_time_fraction", p.lattice_preferred_time_fraction, d.lattice_preferred_time_fraction);
|
||||
load("lattice_smooth_enabled", p.lattice_smooth_enabled, d.lattice_smooth_enabled);
|
||||
int smooth_max_checks = static_cast<int>(d.lattice_smooth_max_checks);
|
||||
load("lattice_smooth_max_checks", smooth_max_checks, smooth_max_checks);
|
||||
p.lattice_smooth_max_checks = smooth_max_checks;
|
||||
load("lattice_heading_bins", p.lattice_heading_bins, d.lattice_heading_bins);
|
||||
load("lattice_closed_resolution_m", p.lattice_closed_resolution_m, d.lattice_closed_resolution_m);
|
||||
load("lattice_heuristic_weight", p.lattice_heuristic_weight, d.lattice_heuristic_weight);
|
||||
@@ -103,11 +109,13 @@ SessionConfig loadSessionConfig(const robot::NodeHandle& nh)
|
||||
void logPlanResult(const lane_route_core::PlanResult& result, bool debug_fallback)
|
||||
{
|
||||
if (debug_fallback && result.info.lattice_ms > 0.0)
|
||||
robot::log_info("[lane_route_planner] [debug] fallback tier=%s graph_reason=%s lattice_reason=%s expanded=%llu field=%.1fms search=%.1fms verify=%.1fms peak=%.1fMiB",
|
||||
robot::log_info("[lane_route_planner] [debug] fallback tier=%s graph_reason=%s lattice_reason=%s gap_pass=%s min_gap_m=%.3f gap_exact=%d expanded=%llu field=%.1fms search=%.1fms verify=%.1fms upgrade=%.1fms peak=%.1fMiB",
|
||||
result.info.tier_used.empty() ? "none" : result.info.tier_used.c_str(),
|
||||
result.info.graph_reason.c_str(), result.info.lattice_reason.c_str(),
|
||||
result.info.lattice_gap_pass.empty() ? "none" : result.info.lattice_gap_pass.c_str(), result.info.min_gap_m,
|
||||
result.info.lattice_gap_exact ? 1 : 0,
|
||||
static_cast<unsigned long long>(result.info.lattice_states_expanded), result.info.lattice_field_ms,
|
||||
result.info.lattice_search_ms, result.info.lattice_verify_ms,
|
||||
result.info.lattice_search_ms, result.info.lattice_verify_ms, result.info.lattice_upgrade_ms,
|
||||
static_cast<double>(result.info.lattice_peak_bytes) / (1024.0 * 1024.0));
|
||||
if (!result.ok || result.path.empty() || !result.check.valid)
|
||||
{
|
||||
@@ -126,7 +134,8 @@ bool LaneRoutePlanner::initialize(std::string name, robot_costmap_2d::Costmap2DR
|
||||
robot::NodeHandle nh(root, name);
|
||||
config_ = loadSessionConfig(nh);
|
||||
std::string error = config_.validate();
|
||||
// Core validates lattice limits only when enabled; reject invalid dormant settings too.
|
||||
// Core validates lattice limits only when enabled; reject invalid dormant settings too, so turning the lattice on later
|
||||
// cannot reveal a broken value on the robot.
|
||||
if (error.empty() && !config_.planner.lattice_enabled)
|
||||
{
|
||||
auto lattice_config = config_.planner;
|
||||
@@ -150,8 +159,9 @@ 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_heuristic_weight=%.2f lattice_heading_bins=%d lattice_max_memory_mb=%lld debug/fallback=%d",
|
||||
p.lattice_enabled, p.fallback_time_limit_s, p.lattice_heuristic_weight, p.lattice_heading_bins,
|
||||
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",
|
||||
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);
|
||||
if (costmap_->getLayeredCostmap()->getReferenceGraphSnapshot().state == robot_costmap_2d::ReferenceGraphState::kDisabled)
|
||||
robot::log_error("[lane_route_planner] reference graph is disabled; plans will fail until enabled");
|
||||
|
||||
Reference in New Issue
Block a user