Skip to content

Use the rest of Fields2Cover v2.1.1 - #171

Merged
SteveMacenski merged 3 commits into
open-navigation:mainfrom
u33549:use-rest-of-f2c-211
Nov 27, 2026
Merged

SteveMacenski merged 3 commits into
open-navigation:mainfrom
u33549:use-rest-of-f2c-211

Conversation

@u33549

@u33549 u33549 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

#162 moved the pin to Fields2Cover v2.1.1 but left path_generator.cpp and route_method.cpp alone, so three local copies of things v2.1.1 now provides are still here. When #149 was closed I assumed its connection part had gone into #162; it had not. This PR drops those copies. Addresses the sharp corners reported in #168.

Changes

Commit Local code it removes (added in) Replaced by
Let Fields2Cover plan the swath connections PathGenerator::assemblePath and appendConnection (#137), distanceToSegment (#145) PathPlanning::planPath(robot, route, turn), which follows a connection and rounds its corners (Fields2Cover/Fields2Cover#234)
Reverse cell routes with Fields2Cover's Route::reverse reversedRoute, reversedConnection in the cell stitch (#137) Route::reverse (Fields2Cover/Fields2Cover#233)
Drop guards Fields2Cover 2.1.1 no longer needs per-pair try/catch around shortestPath and the two-cell check in buildBridge (#145), angDiff lambda (#137) shortestPath returns an empty path instead of throwing, and createShortestGraph skips swath ends outside every cell (Fields2Cover/Fields2Cover#239); F2CPoint::getAngleDiffAbs

Net: 4 files, +72 / -195 (code +11 / -194, tests +61 / -1).

Behaviour change: connections are followed and rounded

Before, a connection that bent away from the straight hop by half an operation width or more was driven verbatim as HL_SWATH states, turning 90 degrees at every corner. Fields2Cover now follows the same track and rounds its corners with the turn planner; a near-straight hop or a short reversal is still a single turn.

On the 30 fixed scenarios (31 runs, one scenario runs two goals in sequence):

  • 16 runs are bit-identical: every field without decomposition except the TSP run with a start pose, and one decomposed run that requests no path.
  • 15 change: the 14 decomposed runs with a path, and the TSP run with a start pose. Path length changes by at most 0.2 %.
  • Heading changes sharper than 1 rad drop from 163 to 69 across those 15 runs.
  • With Reeds-Shepp some rounded corners now include reverse legs: 12 direction changes instead of 2.

Testing

  • colcon test for opennav_coverage_msgs, opennav_coverage and opennav_row_coverage: 275 tests, 0 failures.
  • New TestpathGenerationConnectionCorners: a short reversal and a real detour. On main it fails (3 HL_SWATH states and 90 degree heading jumps); with this PR it passes and the detour is kept.
  • Each commit was run on the 30 scenarios and compared with the previous commit. The Route::reverse and guard commits produce bit-identical plans; cell routes are entered reversed in 12 of the 14 decomposed scenarios, so the reverse path is exercised.

Known issues (Fields2Cover side)

Both are reproduced with Fields2Cover alone (no opennav code).

  • Square corner at a swath end. When the connection turns 90 degrees right where the swath ends and a fillet would cut more than max_corner_cut, the corner is left square. Fields2Cover also treats a smaller bend as a detour than this package did (a quarter of the coverage width instead of half), so a connection that used to be one turn is now followed. This adds 4 such corners. Three of them sit next to a zero-length swath, the known issue mentioned in Use Fields2Cover v2.1.1 for the pieces it now provides #162.
  • No room to turn at a swath end. In three decomposed runs the headland (0.3 m) is narrower than the turning radius (0.35 m), so no turn the robot can drive fits inside the field where a swath ends and its connection runs straight back. Before, the path reversed in place there (two 90 degree corners 0.05 m apart). Now it is a U-turn the robot can drive, which swings 0.35 to 0.40 m outside the field.

Fields2Cover 2.1.1 follows a connection track and rounds its corners
(Fields2Cover#234). The local appendConnection drove a detour verbatim,
turning 90 degrees at every corner. Use F2C's route planPath instead.

Signed-off-by: u33549 <[email protected]>
shortestPath returns an empty path for a non-node endpoint instead of
throwing, and createShortestGraph leaves out swath ends outside every
cell (Fields2Cover#239). Use F2CPoint::getAngleDiffAbs for the heading
cost.

Signed-off-by: u33549 <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 27, 2026 16:01

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 insufficient remaining quota. Try requesting a review at a lower effort level.

@SteveMacenski
SteveMacenski merged commit 469faac into open-navigation:main Nov 27, 2026
9 checks passed
@SteveMacenski

Copy link
Copy Markdown
Member

Should Lyrical or others be updated as well?

@u33549

u33549 commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Yes, they should. I will make it as soon as possible.

SteveMacenski pushed a commit that referenced this pull request Nov 30, 2026
* Let Fields2Cover plan the swath connections

Fields2Cover 2.1.1 follows a connection track and rounds its corners
(Fields2Cover#234). The local appendConnection drove a detour verbatim,
turning 90 degrees at every corner. Use F2C's route planPath instead.

Adapted for humble: the connection handling removed here is #137's, with its 1.3 length-ratio rule; the deviation rule and distanceToSegment from #145 are not on humble.

(cherry picked from commit 5b95534, part of #171)
Signed-off-by: u33549 <[email protected]>

* Reverse cell routes with Fields2Cover's Route::reverse

Adapted for humble: the anonymous namespace held only these two helpers here, so it goes too.

(cherry picked from commit 2909e11, part of #171)
Signed-off-by: u33549 <[email protected]>

* Drop guards Fields2Cover 2.1.1 no longer needs

shortestPath returns an empty path for a non-node endpoint instead of
throwing, and createShortestGraph leaves out swath ends outside every
cell (Fields2Cover#239). Use F2CPoint::getAngleDiffAbs for the heading
cost.

Adapted for humble: the bridge guard here was the earlier pair_cells.size() > 0 check (the two-cell check came with #145). The per-pair try/catch in routeThroughCell is #145 code and is not on humble.

(cherry picked from commit 4fd8f6b, part of #171)
Signed-off-by: u33549 <[email protected]>

---------

Signed-off-by: u33549 <[email protected]>
SteveMacenski pushed a commit that referenced this pull request Nov 30, 2026
* Pin Fields2Cover to v2.1.1 for the upstreamed fixes

Fields2Cover v2.1.1 carries the fixes and APIs this package used to work
around: HL_SWATH densification, the corridor headland and the
degenerate-polygon guard.

Adapted for jazzy: jazzy-v2 only pins Fields2Cover in deps.repos, so only its version changes; the README note is updated to match.

(cherry picked from commit 2ef1796, part of #162)
Signed-off-by: u33549 <[email protected]>

* Drop the unused multi-cell headland overload

The server only calls the Field overload; the F2CCells one had no
callers left after the headland-first decomposition rework.

(cherry picked from commit 93915e2, part of #162)
Signed-off-by: u33549 <[email protected]>

* Carve the inter-cell corridor with Fields2Cover

CorridorHL finds the borders cells really share and carves the corridor
from the smaller cell. route_headland_width is now the total corridor
width; the previous code could carve it from both cells, or miss a
partially shared border.

(cherry picked from commit 8ecb2f4, part of #162)

Also drops the sliver filter Fields2Cover no longer needs:
CorridorHL already removes the zero-width pieces carving leaves, and the
degenerate-polygon crash the filter guarded against is fixed upstream.

(cherry picked from commit a4f3a87, part of #162)
Signed-off-by: u33549 <[email protected]>

* Remove the unused default_max_swaths_for_global_route parameter

It has had no effect since multi-cell TSP routing moved to a per-cell
solve; the threshold it set is no longer read.

(cherry picked from commit 852e0f1, part of #162)
Signed-off-by: u33549 <[email protected]>

* Report where a swath ends in the coverage path message

With Fields2Cover v2 a straight swath is a single path state, so taking
the end from that state's start point gave every swath start == end.
Use PathState::atEnd() instead.

Adapted for jazzy: only the swath end test is added; the HL_SWATH and headland perimeter tests next to it on main belong to #141, which is not on jazzy.

(cherry picked from commit af70ccf, part of #162)
Signed-off-by: u33549 <[email protected]>

* Densify GPS paths before leaving the field frame

The densification step is in meters, but it ran after the path was
converted to the GPS frame, so swath lengths were in degrees and no
state was ever split.

Adapted for jazzy: the densify call takes main's zero-step guard (pt_dist <= 0 falls back to 0.1 m). On main it came with the headland driving change, which is not on jazzy.

(cherry picked from commit e7eb93b, part of #162)
Signed-off-by: u33549 <[email protected]>

* Let Fields2Cover plan the swath connections

Fields2Cover 2.1.1 follows a connection track and rounds its corners
(Fields2Cover#234). The local appendConnection drove a detour verbatim,
turning 90 degrees at every corner. Use F2C's route planPath instead.

Adapted for jazzy: the connection handling removed here is #137's, with its 1.3 length-ratio rule; the deviation rule and distanceToSegment from #145 are not on jazzy.

(cherry picked from commit 5b95534, part of #171)
Signed-off-by: u33549 <[email protected]>

* Reverse cell routes with Fields2Cover's Route::reverse

Adapted for jazzy: the anonymous namespace held only these two helpers here, so it goes too.

(cherry picked from commit 2909e11, part of #171)
Signed-off-by: u33549 <[email protected]>

* Drop guards Fields2Cover 2.1.1 no longer needs

shortestPath returns an empty path for a non-node endpoint instead of
throwing, and createShortestGraph leaves out swath ends outside every
cell (Fields2Cover#239). Use F2CPoint::getAngleDiffAbs for the heading
cost.

Adapted for jazzy: the bridge guard here was the earlier pair_cells.size() > 0 check (the two-cell check came with #145). The per-pair try/catch in routeThroughCell is #145 code and is not on jazzy.

(cherry picked from commit 4fd8f6b, part of #171)
Signed-off-by: u33549 <[email protected]>

---------

Signed-off-by: u33549 <[email protected]>
@u33549
u33549 deleted the use-rest-of-f2c-211 branch November 30, 2026 10:20
SteveMacenski pushed a commit that referenced this pull request Dec 1, 2026
* Let Fields2Cover plan the swath connections

Fields2Cover 2.1.1 follows a connection track and rounds its corners
(Fields2Cover#234). The local appendConnection drove a detour verbatim,
turning 90 degrees at every corner. Use F2C's route planPath instead.

(cherry picked from commit 5b95534, part of #171)
Signed-off-by: u33549 <[email protected]>

* Reverse cell routes with Fields2Cover's Route::reverse

(cherry picked from commit 2909e11, part of #171)
Signed-off-by: u33549 <[email protected]>

* Drop guards Fields2Cover 2.1.1 no longer needs

shortestPath returns an empty path for a non-node endpoint instead of
throwing, and createShortestGraph leaves out swath ends outside every
cell (Fields2Cover#239). Use F2CPoint::getAngleDiffAbs for the heading
cost.

(cherry picked from commit 4fd8f6b, part of #171)
Signed-off-by: u33549 <[email protected]>

---------

Signed-off-by: u33549 <[email protected]>
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