Repository navigation
Add optional headland driving (perimeter loop or full band coverage) - #141
Conversation
|
How many more PRs do you have lined up? |
|
I think this is the final feature integration. After that, one for overlap fix and maybe one for readme and tutorial. Also for other distoros. I wondered why you asked? |
SteveMacenski
left a comment
There was a problem hiding this comment.
You have added alot in these PRs; I think some documentation explaining these new options and example uses of the feature to visualize the outcomes would be necessary (as well as a simple "here's how you do the basic from v1" workflow)
|
Don't worry, I will. I just want to finish the features and optimizations. I worked really these improvements and I'm sure there may be bugs in it that I missed. I will also deal with future issues related to these parts in the future. |
|
I believe that the documentation process will help me identify some issues. |
|
I'll check to see if there's anything else on my checklist that needs to be done. If you want, I can start documenting instead of solving the overlap problem later. |
|
Remaining work I have planned:
|
* Fix `ros2 param list` due to issue with default_custom_order (#151) Before this patch, `ros2 param dump` and `rqt_reconfigure` would not work: ``` ros2 run opennav_coverage opennav_coverage ros2 lifecycle set /coverage_server configure ros2 lifecycle set /coverage_server activate ros2 param dump /coverage_server /coverage_server: ros__parameters: {} ``` After this patch, `ros2 param dump` works as expected: ``` ros2 param dump /coverage_server /coverage_server: ros__parameters: /bond_disable_heartbeat_timeout: true action_server_result_timeout: 10.0 ... ``` Signed-off-by: Ramon Wijnands <[email protected]> Co-authored-by: Copilot <[email protected]> * Add optional headland driving (perimeter loop or full band coverage) (#141) * Add generateHeadlandSwaths to sweep the headland band with concentric rings * Add toHeadlandPerimeterPath helper and densify HL_SWATH path states * Visualize the headland pass as a distinct marker, clearing it when unused * Add optional headland driving via goal fields and splice it onto the path (cherry picked from commit 67f2c0f) * Support non-TSP route modes with field decomposition (#145) * Allow non-TSP route modes with field decomposition BOUSTROPHEDON, SNAKE, and SPIRAL were rejected whenever field decomposition produced multiple cells, because flattening per-cell swaths before ordering collided their per-cell ids and interleaved cells. They now order each cell independently and stitch the results with the same nearest-neighbour, border-graph-bridging layer TSP already used (extracted into stitchCellRoutes). CUSTOM stays rejected for multi-cell: its order vector can't be split across cells. Known issue: manual testing shows this can still produce swath overlap in some multi-cell fields, likely on the F2C side. Parking this branch as-is rather than chasing it now. * Join swaths through the cell border graph in swath-order routes Multi-cell BOUSTROPHEDON, SNAKE, and SPIRAL wrapped each cell's swaths in a single connection-less group, so every transition inside a cell became a naked Dubins turn with no knowledge of the boundary. A SNAKE or SPIRAL skip spans several swath widths, and that turn cut straight across ground the route had already covered. Each cell now routes through F2C's shortest-path graph over the cell border, the machinery TSP's per-cell genRoute already used, so a cell route carries a connection between every consecutive swath pair. A pair whose endpoint is not a graph node falls back on its own. * Judge connection detours by deviation instead of length ratio A connection was replaced by a single turn when its polyline ran under 1.3x the straight distance. That ratio cannot separate a u-turn from a detour: rounding a long cell's corner is only ~20% longer than cutting its diagonal, so real border-following connections were collapsing into straight lines through the field. One measured 36.3 m of polyline against 30.7 m direct, a ratio of 1.18, and became a 30 m diagonal. Compare the waypoints' peak deviation from the straight hop instead. Headland u-turn waypoints are collinear with it, so they still get a curve, while anything the graph routed around keeps its polyline. * Use the paired-cell bridge graph only when both cells resolve getCellWherePoint can miss an endpoint that sits on a cell border, leaving one cell in the pair. The graph was still built from that single cell, and it reached the far endpoint by jumping off that cell's border, cutting across whatever lay between. Because the result had two or more points it counted as a success, so the whole-set fallback never ran. Require both cells before trusting the pair graph; otherwise go straight to the graph over every travel cell, which is connected along their shared borders and routes around the gap. (cherry picked from commit 29c96cf) * Add a useful error if the headland is too large (#150) Signed-off-by: Ramon Wijnands <[email protected]> (cherry picked from commit 04858cf) * Make visualizers transient_local (#155) Signed-off-by: Alireza Moayyedi <[email protected]> (cherry picked from commit aa04819) * Fix dependencies missing from package.xml (#153) (cherry picked from commit 2fb8254) --------- Signed-off-by: Ramon Wijnands <[email protected]> Signed-off-by: Alireza Moayyedi <[email protected]> Co-authored-by: Ramon Wijnands <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Umut Can Cebbur <[email protected]> Co-authored-by: Alireza Moayyedi <[email protected]>
* 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 humble: humble-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 humble: 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 humble. (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 humble: 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 humble. (cherry picked from commit e7eb93b, part of #162) Signed-off-by: u33549 <[email protected]> --------- Signed-off-by: u33549 <[email protected]>
* 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]>



Summary
Adds an optional "drive the headland" mode: normally the headland is just a
margin the swaths leave alone, but some operations need to cover that ring area
too. When enabled, a headland pass is generated and spliced onto the coverage
path. Off by default — no behavior change unless the new goal fields are set.
New goal fields (
ComputeCoveragePath)generate_headland_swathsFalseheadland_firstFalseTrue) or after (False) the inner coverageheadland_full_coverageFalseFalse= one perimeter pass;True= concentric passes sweeping the whole bandNeeds
generate_routeandgenerate_path(the pass is spliced onto the plannedpath); otherwise it is skipped with a warning.
How it works
headland_full_coverage = False): one loop along theheadland's inner boundary (
toHeadlandPerimeterPathoverfield_no_headland).headland_full_coverage = True):generateHeadlandSwathsproduces concentric rings spaced by the operation width
(
count = round(headland_width / operation_width), min 1), each emitted as aperimeter pass from outer to inner.
connecting jump, and is emitted as
HL_SWATHpath states.discretizeSwathLikenow densifies
HL_SWATHtoo (F2C'sdiscretizeSwathonly splitSWATH), sothe headland pass is a dense, followable path with per-pose velocity/direction.
headland_first.Visualization
The headland pass is published as a dedicated
coverage_server/headland_swathsmarker (distinct color) so it isn't confused with the identically-shaped
planning-field boundary.