Skip to content

Add TSP route ordering (Fields2Cover genRoute / OR-Tools) (humble)#129

Merged
SteveMacenski merged 6 commits into
open-navigation:humble-v2from
u33549:Feature/umutc/f2c-enhancements-humble-v2/tsp-route
Jul 15, 2026
Merged

Add TSP route ordering (Fields2Cover genRoute / OR-Tools) (humble)#129
SteveMacenski merged 6 commits into
open-navigation:humble-v2from
u33549:Feature/umutc/f2c-enhancements-humble-v2/tsp-route

Conversation

@u33549

@u33549 u33549 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Humble 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 humble-v2 and builds on the earlier humble ports (#122, #125).

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.


From this PR onward the binary (apt) Fields2Cover build can no longer be used — Fields2Cover v2.0.0 built from source is required (genRoute gained its OR-Tools time_limit / search_for_optimum parameters in the v2.0.0 tag).

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.
Copilot AI review requested due to automatic review settings July 15, 2026 22:22

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.

u33549 added 5 commits July 16, 2026 01:32
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.
@u33549
u33549 force-pushed the Feature/umutc/f2c-enhancements-humble-v2/tsp-route branch from 07ac871 to 60d2979 Compare July 15, 2026 22:33
@SteveMacenski
SteveMacenski merged commit 54c003e into open-navigation:humble-v2 Jul 15, 2026
7 checks passed
@u33549
u33549 deleted the Feature/umutc/f2c-enhancements-humble-v2/tsp-route branch July 16, 2026 21:04
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