Fix duplicate variable in null-space condition of _calc_qnull#510
Open
Lidang-Jiang wants to merge 1 commit intopetercorke:futurefrom
Open
Fix duplicate variable in null-space condition of _calc_qnull#510Lidang-Jiang wants to merge 1 commit intopetercorke:futurefrom
Lidang-Jiang wants to merge 1 commit intopetercorke:futurefrom
Conversation
The condition `if λΣ > 0 or λΣ > 0:` duplicates the λΣ check, which should be `if λΣ > 0 or λm > 0:`. This caused null-space motion to be skipped entirely when only km (manipulability maximisation) was enabled without kq (joint limit avoidance). Fixes petercorke#499 Signed-off-by: Lidang-Jiang <lidangjiang@gmail.com>
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
_calc_qnull()whereif λΣ > 0 or λΣ > 0:should beif λΣ > 0 or λm > 0:.km(manipulability maximisation) was enabled withoutkq(joint limit avoidance)._calc_qnullcovering all gain combinations.Fixes #499
Root Cause
In
roboticstoolbox/robot/IK.py, the function_calc_qnullhas a condition that gates null-space motion calculation:When
kq=0(soλΣ=0) andkm>0(soλm>0), the buggy condition evaluates toFalse, causing the null-space projection to be skipped and returning a zero vector instead of the manipulability gradient projected into the null space.Before (with bug): qnull is all zeros when only km > 0
After (fixed): qnull is non-zero when km > 0
Unit test results (5 new tests, all passing)
Full IK test suite (no regressions; 5 QP failures are pre-existing due to missing qpsolvers dependency)
Test Plan
_calc_qnullreturns zero vector when bothkq=0andkm=0_calc_qnullreturns non-zero vector whenkm>0andkq=0(the Null Space Calculation Bug in _calc_qnull method #499 regression case)_calc_qnullworks correctly whenkq>0andkm=0_calc_qnullworks correctly when bothkq>0andkm>0