feat(lane_route_planner): trim endpoint spin fans, load zone_deviation_weight (R2.12)

- New output_endpoint_spins (default false): the published plan starts at the
  first driving pose and ends with one goal pose. The local planner turns in
  place by itself; the planner still verifies both spins are collision free.
- Load and clamp zone_deviation_weight; print both keys in the boot line.
- Tests for the trim helper (29 pass).
This commit is contained in:
2026-11-11 14:31:32 +07:00
parent 4bed23baa7
commit cca126551c
4 changed files with 75 additions and 4 deletions

View File

@@ -67,6 +67,27 @@ std::string SessionConfig::validate() const
return planner.validate();
}
lane_route_core::Path trimEndpointSpins(const lane_route_core::Path& path)
{
// The core writes an endpoint rotation as poses at one exact position, so a tight tolerance is enough.
constexpr double kSamePositionM = 1e-6;
const auto same = [&path](std::size_t a, std::size_t b) {
return std::hypot(path[a].x - path[b].x, path[a].y - path[b].y) <= kSamePositionM;
};
if (path.size() < 3)
return path;
std::size_t first = 0;
while (first + 1 < path.size() && same(first, first + 1))
++first;
std::size_t last = path.size() - 1;
while (last > first && same(last - 1, last))
--last;
if (first >= last)
return path;
return lane_route_core::Path(path.begin() + static_cast<std::ptrdiff_t>(first),
path.begin() + static_cast<std::ptrdiff_t>(last) + 1);
}
namespace
{
// Run-length text in the format lane_route_eval reads: "<key> <run count>" then "<value> <count>" pairs.