Skip to content

fix(robot): Robot.set_default_backend replaces rtbtool's monkey-patch; URDFRobot drops a dead guard - #810

Merged
petercorke merged 3 commits into
mainfrom
fix/models-urdf-and-rtbtool
Oct 16, 2026
Merged

petercorke merged 3 commits into
mainfrom
fix/models-urdf-and-rtbtool

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Summary

Items 58 and 59 of the typing pass.

58, rtbtool: rtbtool assigned a string to Robot.default_backend on the class, replacing the property for every robot. It worked because an instance assignment then shadows the class attribute, and needed a type: ignore. Robot.set_default_backend(be) is a classmethod that sets a class-level default which the default_backend property falls back to. The robot's own value still wins, the property stays a property, and rtbtool calls the classmethod.

59, URDFRobot: elink.geometry = [...] was inside try/except AttributeError, under a comment saying geometry has no setter. It has one (Link.py), and the assignment works. Every visual that parses has a shape (a missing mesh, an empty <geometry/>, no <geometry> or an unknown shape tag is a URDFError at parse time), so the guard could not fire. It is removed, and tests assert both facts.

Tests

  • tests/test_default_backend.py, written first: 4 of 4 failed (AttributeError: no attribute 'set_default_backend'), then pass.
  • tests/test_urdf_visual_geometry.py: shapes reach the link, and four malformed visuals are rejected when parsed.
  • Full suite: same 29 failures as main here (stale compiled extension). mypy clean on 164 files.

Related issue

None.

🤖 Generated with Claude Code

petercorke and others added 2 commits October 16, 2026 10:40
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…; URDFRobot drops a dead guard

rtbtool assigned a string to Robot.default_backend on the class, replacing the
property for every robot.  It worked because an instance assignment then shadows
the class attribute.  Robot.set_default_backend(be) is a classmethod that sets
a class-level default which the property falls back to; the robot's own value
still wins, and the property stays a property.

URDFRobot wrapped elink.geometry = [...] in try/except AttributeError, with a
comment that geometry has no setter.  It has one, and every visual that parses
has a shape (a missing mesh or an empty geometry is a URDFError at parse time),
so the guard could not fire.  Removed, with tests for both facts.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 9 high

Alerts:
⚠ 9 issues (≤ 0 issues of at least minor severity)

Results:
9 new issues

Category Results
ErrorProne 1 high
Security 8 high

View in Codacy

🟢 Metrics 9 complexity · 0 duplication

Metric Results
Complexity 9
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.

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
src/roboticstoolbox/robot/BaseRobot.py 0.00% 7 Missing ⚠️
src/roboticstoolbox/bin/rtbtool.py 0.00% 1 Missing ⚠️
src/roboticstoolbox/models/URDF/URDFRobot.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #810   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        144     144           
  Lines      14914   14917    +3     
=====================================
- Misses     14914   14917    +3     

☔ 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 enabled auto-merge (squash) October 16, 2026 21:13
@petercorke
petercorke merged commit 681c725 into main Oct 16, 2026
22 of 23 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 16, 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.

1 participant