Skip to content

Snake, manual U-turn, line entry: same to-do pass test - #235

Merged
renatorgr merged 1 commit into
pulverizadorfrom
fix/snake-one-worked-test
Nov 14, 2026
Merged

renatorgr merged 1 commit into
pulverizadorfrom
fix/snake-one-worked-test

Conversation

@renatorgr

@renatorgr renatorgr commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Requested by Renato · project thread

What changed

A review of the fork's line-entry, U-turn and snake fixes (#189 to #234) found three places that answer "is this pass still to do?" differently. This PR makes them agree.

  1. Headland band passes hid real passes (snake order). Since Sync pulverizador with official develop 243609b1 (#813-#820) #214 (official U-turns at the turn line, not the headland, as AgOpenGPS (+ harness) AgOpenGPS-Official/AgOpenWeb#816) HeadlandLine is the turn line (fence minus the U-turn distance, 2 m). The snake order and its whole-pass test read that line, so a pass lying only in the band between the turn line and the operator's headland line (12 m) was in the order. With sections off in the headland it is never painted, so it stayed "to do" for ever, and when it came next in the order the passes behind it were not reached: "End of field reached" with crop left. Snake: skip passes with no crop at this end when the headland is on #229 only stopped the turn from landing on such a pass.
    Now, with the headland on and IsHeadlandSectionControl on, the order, its stamp, the stale-path check, SnakeLandable and WorkedPasses all use the crop (WorkHeadlandLine) through one helper, SnakeArea. A pass with no crop is not in the order; the headland laps cover it. Headland off, or sections on in the headland: unchanged (turn line).
  2. Manual U-turn used the old mark. With "Ignore worked tracks", a manual U-turn (ComputeNextTrack) and the end of a turn with no snake plan (GetNextUnworkedPathSkip) still asked Track.WorkedPaths, the mark Snake: a pass is worked by the map, not by a section on it #234 dropped for auto turns. A pass with 10 m painted was skipped. Both now take the same painted-map test as the auto turn (WorkedPasses); with no map the mark is still used.
  3. Joining the nearest open pass (AutoSteer engaged in the headland joins the nearest clean pass #226) only checked the whole pass. It now uses YouTurnStateMachine.IsPassToJoin: not worked on the whole (same area as the snake), and, where a bay cuts the pass, its piece from the end the entry path reaches is not done (IsPieceDoneAtThisEnd, Snake: a pass is worked by the map, not by a section on it #234). A pass worked on the whole is still not joined even when its end is open, so AutoSteer only joins clean passes.

No change to the snake order rules themselves (#223/#228 far pass, #232 open end, #201 open end on a worked pass). CLAUDE.md and README.md updated.

Fork only, nothing for official.

Related issue

Relates to #214, #226, #229, #234.

Pre-submit checklist

  • dotnet build succeeds with no errors
  • dotnet test passes: all YouTurn, snake and NearestOpenPassEntry tests pass locally; the full Services run shows only CoverageTileTests.An_old_display_folder_that_cannot_be_removed_does_not_fail_the_save, which fails only when the tests run as root (cloud container), not on CI.
  • Tested on: simulator, headland on with sections off in the headland, "Ignore worked tracks" (Renato)

New tests (each fails on pulverizador before this fix):

  • SnakeOpenEndTests.A_pass_in_the_headland_band_does_not_hide_a_pass_still_to_do (band painted and not painted: the turn goes to pass -5, the band passes are not in the order)
  • SnakeOpenEndTests.With_only_the_headland_band_left_the_field_is_complete
  • SnakeOpenEndTests.A_manual_u_turn_steps_over_the_passes_the_map_says_are_worked (lands on pass 2, before on 3)
  • NearestOpenPassEntryTests.A_pass_whose_piece_on_this_side_of_a_bay_is_done_is_passed_over

Changed: SnakeOpenPassTests.A_pass_lying_in_the_headland_band_is_not_turned_onto_with_the_headland_on now checks the band pass is not in the order at all.

Job harness, W1 and W2 (snake order), base vs this PR

Run in a cloud container, AGOPENWEB_SCENARIO_ONLY=W1,W2, RigJobScenarioTests, pulverizador 4da09f0 against this branch, then compared with Tools/compare-reports.py: 0 findings new, 0 gone, 1 in both (TURN-ONTO-WORKED-PASS on W1, unchanged).

Job Base This PR
W1 Baetas 15 turns, "End of field reached" on pass 4, 55.5 % sprayed the same
W2 Olival, hard boundary 15 turns, 95.3 % sprayed, ends on pass 7 14 turns, 94.8 % sprayed, ends on pass 2

W2, with the YouTurn debug log: on the base the order ran from -8 to 11, passes -8, -7, 10 and 11 lying only in the headland band. From pass -1 the order's next pass was band pass -7, so the turn fell back to the nearest pass, 1. With this PR the order is -6..9 and goes on to 2, as the snake plans. At the end, on the base, pass 8 (its crop already done, its band strip unpainted) still counted as to do: the turn went 2 -> 8 along the headland (84 s), drove 8's band strip and turned onto 7, whose crop is only at that end. With this PR pass 8 counts as done, pass 7 has no crop at the tractor's end, and AgOpenWeb says "End of field reached - no room on the next pass at this end" with pass 7's corner piece (about 120 m²) left for the operator. That is the rule kept since #234: a turn does not cross to the other end to reach a pass's piece there.

W1's 44.5 % left is the Baetas bay (official AgOpenGPS-Official#815) and is the same with and without this PR.

Screenshots

None, no UI change.

https://claude.ai/code/session_01VKEBDE58NYzgHvbtTAtxnz


Generated by Claude Code

Three places that decide "is this pass still to do" disagreed after the
turn line (#214) and the painted-map rules (#201, #232, #234):

- Snake order and its worked test read the turn line, so passes lying
  only in the headland band (turn line .. headland line) were in the
  order and, with sections off in the headland, never painted. They
  stayed "to do" and hid real passes: "End of field reached" with crop
  left. With the headland on and sections off in it, the order and the
  worked test now use the crop (WorkHeadlandLine).
- A manual U-turn with "Ignore worked tracks" still used the old
  Track.WorkedPaths mark through ComputeNextTrack and
  GetNextUnworkedPathSkip. It now uses the same painted-map test as the
  auto turn.
- Joining the nearest open pass when AutoSteer is engaged (#226) only
  checked the whole pass. It now also skips a pass whose piece on this
  side of a bay is done (IsPassToJoin).

Tests: band pass hidden / painted, only band left = field complete,
manual U-turn over map-worked passes, bay piece done on line entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VKEBDE58NYzgHvbtTAtxnz
@renatorgr renatorgr self-assigned this Nov 14, 2026
@renatorgr
renatorgr marked this pull request as ready for review November 14, 2026 18:57
@renatorgr
renatorgr merged commit 581a232 into pulverizador Nov 14, 2026
7 checks passed
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.

2 participants