Repository navigation
test: check lateral error and arrival in the Pure Pursuit and Stanley tests - #319
Merged
ShisatoYano merged 1 commit intoNov 28, 2026
Conversation
… tests main() in both path tracking simulations now returns the vehicle and the course. The tests assert that the maximum lateral error stays within 1.5 m, that the vehicle stops within 5 m of the end of the course, and that its final speed is zero. Part of ShisatoYano#261.
ShisatoYano
self-requested a review
November 28, 2026 03:39
ShisatoYano
approved these changes
Nov 28, 2026
ShisatoYano
left a comment
Owner
There was a problem hiding this comment.
Thank you, @ADAMAMZAR! This is exactly what #261 asked for, and the PR is easy to review.
What I liked:
main()only returns the vehicle and the course, so the existing test run is reused and no second simulation is needed.- The limits have a physical meaning (half of a 3 m lane) and a margin of about 2x over measured values, as the issue asked. I reproduced your table locally: max lateral error 0.750 m / 0.603 m, distance to the course end 2.303 m / 1.991 m, final speed 0.0 for Pure Pursuit / Stanley.
- You broke the controllers on purpose to show the tests catch it. I also flipped the sign of the yaw rate command (the example in #261): Pure Pursuit then drifts 126.6 m and Stanley 19.3 m from the course and neither stops, so all assertions fail. Scaling it to 0.6x gave 2.18 m for Pure Pursuit, matching your number.
- Comparing the final speed with
== 0.0is safe, sinceStateclamps speeds below the stop threshold to exactly 0.0, so it won't differ between platforms.
About the failing PR description has evidence check: it only asks for images because src/ changed. Your explanation under "Images" is right (the change only adds a return after vis.draw(), so the plots and GIFs are unchanged), so I've added the no images needed label, and the check passes now.
One suggestion for the next PRs in this category, not needed here:
- The lateral error and arrival checks are the same block in both test files. When you add the other five path tracking simulations, consider moving them into a small shared helper (for example
test/path_tracking_checks.py), so the limits and the check live in one place.
Looking forward to the next part of #261!
🤖 Generated with Claude Code
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.
Summary
Part of #261 (path tracking). Part of #174.
The Pure Pursuit and Stanley tests now check the result of the simulation, not only that it runs.
main()in both scripts returns the vehicle and the course, so the existing test run is reused and no extra simulation is needed. Each test asserts that:The limits come from measured values with a margin of about 2x, as the issue asks. The course is fixed and these two simulations have no random input, so the values are the same on every run:
The controllers stop short of the last course point by their look-ahead, so the end check uses a distance rather than the last point.
How I checked it works
python -m pytest teston the currentmain: 175 passed, andgit statusis clean afterwards.Images
None needed, I think: the change under
src/only makesmain()return the vehicle and the course at the end. The simulations and their plots are unchanged.Book
The book includes the controller and course code by
:pyobject:, not these simulation scripts.