Skip to content

Add TSP route ordering (Fields2Cover genRoute / OR-Tools) (Lyrical)#130

Merged
SteveMacenski merged 7 commits into
open-navigation:lyricalfrom
u33549:Feature/umutc/f2c-enhancements-lyrical/tsp-route
Jul 16, 2026
Merged

Add TSP route ordering (Fields2Cover genRoute / OR-Tools) (Lyrical)#130
SteveMacenski merged 7 commits into
open-navigation:lyricalfrom
u33549:Feature/umutc/f2c-enhancements-lyrical/tsp-route

Conversation

@u33549

@u33549 u33549 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Lyrical port of #117. Adds a TSP-based route orderer — ordering the unordered
swaths via Fields2Cover's genRoute (OR-Tools) — as a new TSP route mode,
alongside the existing BOUSTROPHEDON / SNAKE / SPIRAL / CUSTOM orderers.
Targets lyrical and builds on the earlier lyrical F2C v2 ports (most recently
the decomposition port #126).

Changes

TSP route planning (core)

  • New RouteMethod layer unifying F2C's two unrelated route planners
    (SingleCellSwathsOrderBase orderers and the OR-Tools RoutePlannerBase)
    behind one polymorphic call returning F2CRoute, so callers no longer branch
    on the route mode.
  • RouteType::TSP and the TSP knobs, wrapping F2C's genRoute with its OR-Tools
    parameters.
  • Wired into coverage_server / row_coverage_server: when route_mode = TSP,
    swaths are ordered by the TSP planner and the connecting path is planned over
    that route.
  • BT node ports exposing the TSP knobs.
  • Per-cell TSP + route stitching for multi-cell input: a single genRoute call
    builds an all-pairs path matrix that exhausts memory, so the route is planned
    per cell and stitched.

Interface changes (additive)

  • types.hpp: RouteType enum + TSP.
  • RouteMode.msg: mode now also accepts TSP; new TSP knobs
    tsp_redirect_swaths (bool), tsp_time_limit (s), tsp_search_for_optimum (bool).

Note

This PR adds standalone TSP ordering for a single (non-decomposed) field or cell.
A follow-up PR will route decomposed (multi-cell) fields with the TSP planner,
connecting cells through their shared headland rather than a direct shortcut.

u33549 added 6 commits July 16, 2026 01:20
Adds a TSP route orderer (Fields2Cover genRoute / OR-Tools) as a new TSP route
mode alongside BOUSTROPHEDON / SNAKE / SPIRAL / CUSTOM. Introduces a RouteMethod
polymorphic layer unifying F2C's swath orderers (SingleCellSwathsOrderBase) and
the OR-Tools route planner (RoutePlannerBase) behind one F2CRoute-returning call,
so callers no longer branch on the route mode. RouteGenerator resolves the mode
to a RouteMethod and exposes the TSP knobs (tsp_redirect_swaths, tsp_time_limit,
tsp_search_for_optimum, tsp_d_tol) as parameters and the RouteMode message.
A single multi-cell genRoute call makes RoutePlannerBase build the full all-pairs
path matrix, which exhausts memory (bad_alloc) on decomposed input. The cells are
disconnected anyway, so TspRouteMethod solves each cell alone and stitches the
per-cell routes in sweep order with straight-line bridges.
SwathGenerator::generateSwathsByCells returns per-cell swaths (F2CSwathsByCells)
without flattening, so the route planner can follow each cell's borders.
PathGenerator::generatePath now takes the ordered F2CRoute (headland connections
included) instead of raw swaths, and a toCoveragePathMsg overload converts an
ordered route's swath groups for the no-turns result.
coverage_server and row_coverage_server generate per-cell swaths, plan the
ordered route (TSP or orderer) over them via RouteGenerator, and plan the
connecting path over the resulting F2CRoute. An empty route is rejected, and the
new TSP knobs are handled in the dynamic parameter callback.
Exposes the TSP route knobs (tsp_redirect_swaths, tsp_time_limit,
tsp_search_for_optimum) as input ports on the ComputeCompleteCoveragePath
behavior tree node, forwarding them into the RouteMode goal.
Covers TSP route generation, route-type resolution, and the TSP knobs across
test_route / test_path / test_swath / test_server and the coverage BT tests.
Bumps the test_server gtest timeout to 300s for the OR-Tools solve and raises the
cancel BT service wait to 3000ms.
Copilot AI review requested due to automatic review settings July 15, 2026 22:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The navigator used ament_index_cpp::get_package_share_directory without
declaring the dependency or including its header, relying on transitive
includes. ament_index_cpp 1.14 (rolling/lyrical) removed that header,
breaking the build with "get_package_share_directory is not a member of
ament_index_cpp".

Add the explicit dependency in package.xml and CMakeLists, and include
the header in both the source and the test.
@SteveMacenski
SteveMacenski merged commit 14802c4 into open-navigation:lyrical Jul 16, 2026
7 checks passed
@u33549
u33549 deleted the Feature/umutc/f2c-enhancements-lyrical/tsp-route branch July 16, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants