feat(lane_route_core): follow preferred lanes, fail fast on blocked goals, allow_unknown (R2.14)
- Start and goal attach to the middle of nearby edges: query-time split points (projection and +-1.5 m) on up to 6 directed edges within 3 m, plus up to 4 preferred edges within 8 m. The compiled graph is unchanged; retries block the parent edge. - Preferred lanes join each other and split nodes; lane ends are protected from swing merging, and turns next to a preferred ridge are not penalised. Hard rules (forward only, radius, 30 mm gap) are unchanged. - Goal footprint on a lethal cell returns goal_in_obstacle before any search; on unknown it returns goal_in_unknown unless allow_unknown. - allow_unknown (default false): when true every planner check treats unknown as free. The reference graph from robot_costmap_2d still skips unknown. SEHC replay: lane metres m4 0.3 -> 13.3, m7 1.1 -> 13.8, m8 0.4 -> 26.4. Random near-lane 190/200 both; NVC 316/316; regress7 3418 (4 losses all solve when run alone); m15 31.0 m 8/8; independent recheck 0 violations. 146 tests.
This commit is contained in:
@@ -226,7 +226,7 @@ std::shared_ptr<MapData> loadMap(const std::string& path, const robot_costmap_2d
|
||||
return map;
|
||||
}
|
||||
|
||||
GridRef gridOf(const MapData& map, const std::vector<uint8_t>& cost, const uint16_t* clearance, int variant)
|
||||
GridRef gridOf(const MapData& map, const std::vector<uint8_t>& cost, const uint16_t* clearance, int variant, bool allow_unknown)
|
||||
{
|
||||
GridRef grid;
|
||||
grid.width = map.width;
|
||||
@@ -237,6 +237,7 @@ GridRef gridOf(const MapData& map, const std::vector<uint8_t>& cost, const uint1
|
||||
grid.cost = cost.data();
|
||||
grid.clearance_mm = clearance;
|
||||
grid.direction = map.directions[static_cast<std::size_t>(variant)].data();
|
||||
grid.allow_unknown = allow_unknown;
|
||||
return grid;
|
||||
}
|
||||
|
||||
@@ -293,6 +294,7 @@ void applyOverrides(PlannerConfig* config)
|
||||
{ "lattice_smooth_max_checks", &config->lattice_smooth_max_checks },
|
||||
};
|
||||
const std::map<std::string, bool*> bools{
|
||||
{ "allow_unknown", &config->allow_unknown },
|
||||
{ "detour_upgrade_enabled", &config->detour_upgrade_enabled },
|
||||
{ "lattice_smooth_enabled", &config->lattice_smooth_enabled },
|
||||
{ "lattice_tight_arcs", &config->lattice_tight_arcs },
|
||||
@@ -441,9 +443,9 @@ int main(int argc, char** argv)
|
||||
live_cost[static_cast<std::size_t>(y * map->width + x)] = kLethalCost;
|
||||
}
|
||||
|
||||
const GridRef compile_grid = gridOf(*map, map->static_cost, map->clearance_mm.data(), variant);
|
||||
const GridRef compile_grid = gridOf(*map, map->static_cost, map->clearance_mm.data(), variant, config.allow_unknown);
|
||||
const Clock::time_point update_began = Clock::now();
|
||||
const GridRef unpatched = gridOf(*map, live_cost, map->clearance_mm.data(), variant);
|
||||
const GridRef unpatched = gridOf(*map, live_cost, map->clearance_mm.data(), variant, config.allow_unknown);
|
||||
request.changed_boxes = changedBoxes(map->static_cost.data(), unpatched);
|
||||
std::vector<uint16_t> patched;
|
||||
const uint16_t* live_clearance = map->clearance_mm.data();
|
||||
@@ -453,7 +455,7 @@ int main(int argc, char** argv)
|
||||
live_clearance = patched.data();
|
||||
}
|
||||
const double update_ms = msSince(update_began);
|
||||
const GridRef live_grid = gridOf(*map, live_cost, live_clearance, variant);
|
||||
const GridRef live_grid = gridOf(*map, live_cost, live_clearance, variant, config.allow_unknown);
|
||||
|
||||
double coarse_ms = 0.0;
|
||||
const CoarseGraph* coarse = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user