Robot.ikine_GN
- Robot.ikine_GN(Tep, end=None, start=None, q0=None, 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, tool=None, **kwargs)
Gauss-Newton Numerical Inverse Kinematics Solver
- Parameters:
Tep (
ndarray|SE3) – The desired end-effector pose or pose trajectoryend (
str|Link|Gripper|None) – the link considered as the end-effectorstart (
str|Link|Gripper|None) – the link considered as the base frame, defaults to the robots’s base frameq0 (
ndarray|Sequence[float] |None) – The initial joint coordinates, a vector (n,), or a matrix (m, n) whose rows are the starting points of the first m searches (any further searches start from random valid coordinates)ilimit (
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 Emask (
ndarray|Sequence[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 activetool (
ndarray|SE3|None) – a static tool transformation matrix to apply to the end ofend; defaults to the robot’s ownself.toolif not given
- Returns:
an IKSolution containing joint coordinates
q,successflag,iterations,searches,residualerror value, andreasonstring if applicable- Return type:
If
Tepis a trajectory (anSE3with N poses, or an array with shape (N, 4, 4)) each pose is solved independently from the sameq0, so consecutive solutions are not guaranteed to be on the same IK branch.qhas shape (N, n),successis True only if every pose succeeded, andresidualis the maximum over the poses. Seesolve().Changed in version 1.4.5: For a trajectory,
residualis the maximum over the poses, it was the minimum.A method which provides functionality to perform numerical inverse kinematics (IK) using the Gauss-Newton method.
See the Inverse Kinematics Docs Page for more details and for a tutorial on numerical IK, see here.
Note
When using this method with redundant robots (>6 DoF),
pinvmust be set toTrueEach iteration uses the Gauss-Newton optimisation method
\[\begin{split}\vec{q}_{k+1} &= \vec{q}_k + \left( {\mat{J}(\vec{q}_k)}^\top \mat{W}_e \ {\mat{J}(\vec{q}_k)} \right)^{-1} \bf{g}_k \\ \bf{g}_k &= {\mat{J}(\vec{q}_k)}^\top \mat{W}_e \vec{e}_k\end{split}\]where \(\mat{J} = {^0\mat{J}}\) is the base-frame manipulator Jacobian. If \(\mat{J}(\vec{q}_k)\) is non-singular, and \(\mat{W}_e = \mat{1}_n\), then the above provides the pseudoinverse solution. However, if \(\mat{J}(\vec{q}_k)\) is singular, the above can not be computed and the GN solution is infeasible.
Examples
The following example gets a
pandarobot object, makes a goal poseTep, and then solves for the joint coordinates which result in the poseTepusing theikine_GNmethod.>>> import roboticstoolbox as rtb >>> panda = rtb.models.Panda() >>> Tep = panda.fkine([0, -0.3, 0, -2.2, 0, 2, 0.7854]) >>> panda.ikine_GN(Tep) IKSolution: q=[2.877, -1.071, 1.194, -1.051, 1.944, 1.616, -2.036], success=False, reason=iteration and search limit reached, 100 numpy.LinAlgError encountered, iterations=100, searches=100, residual=1.63
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.
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
Changed in version 1.0.4: Added the Gauss-Newton IK solver method on the
Robotclass