Skip to content

fix(robot): preserve link topology when copying robots - #732

Open
huxiaoyi-ovo wants to merge 2 commits into
petercorke:mainfrom
huxiaoyi-ovo:fix/copy-link-parent-topology
Open

huxiaoyi-ovo wants to merge 2 commits into
petercorke:mainfrom
huxiaoyi-ovo:fix/copy-link-parent-topology

Conversation

@huxiaoyi-ovo

Copy link
Copy Markdown
Contributor

Summary

Fixes #730.

Copied URDF/ETS robots can retain references to links in the original robot, causing copy().rne() to fail. The same problem affects coriolis() because nofriction() replaces the copied robot's links with another set of disconnected copies.

This PR addresses both root causes:

  • Rebuild parent/child relationships during BaseRobot.__deepcopy__() using the existing parent-name resolution mechanism.
  • Modify friction parameters directly on the copied robot's links instead of replacing nf._links.
  • Add a regression test with two joints separated by a static link.

The test verifies correct parent/child references, unchanged original topology, matching inverse dynamics results, and successful coriolis() calculations.

Validation

Validated commit fbc9474 in [fork CI PR #2](huxiaoyi-ovo#2).

  • Python 3.10–3.14 on Ubuntu, Windows and macOS: all passed.
  • Core tests and aggregate test gate: passed.
  • Coverage and documentation builds: passed.
  • 19 successful jobs, 1 conditional skip, 0 failures.

Only three files changed. No public API signatures or inverse dynamics equations were modified.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · -1 duplication

Metric Results
Complexity 0
Duplication -1

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.

@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
src/roboticstoolbox/robot/BaseRobot.py 0.00% 6 Missing ⚠️
src/roboticstoolbox/robot/Dynamics.py 0.00% 5 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #732   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        143     143           
  Lines      14269   14278    +9     
=====================================
- Misses     14269   14278    +9     

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

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.

coriolis() and Robot.copy().rne() fail for URDF/ETS robots: copied links keep their original parent

1 participant