Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/source/IK/numerical.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,32 @@ In the following example, we create a :py:class:`~roboticstoolbox.models.URDF.Pa
>>> ets = panda.ets() # Get the ETS
>>> Tep = ets.fkine([0, -0.3, 0, -2.2, 0, 2, 0.7854]) # Make a goal pose
>>> ets.ikine_LM(Tep) # Solve the IK problem

.. rubric:: IK with a locked joint

An arm with seven joints can still reach a six-dimensional end-effector pose
while one joint is held at a specified angle. :meth:`~roboticstoolbox.ETS.fixjoint`
replaces that joint by a constant transform and returns a new ETS; the original
robot and its seven-joint ETS are unchanged. The initial guess for IK has
only six coordinates, with the locked joint omitted.

This example starts from a reachable Panda pose, locks joint 2 (counted from
zero), then solves the resulting six-joint IK problem.

.. runblock:: pycon

>>> import numpy as np
>>> import roboticstoolbox as rtb
>>> panda = rtb.models.ETS.Panda()
>>> ets = panda.ets()
>>> q_goal = np.array([0.2, -0.4, 0.3, -1.5, 0.25, 1.6, -0.2])
>>> target = ets.fkine(q_goal)
>>> reduced = ets.fixjoint(2, q_goal[2])
>>> reduced.n
6
>>> seed = np.delete(q_goal, 2) + 0.02
>>> sol = reduced.ikine_LM(target, q0=seed)
>>> sol.success
True
>>> np.allclose(reduced.fkine(sol.q).A, target.A, atol=1e-5)
True
Loading