IK_GN - Gauss-Newton Numerical IK
- class roboticstoolbox.robot.IK.IK_GN(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:
IKSolverGauss-Newton Numerical Inverse Kinematics Solver
A class which provides functionality to perform numerical inverse kinematics (IK) using the Gauss-Newton method. See
stepmethod for mathematical description.Note
When using this class with redundant robots (>6 DoF),
pinvmust be set toTrue- Parameters:
name (
str) – The name of the IK algorithmilimit (
int) – How many iterations are allowed within a search before a new search is startedslimit (
int) – How many searches are allowed before being deemed unsuccessfultol (
float) – Maximum allowed residual error E, where \(E = \tfrac{1}{2} \vec{e}^\top \mat{W}_e \vec{e}\) is a quadratic form in the 6-vector angle-axis pose error \(\vec{e}\) (seeerror()). BecauseEis quadratic,toldoes not bound the linear-scale position/ orientation error directly — with the default unit weighting, components of \(\vec{e}\) are only guaranteed to be within roughly \(\sqrt{2 \cdot \text{tol}}\) (e.g.tol=1e-6guarantees pose error on the order of 1e-3, not 1e-6). Picktolaccordingly if you need a specific linear-scale accuracymask (
Union[ndarray,List[float],Tuple[float,...],None]) – A 6 vector which assigns weights to Cartesian degrees-of-freedom error priorityjoint_limits (
bool) – Reject solutions with joint limit violationsseed (
int|None) – A seed for the private RNG used to generate random joint coordinate vectorspinv (
bool) – If True, will use the pseudoinverse in thestepmethod instead of the normal inversekq (
float) – The gain for joint limit avoidance. Setting to 0.0 will remove this completely from the solutionkm (
float) – The gain for maximisation. Setting to 0.0 will remove this completely from the solutionps (
float) – The minimum angle/distance (in radians or metres) in which the joint is allowed to approach to its limitpi (
ndarray|float) – The influence angle/distance (in radians or metres) in null space motion becomes active
Example:
The following example gets the ``ets`` of a ``panda`` robot object, instantiates the `IK_GN` 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_GN(pinv=True) >>> Tep = panda.fkine([0, -0.3, 0, -2.2, 0, 2, 0.7854]) >>> solver.solve(panda, Tep) IKSolution(q=array([-2.6869, 0.3296, 2.7362, -2.1984, -0.1471, 1.9904, 0.9014]), success=True, iterations=45, searches=2, residual=2.6090656669768193e-08, reason='Success')
Notes
When using the this 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.
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).
See also
IKSolverAn abstract super class for numerical IK solversIK_NRImplements IKSolver using the Newton-Raphson methodIK_LMImplements IKSolver using the Levemberg-Marquadt methodIK_QPImplements IKSolver using a quadratic programming approachChanged in version 1.0.3: Added the Gauss-Newton IK solver class
Methods
|
Performs a single iteration of the Gauss-Newton optimisation method |
|
Solves the IK problem |
|
Calculates the error between Te and Tep |
Private Methods
|
Generate a random valid joint configuration using a private RNG |
|
Checks if the joints are within their respective limits |