Fix cubic spline evaluation at the final knot - #1433
Open
YaoxinHuang wants to merge 2 commits into
Open
YaoxinHuang wants to merge 2 commits into
YaoxinHuang wants to merge 2 commits into
Conversation
This branch has not been deployed
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.
Reference issue
No existing issue found for this endpoint failure.
What does this implement/fix?
Evaluating a cubic spline at its final input knot currently raises
IndexError:bisectselects indexnx - 1, but the polynomial coefficients only containnx - 1segments. This affects 1D position and derivatives, as well as 2D endpoint position, heading and curvature.Clamp the selected index to the final segment so the endpoint is evaluated using that polynomial. Add regressions for two-point and curved natural splines against SciPy, plus a 2D endpoint check.
Additional information
Prepared with OpenAI Codex. Local validation on Windows / Python 3.13.13: the 9 new regressions fail on the original code and pass with this fix; 3 path-tracking tests and 5 Frenet scenarios pass. Ruff and the CubicSpline mypy check pass. The complete suite was not run because the pinned
ecos==2.0.14dependency needs an unavailable C++ compiler on this environment.CheckList