Skip to content

fix(rne): don't crash when a joint's kinematic parent is a base-mounted static link - #696

Merged
petercorke merged 1 commit into
mainfrom
fix/rne-base-mounted-static-link-parent-lookup
Sep 19, 2026
Merged

petercorke merged 1 commit into
mainfrom
fix/rne-base-mounted-static-link-parent-lookup

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Problem

Follow-up to #693. While cleaning up the dev conda environment (unrelated
to this fix) and smoke-testing `rne()` against a real model rather than
just synthetic test topologies, hit an `IndexError` on the default
`Panda()`:

```
IndexError: list index out of range
group_idx = [
i for i, group in enumerate(link_groups) if parent_idx in group
][0]
```

Root cause: `panda_link0` is a static base link with no joint ancestor at
all (`isjoint=False`, `parent=None`) -- #693's grouping correctly drops
it from `link_groups` entirely, since it contributes no joint torque
(rigidly fixed to the immovable base). But the first joint's own
`.parent` is that static link, and resolving its upstream kinematic
group via a raw list-membership search over `link_groups` breaks once
that link is (correctly) a member of no group.

Fix

Reuse `group_of_link_idx` (already built once by #693's grouping pass)
to resolve a joint's nearest joint ancestor directly. "No entry" (no
joint ancestor upstream at all) is now treated the same as `.parent`
being `None` outright, rather than crashing.

Verification

  • Red/green: reverted just the `Robot.py` fix (keeping the new test) and
    confirmed it fails with the exact same `IndexError`; restored the fix
    and confirmed it passes.
  • New regression test (`test_invdyn_base_mounted_static_link`) isolating
    this exact topology.
  • Full suite: 745 passed, 0 failed, 82 skipped
  • Smoke-tested against the real `Panda()` and `Frankie()` models (both
    previously crashed on this path, both now compute correctly)

🤖 Generated with Claude Code

…ed static link

Follow-up to #693: a static link with no joint ancestor at all (rigidly
mounted directly on the immovable base, e.g. URDF Panda's panda_link0)
is correctly dropped from link_groups -- it contributes no joint torque.
But the joint immediately downstream of it still needs to resolve its
own *kinematic* parent group for velocity/acceleration propagation, and
doing that via a raw list-membership search over link_groups broke once
that static link stopped being a member of any group: IndexError on any
robot with the same shape as the default Panda(), caught while smoke-
testing the previous fix against real models rather than just synthetic
test topologies.

Reuses group_of_link_idx (already built once for #693's grouping) to
resolve a joint's nearest joint ancestor directly, treating "no entry"
(no joint ancestor upstream) the same as .parent being None outright,
rather than crashing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@petercorke
petercorke merged commit dba179e into main Sep 19, 2026
21 checks passed
@petercorke
petercorke deleted the fix/rne-base-mounted-static-link-parent-lookup branch September 19, 2026 12:57
@github-actions github-actions Bot mentioned this pull request Sep 19, 2026
@codecov

codecov Bot commented Sep 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (7aa2d31) to head (09c5b15).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/roboticstoolbox/robot/Robot.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #696   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        143     143           
  Lines      14091   14089    -2     
=====================================
+ Misses     14091   14089    -2     

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

1 participant