Repository navigation
feat(ik): IKSolution is a sequence of the rows of q, true if successful - #717
Open
petercorke wants to merge 1 commit into
Open
petercorke wants to merge 1 commit into
petercorke wants to merge 1 commit into
Conversation
An IKSolution now behaves as a sequence of the joint vectors of the poses it holds, so a solution for a single pose and for a trajectory are used the same way: - len(sol) is the number of poses, 1 for a single pose, 0 if q is None - for q in sol, sol[i] and slices give the rows of q, sol[i] is np.atleast_2d(sol.q)[i], an array and not an IKSolution since success, residual and reason apply to the whole solution - bool(sol) is sol.success - sol.astuple() returns the six fields as a tuple Iterating an IKSolution used to give its six fields, so q, success, ... = sol and sol[1] no longer work, use the attributes or astuple(). Nothing in this repository, its docs and examples, or RVC3, MVTB and bdsim used that form, apart from tests, the __main__ demo and a README snippet which are updated. Printing is improved: a trajectory shows the number of poses and a long q is abbreviated, the residual of a failed solution is no longer rounded to zero, and an analytic solution shows its residual if it has one. The format for a single pose is otherwise unchanged. This is a small incompatible change, released as a feat as is usual for such changes here. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 27 |
| 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.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #717 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 143 143
Lines 14269 14293 +24
=====================================
- Misses 14269 14293 +24 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
IKSolutionnow behaves as a sequence of the joint vectors of the poses it holds, so a solution for a single pose and for a trajectory are used the same way (numeric or analytic):len(sol)is the number of poses: 1 for a single pose, N for a trajectory, 0 ifqisNonefor q in sol,sol[i]and slices give the rows ofq.sol[i]isnp.atleast_2d(sol.q)[i], an array and not anIKSolution, becausesuccess,residualandreasonapply to the whole solutionbool(sol)issol.successsol.astuple()returns the six fields as a tupleqis abbreviated (first three and last two poses); the residual of a failed solution is no longer rounded to zero; an analytic solution shows its residual if it has one. The single pose format is otherwise unchanged.This prepares the analytic IK work, which needs one result type for single poses, trajectories and "all solutions of one pose".
Incompatible change
Iterating an
IKSolutionused to give its six fields (added in 1.4.2 for code written against the old bare tuple), soq, success, ... = solandsol[1]no longer work. Use the attributes orsol.astuple(). This is a small incompatible change, committed as afeat(no major version bump), as is usual for such changes here.I searched for uses of the old form in this repo (code, docstrings,
.rst, notebooks, examples), the wiki, and the RVC3-python, MVTB, bdsim and rvc-* repos. The only ones were in tests, the__main__demo at the bottom ofIK.py, and one README snippet (which also showed an out-of-date result format), all updated here. External users are unknown.Notes
residual=3, so they now expect it to be shownrunblockexample, andik.rsthas one sentence pointing to it (kept to a single line away from the table so it merges cleanly with fix(ik): trajectory residual is the maximum, and document trajectory behaviour #712)Test plan
tests/test_IK.py,test_ik_joint_limits.py,test_Robot.py,test_DHRobot.py,test_ETS.py,test_trajectory.py: 473 passedIndexError, NumPy sees the rows,q is Noneis empty,bool(sol)issuccess(also with rows present),astuple, a real solver trajectory, and the print cases (trajectory, long trajectory abbreviated, failed residual not rounded, analytic without a residual)ik_*tests that read success withsol[1]and the old tuple tests are rewritten to use attributes🤖 Generated with Claude Code