Skip to content

Fix cubic spline evaluation at the final knot - #1433

Open
YaoxinHuang wants to merge 2 commits into
AtsushiSakai:masterfrom
YaoxinHuang:fix/cubic-spline-final-knot
Open

YaoxinHuang wants to merge 2 commits into
AtsushiSakai:masterfrom
YaoxinHuang:fix/cubic-spline-final-knot

Conversation

@YaoxinHuang

Copy link
Copy Markdown

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: bisect selects index nx - 1, but the polynomial coefficients only contain nx - 1 segments. 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.14 dependency needs an unavailable C++ compiler on this environment.

CheckList

  • Did you add an unittest for your new example or defect fix?
  • Did you add documents for your new example? (Not applicable: existing algorithm defect fix.)
  • All CIs are green? (To be checked after submission.)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant