Repository navigation
fix(puma): self-contained ikine_a with trajectory and failure handling; deprecate ikine_6s - #715
Open
petercorke wants to merge 1 commit into
Open
petercorke wants to merge 1 commit into
petercorke wants to merge 1 commit into
Conversation
…dling; deprecate ikine_6s Puma560.ikine_a relied on DHRobot.ikine_6s, which came from the MATLAB Toolbox and is not general: it only handled the wrist, while the Paul and Zhang first-three-joints solution (ik3) is specific to the Puma geometry (zero first link length, lateral shoulder offset d3). Move the wrist, base/tool and trajectory handling into ikine_a so it is self-contained, and deprecate ikine_6s (frozen, it still runs but warns). Fix bugs in the old path: - a pose closer to the waist axis than the shoulder offset returned success=True with q all NaN (the arcsin(d3/r) NaN was not caught) - a trajectory returned a garbled IKSolution: the failure reasons were passed as the iterations argument, success was an array, and reason was empty - a trajectory containing an unreachable pose raised ValueError - an ndarray pose raised AttributeError - the docstring said it returned a joint vector, and had typos ikine_a now returns an IKSolution like the numerical solvers: q (n,) or (N, n), one bool success, the maximum residual, and the last failure reason. Joints of a pose that cannot be solved are NaN. Success is decided by checking the solution by forward kinematics, not by the absence of an exception. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 29 |
| Duplication | 2 |
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.
4 of 5 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #715 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 143 143
Lines 14269 14313 +44
=====================================
- Misses 14269 14313 +44 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3 of 4 tasks
This branch has not been deployed
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
Puma560.ikine_awas a hand-written Puma solution (Paul and Zhang 1986) wrapped inDHRobot.ikine_6s, a generic-looking helper from the MATLAB Toolbox. It is not generic: it only handles the wrist, and theikfuncthat solves joints 1-3 is specific to one geometry (it readsa2, a3, d1, d3, d4and nevera1, so it assumes a zero first link length and a lateral shoulder offset).Puma560.ikine_awas its only caller.ikine_ais now self-contained. The wrist, base/tool and trajectory handling moved into it. The Paul and Zhang equations for joints 1-3 are unchanged.DHRobot.ikine_6sis deprecated (DeprecationWarning,.. deprecated:: 1.5.0). It is frozen: it still runs but warns, and its known problems are noted in the deprecation text. The intent is to remove it in a later release.success=Truewithqall NaN (thearcsin(d3/r)NaN was never caught)IKSolution: the failure reasons were passed positionally asiterations,successwas an array, andreasonwas emptyValueErrorAttributeErrorNew
ikine_acontract (matches the numerical solvers)SE3or a 4x4 / (N, 4, 4) array (bad shapes raiseValueError; the array handling works around spatialmath#236)IKSolution:qof shape (n,) or (N, n), a single boolsuccess(True only if every pose succeeded), the maximumresidual, the last failurereason, anditerations = searches = 0qstays rectangulartol(default 1e-6, as in the numerical solvers), not by the absence of an exception, so a NaN can no longer be reported as a successconfig, a single pose still returnsqwith shape (n,), andRobot.jtrajstill findsikine_aby nameTest plan
ikine_atests pass unchanged, including the tool regression for DHRobot.ikine_6s() undoes the tool transform on the wrong side #640, and also pass with-W error::DeprecationWarning, which showsikine_ano longer touchesikine_6stests/test_DHRobot.py,test_Robot.py,test_IK.py,test_trajectory.py: 192 passedikine_6sdeprecation. Five of them fail onmainand pass here; the wrist-singular and base tests pass on both and pin existing behaviour.Follow-ups (separate PRs)
Robot.jtrajshould take joint vectors only (pose arguments deprecated)🤖 Generated with Claude Code