Skip to content

Add skip_completed_segments utility to skip DriveSegments behind the robot#36

Merged
pascalzauberzeug merged 4 commits intomainfrom
AG-137-mittendrin-bei-recorded-tracks-anfangen-konnen
May 1, 2026
Merged

Add skip_completed_segments utility to skip DriveSegments behind the robot#36
pascalzauberzeug merged 4 commits intomainfrom
AG-137-mittendrin-bei-recorded-tracks-anfangen-konnen

Conversation

@pascalzauberzeug
Copy link
Copy Markdown
Contributor

@pascalzauberzeug pascalzauberzeug commented Apr 26, 2026

Motivation

When a path is handed to navigation but the robot is already past some of its segments, those segments need to be dropped before driving — otherwise the robot turns around and re-drives completed work.

Implementation

Walk path_segments and return the tail starting at the first segment the robot is on (cross-track within max_distance, heading offset to the segment end within max_angle) and not yet completed (t ≤ completed_threshold); return [] if none qualify.

Progress

  • I chose a meaningful title that completes the sentence: "If applied, this PR will..."
  • I chose meaningful labels (if GitHub allows me to so).
  • I documented breaking changes and set the 'breaking change' label if needed
  • The implementation is complete.
  • Tests with a real hardware have been successful (or are not necessary).
  • Pytests have been added (or are not necessary).
  • Documentation has been added (or is not necessary).

The previous implementation crashed with TypeError on every non-empty
input (sort key annotated as int but list.sort passes the element),
computed an angle-match list and never used it, mutated the caller's
list via in-place sort, and had a type-confused fallback that always
returned an empty list. Replace it with a straight loop that applies
the three intended filters (completion threshold, heading offset to
segment end, cross-track distance) in path order and returns the tail
from the first match, or [] if none qualify. Add debug logging per
rejected segment plus a warning when no segment matches, export the
function from the navigation package, and cover position and heading
cases with a parametrized test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pascalzauberzeug pascalzauberzeug added this to the 0.2.0 milestone Apr 26, 2026
@pascalzauberzeug pascalzauberzeug added the enhancement New feature or request label Apr 26, 2026
@pascalzauberzeug pascalzauberzeug changed the title Rewrite filter_path_from_start_pose Add filter_path_from_start_pose utility to skip DriveSegments behind the robot Apr 26, 2026
@pascalzauberzeug pascalzauberzeug changed the title Add filter_path_from_start_pose utility to skip DriveSegments behind the robot Add skip_completed_segments utility to skip DriveSegments behind the robot Apr 26, 2026
@pascalzauberzeug pascalzauberzeug marked this pull request as ready for review April 26, 2026 03:22
@pascalzauberzeug pascalzauberzeug requested a review from jsb-zz April 26, 2026 03:22
jsb-zz

This comment was marked as outdated.

@jsb-zz jsb-zz force-pushed the AG-137-mittendrin-bei-recorded-tracks-anfangen-konnen branch from 5b557c7 to d8a5f12 Compare April 30, 2026 18:31
@jsb-zz jsb-zz self-requested a review April 30, 2026 18:33
@pascalzauberzeug pascalzauberzeug merged commit ff22695 into main May 1, 2026
12 checks passed
@pascalzauberzeug pascalzauberzeug deleted the AG-137-mittendrin-bei-recorded-tracks-anfangen-konnen branch May 1, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants