Skip to content

Snake: a pass is worked by the map, not by a section on it - #234

Merged
renatorgr merged 3 commits into
pulverizadorfrom
fix/worked-by-painted-area
Nov 14, 2026
Merged

renatorgr merged 3 commits into
pulverizadorfrom
fix/worked-by-painted-area

Conversation

@renatorgr

@renatorgr renatorgr commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Merge order: this branch includes #233 (merged in, its README and CLAUDE.md lines sit next to these). Merge #233 first, then this one; merging only this one brings #233 too.

What

The snake order (skip mode "Ignore worked tracks") asked Track.WorkedPaths before the job's map. That mark is set when any section is on anywhere along the pass, so a pass cut by a bay counted as worked once its short piece was done, and its main piece was never turned onto. This is the case Chris described on official AgOpenGPS-Official#815 (job harness, rig W1, Baetas, ignore worked tracks, 1 row): "End of field reached" on −6 with 53 % of the cultivated area undone.

With the job's map, the map now decides:

  1. Worked on the whole = at least half of the pass inside the cultivated area covered (IsPassWorked). The mark is used only with no map.
  2. At the end ahead, a pass still to do on the whole counts as worked there when the piece a turn there lands on (from that end back until the pass leaves the cultivated area) is at least half covered (IsPieceDoneAtThisEnd, new). A turn onto it there would drive the short piece again and stop at the bay; the main piece gets its turn from the other end.
  3. A pass with no bay is one piece, so a pass done only at this end is still turned onto here (it drives on over the rest), as before.

The existing rule for a pass worked on the whole but left short of this end (IsPassOpenAtThisEnd, Tapada 27R) is unchanged. TurnMissesOpenEnd reads the map's answer instead of the mark.

Crossing a headland band to the next piece of a pass is still not done (as Chris says): at the short pieces' end the field reads as complete there, and the operator drives to the other end.

Tests

SnakeOpenEndTests:

  • A_pass_cut_by_a_bay_with_only_its_short_piece_done_gets_the_turn_at_the_other_end (every pass marked worked, only pass 4's short piece painted: the turn at the north end goes onto 4; before, "Field complete")
  • A_pass_cut_by_a_bay_is_not_turned_onto_where_its_piece_is_done (south end: no turn onto 4's painted short piece)
  • A_pass_with_no_bay_done_only_at_this_end_still_gets_the_turn_here
  • With_no_map_the_mark_says_which_passes_are_worked

All YouTurn tests pass locally.

Fork only.


Generated by Claude Code

At the end of a pass with no U-turn and a hard fence, AutoSteer goes off a
metre into the headland (EndOfPassWithoutTurn). The check asks whether the
tractor is on the line, heading along it, and walks the pass ahead to the
fence. Both were measured against the straight pass. A pass bent round Go
around obstacles leaves the crop up to 45 degrees off the pass, so the
tractor looked like one turning by hand, and the check (made once per
headland entry) said no. Walking the straight pass from abreast of the
tractor also found crop the bend had already left.

On a tester's field (simulator, 8 m front boom) 3R, bent round two trees in
the headland, left the crop 36 degrees off the pass; AutoSteer steered on
along the bend for 40 m until the fence guard stopped it with the boom over
the fence.

The pipeline now hands the check the bend it steers (GoAroundPasses.Current):
"on the line" is the bend's heading at the tractor, and
PassLeavesFieldAhead walks the bend from its point nearest the tractor.
Without a bend nothing changes. On that field the check now says yes 1 m
past the crop (was no).

Tests: EndOfPassWithoutTurnTests (a tree in a wide headland: the bend leaves
the crop 35 degrees off and AutoSteer goes off a metre past the line; a bend
through a headland strip with crop past it is not the end).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VKEBDFmQpFVsahedjtN2AZ
Track.WorkedPaths is set when any section is on anywhere along the pass, and
the snake asked it before the job's map. A pass cut by a bay counted as worked
once its short piece was done, so its main piece was never turned onto
(official AgOpenGPS-Official#815, the job harness on Baetas: "End of field reached" with 53 %
of the field undone).

With the map, worked means at least half covered (IsPassWorked); the mark is
used only with no map. At the end ahead, a pass still to do on the whole is
worked there when the piece a turn there lands on (from that end back until
the pass leaves the cultivated area) is at least half covered
(IsPieceDoneAtThisEnd): the main piece gets its turn from the other end. A
pass with no bay is one piece, so one done only at this end is still turned
onto here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VKEBDFmQpFVsahedjtN2AZ
@renatorgr
renatorgr marked this pull request as ready for review November 14, 2026 15:56
@renatorgr
renatorgr merged commit 4da09f0 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