Add skip_completed_segments utility to skip DriveSegments behind the robot#36
Merged
pascalzauberzeug merged 4 commits intomainfrom May 1, 2026
Conversation
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>
5b557c7 to
d8a5f12
Compare
jsb-zz
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_segmentsand return the tail starting at the first segment the robot is on (cross-track withinmax_distance, heading offset to the segment end withinmax_angle) and not yet completed (t ≤ completed_threshold); return[]if none qualify.Progress