Skip to content

docs: update Swift RRMC example to the AssemblyHandle API - #617

Open
petercorke wants to merge 1 commit into
mainfrom
docs/readme-handle-api
Open

docs: update Swift RRMC example to the AssemblyHandle API#617
petercorke wants to merge 1 commit into
mainfrom
docs/readme-handle-api

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Summary

The README's resolved-rate motion control example (and its standalone copy, examples/RRMC_swift.py) predates Swift 2.0's AssemblyHandle refactor: env.add(panda) now returns a handle owning the live q/qd state, and driving the simulation by mutating panda.q/panda.qd directly is deprecated.

Worse than a deprecation warning, though: a control loop that reads panda.q back mid-loop (as both these examples do) reads a permanently stale value by default -- Swift doesn't write back into the robot object unless the deprecated path is explicitly engaged (see companion Swift PR jhavl/swift#129). The robot never converges.

Updated both to capture and drive the handle instead -- the currently-correct way to write this example regardless of that Swift-side fix.

examples/RRMC.py (PyPlot backend, not Swift) is unaffected -- untouched. examples/branched_robot.py uses the same deprecated r.qd[...] = ... legacy-mutation style but is a functional non-issue once jhavl/swift#129 lands; left as-is rather than expanding scope here.

Test plan

  • Ran the updated example headlessly under warnings.simplefilter("error"): converges in 43 steps, zero warnings, panda itself stays untouched (confirming it's a genuinely plain, shareable model)

The README's resolved-rate motion control example (and its standalone
copy, examples/RRMC_swift.py) predates Swift 2.0's AssemblyHandle
refactor: env.add(panda) now returns a handle owning the live q/qd
state, and driving the simulation by mutating panda.q/panda.qd
directly is deprecated. Worse than a deprecation warning, though: a
control loop that reads panda.q back mid-loop (as both these examples
do) now reads a permanently stale value, since Swift no longer writes
back into the robot object by default -- the robot never converges.

Updated both to capture and drive the handle instead.
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (5977ac4) to head (fe892e8).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #617   +/-   ##
=====================================
  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.

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