示例#1
0
 def loop(self):
     """Advances to the next mode and performs the instruction when it is
     time (when the condition is met), otherwise does nothing."""
     BaseProgram.loop(self)
     if self.condition_satisfied():
         self.increment_mode()
         self.perform_instruction()
         return self.s
示例#2
0
 def __call__(self, command):
     base_response = BaseProgram.__call__(self, command)
     if base_response:
         return base_response
     return "unrecognized command"
示例#3
0
 def start(self):
     """Fixes the start time so that the pause doesn't count towards the
     elapsed time, and continues the previous motion of the robot."""
     BaseProgram.start(self)
     self.start_time += time.time() - self.pause_time
     self.perform_instruction()
示例#4
0
 def stop(self):
     """Record the time when the program is paused."""
     BaseProgram.stop(self)
     self.pause_time = time.time()
示例#5
0
 def reset(self):
     """Resets the program to the first mode."""
     BaseProgram.reset(self)
     self.mode_ind = -1
示例#6
0
 def __init__(self, seq):
     """Creates a program that interprets the given sequence."""
     BaseProgram.__init__(self)
     self.seq = seq
     self.build_maps()
     self.reset()