skbot.inverse_kinematics.gd

skbot.inverse_kinematics.gd(targets, joints, *, rtol=1e-06, maxiter=500)[source]

L-BFGS-B based Gradient Descent.

Note

This function will modify the objects in joints as a side effect.

Use L-BFGS-B to find values for joints such that the sum of all target scores is minimal. L-BFGS-B is a quasi-Newton method that approximates both the targets Jacobian and Hessian.

Parameters
targetsList[Target]

A list of quality measures that a successful pose minimizes.

jointsList[joint]

A list of 1DoF joints which should be adjusted to minimize targets.

rtolfloat

Relative tolerance for termination. If, after one iteration, the sum of scores has not improved by more than rtol the algorithm terminates and assumes that a local optimum has been found.

maxiterint

The maximum number of iterations to perform.

Returns
joint_valuesList[float]

The final parameters of each joint.

Notes

Joint limits (min/max) are enforced as hard constraints throughout the optimization.

A common cause of IK faulure is that the chosen initial condition is too far away from the desired target position. One indicator for this is that gd() converges based on rtol, but the score of one or more targets isn’t below atol.