@@ -60,9 +60,8 @@ def objective(self, trial):
60
60
self .reset ()
61
61
62
62
cost = 0
63
- # todo add scenarios where the speed command changes multiple times while the robot is already walking
64
63
# standing as first test, is not in loop as it will only be done once
65
- early_term , cost_try = self .evaluate_direction (0 , 0 , 0 , trial , 1 , 2 )
64
+ early_term , cost_try = self .evaluate_direction (0 , 0 , 0 , trial , 1 , 0 )
66
65
cost += cost_try
67
66
if early_term :
68
67
# terminate early and give 100 cost for each try left
@@ -256,9 +255,8 @@ def compute_cost(self, x, y, yaw):
256
255
cost = abs (current_pose [0 ] - correct_pose [0 ]) \
257
256
+ abs (current_pose [1 ] - correct_pose [1 ]) \
258
257
+ abs (current_pose [2 ] - correct_pose [
259
- 2 ]) * yaw_factor # todo take closest distance in cricle through 0 into account
258
+ 2 ]) * yaw_factor # todo take closest distance in circle through 0 into account
260
259
# method doesn't work for going forward and turning at the same times
261
- # todo better computation of correct end pose, maybe use foot position. wakling provides foot position
262
260
if yaw != 0 : # and (x != 0 or y != 0):
263
261
# just give 0 cost for surviving
264
262
cost = 0
@@ -327,7 +325,6 @@ def __init__(self, namespace, gui, walk_as_node, sim_type='pybullet'):
327
325
if sim_type == 'pybullet' :
328
326
self .sim = PybulletSim (self .namespace , gui )
329
327
elif sim_type == 'webots' :
330
- # todo
331
328
self .sim = WebotsSim (self .namespace , gui )
332
329
else :
333
330
print (f'sim type { sim_type } not known' )
@@ -337,7 +334,7 @@ def suggest_walk_params(self, trial):
337
334
338
335
339
336
class DarwinWalkOptimization (AbstractWalkOptimization ):
340
- def __init__ (self , namespace , gui , walk_as_node , sim_type = 'webots ' ):
337
+ def __init__ (self , namespace , gui , walk_as_node , sim_type = 'pybullet ' ):
341
338
super (DarwinWalkOptimization , self ).__init__ (namespace , 'darwin' , walk_as_node )
342
339
self .reset_height_offset = 0.09
343
340
self .directions = [[0.05 , 0 , 0 ],
@@ -355,6 +352,7 @@ def __init__(self, namespace, gui, walk_as_node, sim_type='webots'):
355
352
urdf_path = self .rospack .get_path ('darwin_description' ) + '/urdf/robot.urdf'
356
353
self .sim = PybulletSim (self .namespace , gui , urdf_path = urdf_path ,
357
354
foot_link_names = ['MP_ANKLE2_L' , 'MP_ANKLE2_R' ])
355
+ self .sim .set_joints_dict ({"LShoulderRoll" : 0.5 , "LElbow" : - 1.15 , "RShoulderRoll" : - 0.5 , "RElbow" : 1.15 })
358
356
elif sim_type == 'webots' :
359
357
self .sim = WebotsSim (self .namespace , gui )
360
358
else :
@@ -365,7 +363,7 @@ def suggest_walk_params(self, trial):
365
363
366
364
367
365
class OP3WalkOptimization (AbstractWalkOptimization ):
368
- def __init__ (self , namespace , gui , walk_as_node , sim_type = 'webots ' ):
366
+ def __init__ (self , namespace , gui , walk_as_node , sim_type = 'pybullet ' ):
369
367
super (OP3WalkOptimization , self ).__init__ (namespace , 'op3' , walk_as_node )
370
368
self .reset_height_offset = 0.12
371
369
self .directions = [[0.05 , 0 , 0 ],
@@ -393,7 +391,7 @@ def suggest_walk_params(self, trial):
393
391
394
392
395
393
class NaoWalkOptimization (AbstractWalkOptimization ):
396
- def __init__ (self , namespace , gui , walk_as_node , sim_type = 'webots ' ):
394
+ def __init__ (self , namespace , gui , walk_as_node , sim_type = 'pybullet ' ):
397
395
super (NaoWalkOptimization , self ).__init__ (namespace , 'nao' , walk_as_node )
398
396
self .reset_height_offset = 0.12
399
397
self .directions = [[0.05 , 0 , 0 ],
@@ -410,7 +408,7 @@ def __init__(self, namespace, gui, walk_as_node, sim_type='webots'):
410
408
if sim_type == 'pybullet' :
411
409
urdf_path = self .rospack .get_path ('nao_description' ) + '/urdf/robot.urdf'
412
410
self .sim = PybulletSim (self .namespace , gui , urdf_path = urdf_path ,
413
- foot_link_names = ['r_ank_roll_link ' , 'l_ank_roll_link ' ])
411
+ foot_link_names = ['l_ankle ' , 'r_ankle ' ])
414
412
elif sim_type == 'webots' :
415
413
self .sim = WebotsSim (self .namespace , gui )
416
414
else :
@@ -421,7 +419,7 @@ def suggest_walk_params(self, trial):
421
419
422
420
423
421
class ReemcWalkOptimization (AbstractWalkOptimization ):
424
- def __init__ (self , namespace , gui , walk_as_node , sim_type = 'webots ' ):
422
+ def __init__ (self , namespace , gui , walk_as_node , sim_type = 'pybullet ' ):
425
423
super (ReemcWalkOptimization , self ).__init__ (namespace , 'reemc' , walk_as_node )
426
424
self .reset_height_offset = 0.12
427
425
self .directions = [[0.05 , 0 , 0 ],
@@ -438,7 +436,7 @@ def __init__(self, namespace, gui, walk_as_node, sim_type='webots'):
438
436
if sim_type == 'pybullet' :
439
437
urdf_path = self .rospack .get_path ('reemc_description' ) + '/urdf/robot.urdf'
440
438
self .sim = PybulletSim (self .namespace , gui , urdf_path = urdf_path ,
441
- foot_link_names = ['r_ank_roll_link ' , 'l_ank_roll_link ' ])
439
+ foot_link_names = ['leg_left_6_link ' , 'leg_right_6_link ' ])
442
440
elif sim_type == 'webots' :
443
441
self .sim = WebotsSim (self .namespace , gui )
444
442
else :
@@ -449,7 +447,7 @@ def suggest_walk_params(self, trial):
449
447
450
448
451
449
class TalosWalkOptimization (AbstractWalkOptimization ):
452
- def __init__ (self , namespace , gui , walk_as_node , sim_type = 'webots ' ):
450
+ def __init__ (self , namespace , gui , walk_as_node , sim_type = 'pybullet ' ):
453
451
super (TalosWalkOptimization , self ).__init__ (namespace , 'talos' , walk_as_node )
454
452
self .reset_height_offset = 0.12
455
453
self .directions = [[0.05 , 0 , 0 ],
@@ -466,7 +464,7 @@ def __init__(self, namespace, gui, walk_as_node, sim_type='webots'):
466
464
if sim_type == 'pybullet' :
467
465
urdf_path = self .rospack .get_path ('talos_description' ) + '/urdf/robot.urdf'
468
466
self .sim = PybulletSim (self .namespace , gui , urdf_path = urdf_path ,
469
- foot_link_names = ['r_ank_roll_link ' , 'l_ank_roll_link ' ])
467
+ foot_link_names = ['leg_left_6_link ' , 'leg_right_6_link ' ])
470
468
elif sim_type == 'webots' :
471
469
self .sim = WebotsSim (self .namespace , gui )
472
470
else :
0 commit comments