Skip to content

Commit b8fbc9e

Browse files
committed
allow analytic IK to return error message
1 parent c03922e commit b8fbc9e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

roboticstoolbox/robot/DHRobot.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,9 +1627,7 @@ def ikine_6s(self, T, config, ikfunc):
16271627
# get model specific solution for first 3 joints
16281628
theta = ikfunc(self, Tk, config)
16291629

1630-
if theta is None or np.any(np.isnan(theta)):
1631-
solution = iksol(None, False, "")
1632-
else:
1630+
if isinstance(theta, np.ndarray):
16331631
# Solve for the wrist rotation
16341632
# We need to account for some random translations between the
16351633
# first and last 3 joints (d4) and also d6,a6,alpha6 in the
@@ -1661,6 +1659,13 @@ def ikine_6s(self, T, config, ikfunc):
16611659

16621660
solution = iksol(theta, True, "")
16631661

1662+
else:
1663+
# ikfunc can return None or a str reason
1664+
if theta is None:
1665+
solution = iksol(None, False, "")
1666+
else:
1667+
solution = iksol(None, False, theta)
1668+
16641669
solutions.append(solution)
16651670

16661671
if len(T) == 1:

0 commit comments

Comments
 (0)