8000 Fix bug in IK config handler · hanm2019/robotics-toolbox-python@499407e · GitHub
[go: up one dir, main page]

Skip to content

Commit 499407e

Browse files
committed
Fix bug in IK config handler
1 parent ff10c30 commit 499407e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

roboticstoolbox/models/DH/Puma560.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def ikine_a(self, T, config="lun"):
228228
GTRI/ATRP/IIMB, Georgia Institute of Technology, 2/13/95
229229
230230
"""
231-
def ik3(robot, T, config):
231+
def ik3(robot, T, config='lun'):
232232

233233
# solve for the first three joints
234234

@@ -253,8 +253,10 @@ def ik3(robot, T, config):
253253
r = np.sqrt(Px**2 + Py**2)
254254
if 'r' in config:
255255
theta[0] = np.arctan2(Py, Px) + np.arcsin(d3 / r)
256-
else:
256+
elif 'l' in config:
257257
theta[0] = np.arctan2(Py, Px) + np.pi - np.arcsin(d3 / r)
258+
else:
259+
raise ValueError('bad configuration string')
258260

259261
# Solve for theta[1]
260262
# V114 is defined in equation 43, p.39.
@@ -264,10 +266,12 @@ def ik3(robot, T, config):
264266
# configuration parameter n2
265267
if 'u' in config:
266268
n2 = 1
267-
else:
269+
elif 'd' in config:
268270
n2 = -1
271+
else:
272+
raise ValueError('bad configuration string')
269273

270-
if 'r' in config:
274+
if 'l' in config:
271275
n2 = -n2
272276

273277
V114 = Px * np.cos(theta[0]) + Py * np.sin(theta[0])
@@ -300,3 +304,8 @@ def ik3(robot, T, config):
300304
puma = Puma560(symbolic=False)
301305
print(puma)
302306
print(puma.dyntable())
307+
T = puma.fkine(puma.qn)
308+
print(puma.ikine_a(T, 'ru').q)
309+
print(puma.ikine_a(T, 'rd').q)
310+
qi = puma.ikine_a(T, 'rd').q
311+
puma.plot(qi)

0 commit comments

Comments
 (0)
0