Skip to content

Commit

Permalink
reversed over and under-determined cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
i-make-robots committed Oct 29, 2023
1 parent 64df79f commit d9bf714
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ public double[] getCartesianForceFromJointForce(final double[] jointForce) {
return cartesianVelocity;
}


// https://stackoverflow.com/a/53028167/1159440
/**
* See <a href="https://stackoverflow.com/a/53028167/1159440">5 DOF Inverse kinematics for Jacobian Matrices</a>.
* @return the inverse Jacobian matrix.
*/
private double[][] getInverseJacobian() {
int rows = jacobian.length;
int cols = jacobian[0].length;
if(rows>cols) return getPseudoInverseOverdetermined();
else if (rows < cols) return getPseudoInverseUnderdetermined();
if(rows<cols) return getPseudoInverseOverdetermined();
else if (rows>cols) return getPseudoInverseUnderdetermined();
else {
return getInverseDampedLeastSquares(0.0001);
//return MatrixHelper.invert(jacobian); // old way
Expand Down

0 comments on commit d9bf714

Please sign in to comment.