Repository navigation
fix(dynamics): paycap returns the capacity, a scalar, as the MATLAB method does - #759
Closed
petercorke wants to merge 1 commit into
Closed
petercorke wants to merge 1 commit into
petercorke wants to merge 1 commit into
Conversation
…ethod does The method comes from the MATLAB Robotics Toolbox, where it was contributed by Bryan Moutrie (pHRIWARE). There it ends with [wM, j] = min(WM, [], 2): the largest multiple of the unit payload wrench that no joint torque limit forbids, and the joint that limits it. The Python port kept the argmin but dropped the min, so it returned one value per joint, labelled as a six element wrench, which is why it only worked for six joint robots (#728, #731). - return the scalar capacity and the limiting joint, a vector over poses for a trajectory - treat a joint that the wrench does not load, to within rounding error, as unbounded rather than as a capacity of ~1e17 - document that the result is negative if the robot cannot support itself, and that w is the wrench the payload applies to the end-effector - say in pay() that its result is -J'W, the holding torque, which is what the code and the MATLAB code do; both docstrings had the wrong sign - credit Bryan Moutrie in paycap() and pay() - tests on a planar two link arm with results worked out by hand, replacing the commented out test, which could not have shown anything useful Builds on the shape handling in #731. Co-authored-by: huxiaoyi-ovo <huxiaoyi_0106@163.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 5 high |
🟢 Metrics 10 complexity · 0 duplication
Metric Results Complexity 10 Duplication 0
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 Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #759 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 143 143
Lines 14367 14367
=====================================
Misses 14367 14367 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Owner
Author
|
Closing for now, this is on hold. The branch |
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
paycapandpaycame from the MATLAB Robotics Toolbox, where Bryan Moutrie contributed them (pHRIWARE). Following #731 I read the original to see what the function was meant to return.MATLAB's
paycapends with[wM, j] = min(WM, [], 2): the largest multiple of the unit payload wrench that no joint torque limit forbids, and the joint that limits it. The Python port kept theargminbut dropped themin, so it returned one value per joint, labelled "maximum permissible payload wrench (6)". That is why it only worked for six joint robots (#728) and why its old test's expected values were six numbers, one of them6e15.(The MATLAB docstring also says
WMAX (1x6), which the code does not do either; the docstring was wrong from the start.)Changes
paycapreturns the scalar capacity and the limiting joint (vectors over poses for a trajectory)wis the wrench the payload applies to the end-effectorpay()docstring saidtau = J'W; the code (and MATLAB's) is-J'W, the holding torque, which adds togravload. Docstring fixed, with a worked sign exampleCompatibility
For a six joint robot,
paycapused to return a(6,)array of per-joint values; it now returns a scalar. Nothing in this repository, its docs or RVC3 callspaycap, and it has had no working test since 2020. Aversionchanged:: 1.4.5note says so. This is a bug fix of the port, so it is committed as afix.Builds on the shape handling in #731, whose author is credited in the commit.
Test plan
tests/test_paycap_capacity.py(18 tests) andtests/test_DHRobot.py🤖 Generated with Claude Code