Skip to content

Commit 49bcd5d

Browse files
committed
incorp IKSolution into analytic IK
1 parent b2826d7 commit 49bcd5d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

roboticstoolbox/robot/DHRobot.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""
55

66
from collections import namedtuple
7+
from email import message
78
from roboticstoolbox.tools.data import rtb_path_to_datafile
89
import warnings
910
import copy
@@ -34,10 +35,11 @@
3435
from frne import init, frne, delete
3536
from numpy import any
3637
from typing import Union, Tuple
38+
from roboticstoolbox.robot.IK import IKSolution
3739

3840
ArrayLike = Union[list, np.ndarray, tuple, set]
3941

40-
iksol = namedtuple("IKsolution", "q, success, reason")
42+
# iksol = namedtuple("IKsolution", "q, success, reason")
4143

4244

4345
class DHRobot(Robot):
@@ -1835,21 +1837,22 @@ def ikine_6s(self, T, config, ikfunc):
18351837
# Remove the link offset angles
18361838
theta = theta - self.offset
18371839

1838-
solution = iksol(theta, True, "")
1840+
# solution = iksol(theta, True, "")
1841+
solution = IKSolution(q=theta, success=True)
18391842

18401843
else:
18411844
# ikfunc can return None or a str reason
18421845
if theta is None:
1843-
solution = iksol(None, False, "")
1846+
solution = IKSolution(q=None, success=False)
18441847
else:
1845-
solution = iksol(None, False, theta)
1848+
solution = IKSolution(q=None, success=False, reason=theta)
18461849

18471850
solutions.append(solution)
18481851

18491852
if len(T) == 1:
18501853
return solutions[0]
18511854
else:
1852-
return iksol(
1855+
return IKSolution(
18531856
np.vstack([sol.q for sol in solutions]),
18541857
np.array([sol.success for sol in solutions]),
18551858
[sol.reason for sol in solutions],

0 commit comments

Comments
 (0)