ETS.ikine_LM
- ETS.ikine_LM(Tep, q0=None, ilimit=30, slimit=100, tol=1e-06, mask=None, joint_limits=True, seed=None, k=1.0, method='chan', kq=0.0, km=0.0, ps=0.0, pi=0.3, **kwargs)[source]
Levenberg-Marquardt numerical inverse kinematics solver
- Parameters:
q0 (
Union[ndarray,List[float],Tuple[float,...],None]) – the initial joint coordinate vectorilimit (
int) – maximum iterations allowed per searchslimit (
int) – maximum search attempts before failuretol (
float) – maximum allowed residual error Emask (
Union[ndarray,List[float],Tuple[float,...],None]) – a 6-vector weighting Cartesian DoF error priorityjoint_limits (
bool) – reject solutions with joint limit violationsseed (
int|None) – seed for the RNG used to generate random joint configurationsk (
float) – gain value for the damping matrix Wnmethod (
Literal['chan','wampler','sugihara']) – one of"chan"(default),"sugihara"or"wampler"kq (
float) – gain for joint limit avoidance (0.0 disables)km (
float) – gain for manipulability maximisation (0.0 disables)ps (
float) – minimum joint approach distance to limit (radians or metres)pi (
ndarray|float) – null-space influence distance (radians or metres)
- Returns:
IK solution
A method which provides functionality to perform numerical inverse kinematics (IK) using the Levenberg-Marquardt method.
See the Inverse Kinematics Docs Page for more details and for a tutorial on numerical IK, see here.
The operation is defined by the choice of the
methodkwarg.The step is defined as
\[\begin{split}\vec{q}_{k+1} &= \vec{q}_k + \left( \mat{A}_k \right)^{-1} \bf{g}_k \\ % \mat{A}_k &= {\mat{J}(\vec{q}_k)}^\top \mat{W}_e \ {\mat{J}(\vec{q}_k)} + \mat{W}_n\end{split}\]where \(\mat{W}_n = \text{diag}(\vec{w_n})(\vec{w_n} \in \mathbb{R}^n_{>0})\) is a diagonal damping matrix. The damping matrix ensures that \(\mat{A}_k\) is non-singular and positive definite. The performance of the LM method largely depends on the choice of \(\mat{W}_n\).
Chan’s Method
Chan proposed
\[\mat{W}_n = λ E_k \mat{1}_n\]where λ is a constant which reportedly does not have much influence on performance. Use the kwarg
kto adjust the weighting term λ.Sugihara’s Method
Sugihara proposed
\[\mat{W}_n = E_k \mat{1}_n + \text{diag}(\hat{\vec{w}}_n)\]where \(\hat{\vec{w}}_n \in \mathbb{R}^n\), \(\hat{w}_{n_i} = l^2 \sim 0.01 l^2\), and \(l\) is the length of a typical link within the manipulator. We provide the variable
kas a kwarg to adjust the value of \(w_n\).Wampler’s Method
Wampler proposed \(\vec{w_n}\) to be a constant. This is set through the
kkwarg.Examples
The following example gets the
etsof apandarobot object, makes a goal poseTep, and then solves for the joint coordinates which result in the poseTepusing theikine_LMmethod.>>> import roboticstoolbox as rtb >>> panda = rtb.models.Panda().ets() >>> Tep = panda.fkine([0, -0.3, 0, -2.2, 0, 2, 0.7854]) >>> panda.ikine_LM(Tep) IKSolution(q=array([-2.4936, 0.3632, 2.5691, -2.1948, -0.2216, 1.978 , 0.9601]), success=True, iterations=57, searches=4, residual=9.160741844833102e-11, reason='Success')
Notes
The value for the
kkwarg will depend on themethodchosen and the arm you are using. Use the following as a rough guidechan, k = 1.0 - 0.01,wampler, k = 0.01 - 0.0001, andsugihara, k = 0.1 - 0.0001When using 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 Levenberg-Marquardt IK solver method on the
ETSclass