Skip to content

Snake: a pass left at its end only if the turn gets there - #232

Merged
renatorgr merged 1 commit into
pulverizadorfrom
fix/snake-open-end-reach
Nov 14, 2026
Merged

renatorgr merged 1 commit into
pulverizadorfrom
fix/snake-open-end-reach

Conversation

@renatorgr

Copy link
Copy Markdown
Owner

Requested by Renato · project thread

What changed

With Ignore worked tracks, a pass worked on the whole but left at the end ahead counts as still to do there (IsPassOpenAtThisEnd, the Tapada 27R rule), so the snake turns onto it. A turn lands abreast of where it leaves the tractor's pass, and that pass's own end can lie beyond it: a slanting headland line, or a turn seated back from a hard fence or a tree. The turn then drives over the worked part only, the end stays as it was, and the whole pass is driven a second time for nothing.

On a tester's field (simulator, beta 2be8132, 14 Nov 10:41) the turn from 1L onto 2R at the north end was seated back 12.5 m (hard fence and a tree), 2R's last ~18 m of crop stayed unpainted, and from 1L the next time the turns onto 3L/4L did not build, so the nearest-open fallback took 2R again: all of 2R driven twice.

Now such a pass is turned onto only when the turn built gets to what is left: at least 5 m of unworked crop along the turn's last 20 m and 20 m on past its end (YouTurnPathingService.TurnReachesUnworkedGround). Otherwise the turn is dropped, the pass counts worked at this end (YouTurnStateMachine.TurnMissesOpenEnd), and the next pass is looked for: on the next cycle for the order's pass, at once for a nearest open pass. On the tester's field no other turn fits at that end, so AutoSteer now stops at the end of 1L (as at any end with no turn, #197) instead of driving 2R again. A pass left to do at an end the turn reaches is turned onto as before.

CLAUDE.md's snake bullet says so. Fork only.

Tests (SnakeOpenEndTests):

  • new: the fence reaches 20 m further at the next pass's side, the pass is covered down to just past where the turn lands and left below: no turn, "Field complete" (without the change the turn is built and lands on the covered part);
  • new: TurnReachesUnworkedGround on a straight exit leg, left past the leg / left on it / no map;
  • the existing open-end tests still turn onto a pass whose end the turn reaches.

Related issue

Follows #228 and #229, from the same day's simulator reports.

Pre-submit checklist

  • dotnet build succeeds with no errors
  • dotnet test passes: the U-turn, snake and pipeline tests (2024 passed, before rebasing on Snake: skip passes with no crop at this end when the headland is on #229), the snake tests again after it (67 passed); the full suite runs in CI
  • Tested on: Linux (cloud), plus a replay of the tester's field (from 1L at the north end, the turn onto 2R is dropped as missing its open end)

Screenshots

Not a UI change.


Generated by Claude Code

A pass worked on the whole but left at the end ahead counts as still to
do there (IsPassOpenAtThisEnd), so the snake turns onto it. The turn lands
abreast of where it leaves the tractor's pass, and that pass's own end can
lie beyond it: a slanting headland, a turn seated back from a hard fence or
a tree. Then the turn drives over the worked part only, the end stays as it
was, and the whole pass is driven a second time for nothing. On a tester's
field (simulator) the turn from 1L onto 2R at the north end, seated back
12.5 m from the fence and a tree, drove all of 2R again.

Such a pass is now turned onto only when the turn built gets to what is
left: at least 5 m of unworked crop along the turn's last 20 m and 20 m on
past it (YouTurnPathingService.TurnReachesUnworkedGround). Otherwise the
turn is dropped and the pass counts worked at this end (TurnMissesOpenEnd),
for the order's pass and for the nearest open pass alike, and the next one
is looked for. On the tester's field no other turn fits at that end, so
AutoSteer stops at the end of 1L (as for any end with no turn) instead of
driving 2R again.

Tests (SnakeOpenEndTests): a pass left to do past where the turn lands on
it is worked at this end; the reach test itself. The existing open-end
tests still turn onto a pass whose end the turn reaches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VKEBDFmQpFVsahedjtN2AZ
@renatorgr renatorgr self-assigned this Nov 14, 2026
@renatorgr renatorgr changed the title Snake: turn onto a pass left at its end only if the turn gets there Snake: a pass left at its end only if the turn gets there Nov 14, 2026
@renatorgr
renatorgr marked this pull request as ready for review November 14, 2026 11:51
@renatorgr
renatorgr merged commit 35fa70a 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