@@ -228,7 +228,7 @@ def ikine_a(self, T, config="lun"):
228
228
GTRI/ATRP/IIMB, Georgia Institute of Technology, 2/13/95
229
229
230
230
"""
231
- def ik3 (robot , T , config ):
231
+ def ik3 (robot , T , config = 'lun' ):
232
232
233
233
# solve for the first three joints
234
234
@@ -253,8 +253,10 @@ def ik3(robot, T, config):
253
253
r = np .sqrt (Px ** 2 + Py ** 2 )
254
254
if 'r' in config :
255
255
theta [0 ] = np .arctan2 (Py , Px ) + np .arcsin (d3 / r )
256
- else :
256
+ elif 'l' in config :
257
257
theta [0 ] = np .arctan2 (Py , Px ) + np .pi - np .arcsin (d3 / r )
258
+ else :
259
+ raise ValueError ('bad configuration string' )
258
260
259
261
# Solve for theta[1]
260
262
# V114 is defined in equation 43, p.39.
@@ -264,10 +266,12 @@ def ik3(robot, T, config):
264
266
# configuration parameter n2
265
267
if 'u' in config :
266
268
n2 = 1
267
- else :
269
+ elif 'd' in config :
268
270
n2 = - 1
271
+ else :
272
+ raise ValueError ('bad configuration string' )
269
273
270
- if 'r ' in config :
274
+ if 'l ' in config :
271
275
n2 = - n2
272
276
273
277
V114 = Px * np .cos (theta [0 ]) + Py * np .sin (theta [0 ])
@@ -300,3 +304,8 @@ def ik3(robot, T, config):
300
304
puma = Puma560 (symbolic = False )
301
305
print (puma )
302
306
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