Mission Planning: Fix crosshatch survey path detouring to polygon corner - #2835
Conversation
Automated PR Review (Claude)0. SummaryVerdict: MINOR SUGGESTIONS This PR fixes an inefficient survey-transect connector path in the crosshatch survey generator. Previously, Minor suggestion to address: 1.1. 1. Correctness & Implementation Bugs1.1 (
if (turf.booleanPointOnLine(point, turf.lineString([coords[i], coords[i + 1]]), { epsilon: 1e-6 })) return i2. AGENTS.md Adherence — ✅3. Security — ✅4. Performance — ✅5. UI / UX — ✅6. Code Quality & Style — ✅7. Commit Hygiene — ✅8. Tests — ✅9. Documentation — ✅10. Nitpicks / Optional10.1 ( Generated by Claude. This is advisory; a human reviewer must still approve. |
0117bff to
83ffeec
Compare
|
Done:
|
|
/review |
Automated PR Re-review 2 (Claude)Comparing Previous findings status
Discussion since last review@ArturoManzoli confirmed both findings were addressed: " New findings0. SummaryVerdict: READY TO MERGE Both previous findings have been addressed. The 1. Correctness & Implementation Bugs — ✅2. AGENTS.md Adherence — ✅3. Security — ✅4. Performance — ✅5. UI / UX — ✅6. Code Quality & Style — ✅7. Commit Hygiene — ✅8. Tests — ✅9. Documentation — ✅10. Nitpicks / Optional — ✅Generated by Claude. This is advisory; a human reviewer must still approve. |
|
Ready to go. |
|
@ArturoManzoli how should I test it to confirm the bug is fixed? |
The bug placed extra waypoints on the far left edge of the crosshatch mission, so you can run a SITL vehicle through the mission, or just visually confirm by checking the WP numbers on the mission. |
|
@ArturoManzoli just to confirm is this the expected result? Notice there's a 180 degree turn on waypoint 15.
|
Not at all. This was pretty much the bug itself. I'll check what went wrong |
With no turnaround distance, consecutive transects were joined by walking the polygon ring in fixed vertex order, which always inserted the next corner between lines and sent the vehicle out to a far corner and back before resuming the correct line. moveAlongEdge now returns only the ring vertices between the two boundary points along the shorter direction, and none when they share an edge, so connectors become direct hops that stay inside the survey area. findRingEdgeIndex resolves those boundary points to the metrically closest edge rather than booleanPointOnLine, whose degree-based epsilon still read points as lying on a near-axis-aligned edge tens of meters away and reintroduced the detour. The crosshatch second pass also enters at whichever of its four boustrophedon corners sits nearest the first pass exit, so the inter-pass transit stays short instead of flying to a far endpoint and doubling straight back.
83ffeec to
cfd573e
Compare
Fixed |


Problem:
moveAlongEdgewalking the polygon ring in fixed vertex order, which always inserted the next polygon corner between lines.Fix:
moveAlongEdgenow finds the ring edge each transect endpoint lies on and returns only the vertices between them along the shorter perimeter direction (empty when both share an edge, giving a direct connector).moveAlongEdgemodule-private, since it is only used withinutils-map.ts.Closes #2834