Skip to content

fix: Robot._to_dict() uses set_alpha(), deprecated by spatialgeometry - #616

Merged
petercorke merged 1 commit into
mainfrom
fix/robot-set-alpha-opacity
Aug 22, 2026
Merged

fix: Robot._to_dict() uses set_alpha(), deprecated by spatialgeometry#616
petercorke merged 1 commit into
mainfrom
fix/robot-set-alpha-opacity

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Summary

spatialgeometry deprecated Shape.set_alpha() in favour of an opacity property (functionally identical -- set_alpha just does self.opacity = alpha internally -- but emits a FutureWarning on every call now). Robot._to_dict() calls set_alpha() on every link/gripper geometry and collision shape, so any env.add_robot(robot) in Swift triggers the warning. Switched to the opacity property directly.

Test plan

  • panda._to_dict(robot_alpha=0.5, collision_alpha=0.3) under warnings.simplefilter("error"): no warnings raised, opacity correctly set on the returned dicts
  • tests/test_Robot.py + tests/test_ERobot.py: 53 passed, 5 skipped (unrelated), one pre-existing unrelated warning (_propogate_scene_tree, a different deprecated call elsewhere in the test)

spatialgeometry deprecated Shape.set_alpha() in favour of an opacity
property (still functionally identical -- set_alpha just does
`self.opacity = alpha` -- but emits a FutureWarning on every call).
Robot._to_dict() calls it on every link/gripper geometry and collision
shape, so any env.add_robot(robot) in Swift triggers the warning.
Switch to the opacity property directly.
@codecov

codecov Bot commented Aug 18, 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 (5977ac4) to head (3f73c26).
⚠️ 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    #616   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        142     142           
  Lines      13898   13898           
=====================================
  Misses     13898   13898           

☔ 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 merged commit 646138a into main Aug 22, 2026
23 checks passed
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