# IK_NR - Newton-Raphson Numerical IK

class roboticstoolbox.robot.IK.IK_NR(name='IK Solver', ilimit=30, slimit=100, tol=1e-06, mask=None, joint_limits=True, seed=None, pinv=False, kq=0.0, km=0.0, ps=0.0, pi=0.3, **kwargs)[source]

Bases: IKSolver

Newton-Raphson Numerical Inverse Kinematics Solver

A class which provides functionality to perform numerical inverse kinematics (IK) using the Newton-Raphson method. See step method for mathematical description.

Note

When using this class with redundant robots (>6 DoF), pinv must be set to True

Parameters:

Examples

The following example gets the ets of a panda robot object, instantiates the IK_NR solver class using default parameters, makes a goal pose Tep, and then solves for the joint coordinates which result in the pose Tep using the solve method.

>>> import roboticstoolbox as rtb
>>> panda = rtb.models.Panda().ets()
>>> solver = rtb.IK_NR(pinv=True)
>>> Tep = panda.fkine([0, -0.3, 0, -2.2, 0, 2, 0.7854])
>>> solver.solve(panda, Tep)
IKSolution(q=array([-2.3853,  0.3909,  2.4784, -2.1923, -0.27  ,  1.9673,  0.9981]), success=True, iterations=188, searches=12, residual=2.42191743196601e-10, reason='Success')


Notes

When using the NR method, the initial joint coordinates $$q_0$$, should correspond to a non-singular manipulator pose, since it uses the manipulator Jacobian. When the the problem is solvable, it converges very quickly. However, this method frequently fails to converge on the goal.

This class supports null-space motion to assist with maximising manipulability and avoiding joint limits. These are enabled by setting kq and km to non-zero values.

References

• J. Haviland, and P. Corke. “Manipulator Differential Kinematics Part I: Kinematics, Velocity, and Applications.” arXiv preprint arXiv:2207.01796 (2022).

• J. Haviland, and P. Corke. “Manipulator Differential Kinematics Part II: Acceleration and Advanced Applications.” arXiv preprint arXiv:2207.01794 (2022).

IKSolver

An abstract super class for numerical IK solvers

IK_GN

Implements the IKSolver class using the Gauss-Newton method

IK_LM

Implements the IKSolver class using the Levemberg-Marquadt method

IK_QP

Implements the IKSolver class using a quadratic programming approach

Changed in version 1.0.3: Added the Newton-Raphson IK solver class

Methods

 step(ets, Tep, q) Performs a single iteration of the Newton-Raphson optimisation method solve(ets, Tep[, q0]) Solves the IK problem error(Te, Tep) Calculates the error between Te and Tep

Private Methods

 _random_q(ets[, i]) Generate a random valid joint configuration using a private RNG _check_jl(ets, q) Checks if the joints are within their respective limits