Skip to content

fix(ets): reject boolean joint indices in fixjoint - #836

Merged
petercorke merged 3 commits into
petercorke:mainfrom
daoshi1593:fix/fixjoint-bool-index
Oct 21, 2026
Merged

petercorke merged 3 commits into
petercorke:mainfrom
daoshi1593:fix/fixjoint-bool-index

Conversation

@daoshi1593

Copy link
Copy Markdown
Contributor

ETS.fixjoint and ETS2.fixjoint currently accept False and True as joint positions 0 and 1 because Python's bool subclasses int. Reject these values with the existing ValueError before selecting a joint. Python and NumPy integer positions retain their existing behavior and numerical results.

Addresses only the boolean-index validation item in #825; the other follow-ups remain open.

The change adds an explicit boolean guard and a short explanatory comment to both implementations. Regression tests use two joints so both positions would otherwise be valid, cover Python/NumPy booleans and integers, and check that the source sequence remains unchanged. Before the fix, the new tests fail for both built-in boolean values in each implementation.

Validation on WSL Ubuntu, Python 3.12.3, CPU only (MPLBACKEND=Agg):

  • pytest tests/ --ignore=tests/test_blocks.py --timeout=50 --timeout_method=thread -q: 1734 passed, 13 skipped, 122 subtests passed (19 warnings).
  • pytest tests/test_ETS.py tests/test_ETS2.py -q: 93 passed, 31 subtests passed.
  • mypy: no issues in 163 source files.
  • git diff --check: passed. Ruff findings and requested formatting changes in the four touched files are unchanged from the base commit; no unrelated cleanup is included.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 4 complexity · 0 duplication

Metric Results
Complexity 4
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

Copy link
Copy Markdown
Owner

Thank you for this fix. Rejecting booleans as joint indices is correct, since True and False would otherwise be quietly treated as 1 and 0, and the change is small and clear. I'll update the branch with main and merge it once CI is green.

@petercorke
petercorke merged commit 4512e47 into petercorke:main Oct 21, 2026
23 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 21, 2026
@codecov

codecov Bot commented Oct 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (934ca7d) to head (71ed645).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/roboticstoolbox/ets/ETS.py 0.00% 1 Missing ⚠️
src/roboticstoolbox/ets/ETS2.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #836   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        146     146           
  Lines      17100   17100           
=====================================
  Misses     17100   17100           

☔ 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.

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