docs: update Swift RRMC example to the AssemblyHandle API - #617
Open
petercorke wants to merge 1 commit into
Open
docs: update Swift RRMC example to the AssemblyHandle API#617petercorke wants to merge 1 commit into
petercorke wants to merge 1 commit into
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The README's resolved-rate motion control example (and its standalone copy,
examples/RRMC_swift.py) predates Swift 2.0'sAssemblyHandlerefactor:env.add(panda)now returns a handle owning the liveq/qdstate, and driving the simulation by mutatingpanda.q/panda.qddirectly is deprecated.Worse than a deprecation warning, though: a control loop that reads
panda.qback 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.pyuses the same deprecatedr.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
warnings.simplefilter("error"): converges in 43 steps, zero warnings,pandaitself stays untouched (confirming it's a genuinely plain, shareable model)