Skip to content

fix(blocks): JTraj ends at rest, and accepts qd0 and qdf - #890

Merged
petercorke merged 1 commit into
mainfrom
fix/jtraj-block-getvector
Oct 22, 2026
Merged

petercorke merged 1 commit into
mainfrom
fix/jtraj-block-getvector

Conversation

@petercorke

Copy link
Copy Markdown
Owner

What

Fixes three bugs in the JTraj block (blocks/arm.py), found while looking at what Codacy reports.

  1. The final velocity was set to qf, the final position, whatever qdf was. With the defaults the block ended moving at the speed qf instead of at rest, and followed a different trajectory from rtb.jtraj. This changes the numerical output of the block in the default case.
  2. Giving qd0 or qdf raised NameError: getvector was not imported there, and a # type: ignore[name-defined] hid it. It is smb.getvector.
  3. The check on the size of qdf was on a variable called qd1, and its message said qd1.

Why it was not noticed

test_jtraj in tests/test_blocks.py is marked @unittest.skip, and CI runs pytest tests/ --ignore=tests/test_blocks.py. The new tests are in their own file, need only bdsim (they are skipped without it), and run in CI. They compare the block with rtb.jtraj at several times, check that it comes to rest at the goal, that qd0 and qdf are used (as lists too), and that a wrong size is a ValueError. Nine of the ten fail on the old code.

Checked

mypy clean (165 files), the 10 new tests pass. Not run: the full suite, which this change does not touch beyond arm.py.

🤖 Generated with Claude Code

- the final velocity was set to qf, the final position, whatever qdf was, so
  with the defaults the block ended moving at the speed qf instead of at rest
  and followed a different trajectory from rtb.jtraj
- giving qd0 or qdf raised NameError, since getvector is not imported; it is
  smb.getvector
- the check on the size of qdf was on a variable called qd1, and its message
  said qd1

The test of the block in test_blocks.py is skipped, and that file is not run
in CI.  The new tests compare the block with jtraj and need only bdsim.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@petercorke
petercorke enabled auto-merge (squash) October 22, 2026 23:41
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 8 complexity · 0 duplication

Metric Results
Complexity 8
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@petercorke
petercorke merged commit 44ebffe into main Oct 22, 2026
41 of 43 checks passed
@petercorke
petercorke deleted the fix/jtraj-block-getvector branch October 22, 2026 23:57
@github-actions github-actions Bot mentioned this pull request Oct 22, 2026
@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (f8e246b) to head (353819b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/roboticstoolbox/blocks/arm.py 0.00% 5 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #890   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        146     146           
  Lines      17295   17295           
=====================================
  Misses     17295   17295           

☔ 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 added a commit that referenced this pull request Oct 23, 2026
Starting rtbtool imports RTB and IPython, which took over 15 s on the Windows
runner and failed test_options_envvar and test_run_script in CI twice in one
day (on #888 and #890).  CI stops a test at 50 s.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
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