@@ -490,76 +490,6 @@ def update(self, t, states):
490490 return finished , 1
491491
492492
493- class SoTRal25 (SoTBase ):
494- def __init__ (self , config ):
495- super ().__init__ (config )
496- self .curr_task_id = 0
497- self .curr_task_num = 2
498- self .total_task_num = len (config ["tasks" ])
499-
500- # not really scalable
501- self .planners [1 ].set_base_planner (self .planners [0 ])
502-
503- def getPlanners (self , num_planners = 2 ):
504- # get the top #num_planners in the stack
505- ids = np .arange (self .curr_task_id , self .curr_task_id + self .curr_task_num )
506- ids %= self .total_task_num
507-
508- return [self .planners [id ] for id in ids ]
509-
510- def update (self , t , states ):
511- # check if current task is finished
512- planner = self .planners [self .curr_task_id ]
513- finished = False
514- if planner .type == "EE" :
515- finished = planner .checkFinished (t , states ["EE" ])
516- elif planner .type == "base" :
517- finished = planner .checkFinished (t , states ["base" ])
518-
519- if finished :
520- # if current task finished increment self.curr_task_id by 1
521- if self .curr_task_id == 0 :
522- self .curr_task_id = 2
523- # two tasks for odd number task id (EE task)
524- self .planners [self .curr_task_id ].regeneratePlan (states ["EE" ])
525- self .planners [
526- (self .curr_task_id + 1 ) % self .total_task_num
527- ].regeneratePlan (states ["base" ])
528- else :
529- self .curr_task_id = 0
530-
531- return finished , 0
532-
533- def print (self ):
534- self .logger .log (
535- "Currently at Task {} with Task num {}" .format (
536- self .curr_task_id , self .curr_task_num
537- )
538- )
539-
540-
541- class SoTRal25NavOnly (SoTBase ):
542- def __init__ (self , config ):
543- super ().__init__ (config )
544-
545- def getPlanners (self , num_planners = 1 ):
546- return self .planners
547-
548- def update (self , t , states ):
549- # check if current task is finished
550- planner = self .planners [0 ]
551- finished = False
552- if planner .type == "EE" :
553- finished = planner .checkFinished (t , states ["EE" ])
554- elif planner .type == "base" :
555- finished = planner .checkFinished (t , states ["base" ])
556-
557- if finished :
558- self .planners [0 ].regeneratePlan (states ["base" ])
559-
560- return finished , 0
561-
562-
563493if __name__ == "__main__" :
564494 config_path = "$PROJECTMM3D_HOME/experiments/config/sim/simulation.yaml"
565495 config = parsing .load_config (config_path )
0 commit comments