Skip to content

fix(trajectory): honour non-zero time origins in scalar profiles - #698

Merged
petercorke merged 2 commits into
petercorke:mainfrom
YaoxinHuang:fix/scalar-trajectory-time-origin
Sep 27, 2026
Merged

petercorke merged 2 commits into
petercorke:mainfrom
YaoxinHuang:fix/scalar-trajectory-time-origin

Conversation

@YaoxinHuang

Copy link
Copy Markdown
Contributor

Summary

quintic and trapezoidal document scaling by the first and last times, but treat the last timestamp as the duration. For quintic(0, 1, np.linspace(5, 7, 5)), the first position is about 0.855 instead of 0; valid trapezoidal velocities can also be rejected.

Use elapsed time for scalar profiles while retaining the supplied timestamps. Apply the same time origin to trapezoidal plot phases and show the supplied time range on each subplot. Keep ctraj sampling its existing zero-origin profile directly so unordered samples retain their behaviour. Add regressions for positive/negative origins, endpoint velocities, multi-axis trajectories, plot ranges and phase samples.

Validation on Windows/Python 3.12:

  • Required CPU suite: 762 passed, 70 skipped, 17 subtests passed, using UTF-8 mode and a writable pytest temporary directory.
  • Ruff formatting and git diff --check pass. Ruff lint has the same 14 existing diagnostics as the base revision.
  • Native extensions came from the matching 1.4.4 Windows wheel and were not rebuilt locally; optional collision/Swift tests remain skipped.

Prepared with Codex; the validation above was run locally.

Related issue

None.

Checklist

  • PR title follows Conventional Commits (type: description)
  • Tests pass locally (pytest)
  • Added/updated tests for this change, if applicable
  • New/changed code is type-hinted with modern syntax
  • Docstrings updated (reST style)
  • PR is as small/focused as practical
  • No test files, data files, or notebooks specific to your own project

@petercorke

Copy link
Copy Markdown
Owner

Thanks for finding this. I think the same issue will exist for jtraj().

petercorke added a commit that referenced this pull request Sep 27, 2026
Mesh.to_dict()["filename"] now normalizes to forward slashes (SG's
jhavl/swift#152 fix for Swift's JS mesh loader on Windows paths), which
broke test_mesh_filename's native-separator comparison on every Windows
CI job (confirmed on both #698 and #699, unrelated to either PR's own
changes) since SG 1.4.1 released 2026-09-21.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
petercorke added a commit that referenced this pull request Sep 27, 2026
….1 (#702)

Mesh.to_dict()["filename"] now normalizes to forward slashes (SG's
jhavl/swift#152 fix for Swift's JS mesh loader on Windows paths), which
broke test_mesh_filename's native-separator comparison on every Windows
CI job (confirmed on both #698 and #699, unrelated to either PR's own
changes) since SG 1.4.1 released 2026-09-21.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
@petercorke
petercorke force-pushed the fix/scalar-trajectory-time-origin branch from 337d3da to a6e3932 Compare September 27, 2026 14:58
@codecov

codecov Bot commented Sep 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (477b6e3) to head (a6e3932).

Files with missing lines Patch % Lines
src/roboticstoolbox/tools/trajectory.py 0.00% 20 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #698   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        143     143           
  Lines      14093   14097    +4     
=====================================
- Misses     14093   14097    +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@petercorke
petercorke merged commit 06b8716 into petercorke:main Sep 27, 2026
24 checks passed
@petercorke

Copy link
Copy Markdown
Owner

Thanks supporting the Robotics Toolbox. Your PR is now merged. As per the previous comment, the issue might apply to jtraj as well.

@github-actions github-actions Bot mentioned this pull request Sep 27, 2026
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.

2 participants