Skip to content

Fix quintic trajectory samples extending beyond terminal time - #1481

Open
huxiaoyi-ovo wants to merge 3 commits into
AtsushiSakai:masterfrom
huxiaoyi-ovo:fix/quintic-terminal-sampling
Open

huxiaoyi-ovo wants to merge 3 commits into
AtsushiSakai:masterfrom
huxiaoyi-ovo:fix/quintic-terminal-sampling

Conversation

@huxiaoyi-ovo

Copy link
Copy Markdown

Summary

The quintic planner samples with np.arange(0.0, T + dt, dt). When dt does not divide T, the final sample is past the polynomial's terminal time, so the returned trajectory can overshoot its specified final position even though the polynomial itself satisfies the endpoint conditions.

For example, with T=5 and dt=0.7, the last sample is t=5.6. A zero-velocity, zero-acceleration quintic from x=0 to x=10 evaluates to about x=10.2054 at that time instead of the intended x=10.

This patch samples only times below T and then includes T exactly once. It keeps the existing sampling interval, avoids extrapolation, and does not change polynomial coefficients or trajectory search logic.

Regression tests

Parameterized tests cover:

  • dt=0.5: divides the candidate duration exactly.
  • dt=0.7: previously sampled beyond the endpoint.
  • dt=6.0: longer than the candidate duration.

Each checks strictly increasing timestamps, no samples after T, consistent output lengths, and the requested terminal position.

Scope: two files, no new dependencies. Full cross-platform checks were started on fork CI PR #4; they are not claimed as passed yet.

AI assistance: ChatGPT (OpenAI GPT-6) helped identify the edge case, prepare the fix, and add regression tests.

@huxiaoyi-ovo
huxiaoyi-ovo marked this pull request as ready for review October 29, 2026 06:16

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