Files
lane_route_planner/README.md
duongtd f6c69b94a9 feat(lane_route): second heuristic field and diagonal zone margin (R2.10)
- lattice_alt_field_enabled (default false), lattice_alt_field_relax_m,
  lattice_alt_field_switch_fraction: when the search on the first field
  has not finished at the switch point, it restarts once on a field with
  no extra clearance and the alternate relax. Exhausted searches do not
  switch. PlanInfo/eval/debug line report field_pass.
- lattice_field_zone_margin_deg (default 0): diagonal field steps through
  a direction zone must stay that far inside the deviation limit; at
  exactly 45 deg the field otherwise follows a diagonal a turning robot
  cannot hold (sim M4, M7, 4a timed out even with 10 s).
- lane_route_eval compiles the graph with the live master when it holds
  preferred cells, as the plugin does.
- Measured 10/11 (sim settings, 10 s, margin 15, alternate on): regress7
  hook_150 1719, kit 1718, no query lost, independent recheck 0 bad.
2026-11-10 13:42:23 +07:00

84 lines
6.6 KiB
Markdown

# LaneRoutePlanner
A `robot_nav_core::BaseGlobalPlanner` and `Preemptable` Boost.DLL plugin using
`lane_route_core` and the immutable `robot_costmap_2d` reference-graph and direction snapshots.
The `LaneRoutePlannerExternalGrid` capability accepts the caller's non-owning snapshot. The caller
must keep that grid alive throughout `makePlan`. A missing, pending or stale graph returns failure;
the navigation host decides whether to try another planner. No planner is selected by this package.
The cached compiled graphs are dropped when the reference generation, footprint, direction snapshot,
or the exact preferred-cell mask changes. Other master costs are read again at query time. The core
uses the worker's ridge parameters for a live rebuild. `time_limit_s` defaults to 20 seconds.
## Lattice fallback
The optional weighted A* SE(2) lattice runs after an eligible graph-tier failure. It retains the
core's forward-only, curvature, end-spin, footprint-gap and direction-zone checks. It is off by
default; set `lattice_enabled: true` to enable it. The sim/dev runtime YAML enables it for testing.
The fallback shares `time_limit_s` and has its own `fallback_time_limit_s` budget across rungs and
smoothing; a graph result or an early failure can prevent it from running.
Keys (defaults from `PlannerConfig`):
- `lattice_enabled: false`, `lattice_heading_bins: 72`, `lattice_closed_resolution_m: 0.10`,
`lattice_heuristic_weight: 3.0`, `lattice_bucket_width_m: 0.25`.
- `lattice_field_clearance_weight_m: 0.25`, `lattice_wall_weight_m: 0.25`,
`lattice_switch_cost_m: 0.35`, `lattice_steer_cost_m: 0.012`.
- `lattice_primitive_multiple_1: 1`, `lattice_primitive_multiple_2: 3`,
`lattice_primitive_multiple_3: 6`.
- `lattice_analytic_radius_m: 1.08`, `lattice_analytic_interval: 20000`,
`lattice_analytic_near_goal_m: 2.0`, `lattice_analytic_goal_headings: 16`.
- `lattice_field_time_fraction: 0.4`, `lattice_field_cell_factor: 0`,
`lattice_field_max_cells: 1000000`, `fallback_time_limit_s: 3.0`,
`lattice_end_relax_radius_m: 1.0`, `lattice_max_memory_mb: 512` (MiB).
- `lattice_preferred_gap_m: 0.15`, `lattice_preferred_time_fraction: 0.25`: each rung first finds a
minimum-gap path, then checks it for the preferred gap away from the ends. If needed, a new search
uses at most the configured share of the rung budget. An unsuccessful upgrade retains the verified minimum path.
A preferred gap at or below `footprint_min_gap_m` disables the upgrade.
- `lattice_smooth_enabled: true`, `lattice_smooth_max_checks: 450000`.
- `regular_turn_radius_m: 1.06`: radius ladder. The first graph pass, the lattice and the smoother
use only radii at or above it, as before. When `min_turn_radius_m` is lower, the graph adds a second
pass with all `corner_radii_m` (largest first) if the first pass fails or returns a long detour, and
keeps it only when it is at least 20% shorter.
- `max_kink_deg: 45`: bottom rung of the ladder. In the graph's second pass, a corner where no radius fits may become a sharp
corner (two straight lines meeting at a vertex, no turn in place) up to this heading change, when the footprint can rotate
at the vertex without touching an obstacle. The verifier counts such corners in `PathCheck::corners`. 0 disables them.
- `lattice_tight_arcs: false`, `lattice_tight_turn_cost_m: 0.15`: optional lattice arcs at
`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.
- `lattice_field_zone_margin_deg: 0.0` [deg]: the heuristic field takes a diagonal grid step through a direction zone only
within (deviation - margin) of the zone direction. Grid steps are 45 deg apart, so at a deviation of exactly 45 deg the
field otherwise follows a diagonal at the limit of the rule that a turning robot cannot hold, and the search floods
until the budget ends. Axis steps keep the full deviation (closing them too slowed 90 deg queries). Search and
verification keep the full deviation.
- `lattice_alt_field_enabled: false`, `lattice_alt_field_relax_m: 0.035` [m], `lattice_alt_field_switch_fraction: 0.35`:
a second heuristic field. One 2D field cannot suit both kinds of narrow passage: a strict field closes passages the
robot only fits off the cell centre, an optimistic one leads the search into post gaps no heading fits. When the
search on the first field has not finished at the switch fraction of the fallback slice, it restarts once on a field
with no extra clearance and the alternate relax. An exhausted search does not switch (the field orders states, it
does not make them legal). Skipped when the first field already has no extra clearance and the same relax. The
`[debug] fallback` line reports `field_pass=primary|alternate`.
- `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
each dump writes a few MB.
- `debug/fallback: true` enables one diagnostic line per request when lattice ran; failure logs
remain enabled. See the runtime YAML for units, tuning effects and valid ranges.
Cancellation is checked during graph compilation and core planning. Preferred-region centre-line
extraction does not itself accept cancellation: a request arriving during that call waits until it
returns. It runs only on compilation when the master has preferred cells; its worst-case time is
unmeasured. Live ridge skeleton and graph construction receive the cancellation flag.
Master cost 100 is interpreted as UNPREFERRED. Inflation can produce exactly 100 under some
parameter sets, causing a small penalty and potentially an extra neutral pass on failure. The
current inflation parameters have not produced that value; no normalization is applied.
The tests exercise snapshots, grids and NodeHandle configuration without a real Costmap2DROBOT. Plugin loading,
runtime parameter discovery, external-grid lifetime, snapshot synchronization, output headers,
and integration with the navigation host still require runtime validation.