Fix closed-loop path_s corruption and Frenet corner false CTE - #21
Merged
Conversation
Initialize TrajectoryTracker path_s from cumulative arc-length so closed tracks with first==last (Yas Marina race line) stay monotonic. Score both adjacent segments for XY→SD and bracket SD→XY by arc-length so on-path points after corners no longer pick up false CTE. Pure Pursuit clamps lookahead with max(path_s). Co-authored-by: Majid Khonji <majid-khonji@users.noreply.github.com>
After path_s became cumulative arc-length, the old path_s[-2] workaround truncated the final closed-track segment, treated 2-point tracks as ended at s=0, and IndexError'd on 1-point paths. Use TrajectoryTracker.track_end_s (path_s[-1]) instead. Co-authored-by: Majid Khonji <majid-khonji@users.noreply.github.com>
majid-khonji
approved these changes
Jul 31, 2026
majid-khonji
marked this pull request as ready for review
July 31, 2026 17:09
Author
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Keep closed-loop path_s / adjacent-segment Frenet fixes from this PR and PR #18's 1-point convert_sd_to_xy lateral-offset handling; retain both CHANGELOG Fixed entries. Co-authored-by: Majid Khonji <majid-khonji@users.noreply.github.com>
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.
Bug and impact
path_s— Whenfirst==last(bundled Yas Marina race line, closed RaceMap centerlines), KD-tree Frenet re-projection of the reference snapped the final waypoint to index 0, yielding non-monotonicpath_swithpath_s[-1] == 0(lattice already worked around this viapath_s[-2]).find_path_lookaheadclamped withmin(s+Ld, path_s[-1]). Withpath_s[-1]==0, every mid-lap lookahead jumped ~1.2 km to the origin on Yas Marina.d≈segment_lengthinstead ofd≈0, yanking Stanley/PID/PP.Root cause
path_swas computed by re-projecting waypoints throughconvert_xy_path_to_sd_pathinstead of using cumulative arc-length.Fix
path_s/path_dfrom__cumulative_distances.searchsortedon arc-length; 1-point paths handled safely.max(path_s).Validation
42 passed.
Not re-reporting already-tracked PR #18 (1-point Frenet / Control Step) or merged PR #16.