def Task(self): comments = [ "You are a good teacher", "You look nice today", "I like bananas", "My name is Gemini"] time.sleep(self.wait_time_) ActionProcess('', LookCenter()).Run() time.sleep(self.wait_time_) ActionProcess('', Nod()).Run() random_comment = random.randint(0,len(comments) - 1) ActionProcess('', Speak(150, 50, comments[random_comment])).Run() time.sleep(self.wait_time_) ActionProcess('', Nod()).Run()
def main(): global g_interrupted g_interrupted = True while g_interrupted: g_interrupted = False speak_action = Speak(150, 50, "please don't interrupt me i really want to finish" \ "this sentence okay good it worked") speak_action.OnInterrupt(on_interrupt) ActionProcess('speak_action_process', speak_action).Run()
def Task(self): print("wait a little bit, then say something to begin") ActionProcess('', WaitForResourceInterrupted('floor')).Run() ActionProcess('', Comment()).Run() while len(self.objects_) > 0: objects_available = [] for obj in self.objects_: if ResourceControllerApi.CheckGuard('free', 'object_' + obj): objects_available.append(obj) if len(objects_available) > 0: print("Found available object") obj = objects_available[random.randint( 0, len(objects_available) - 1)] ask_about_object = AskAboutObject(obj) ask_about_object.OnInterrupt(on_interrupt) self.interrupted_ = False ActionProcess('', ask_about_object).Run() if not self.interrupted_: self.objects_.remove(obj) else: print("No available object") ActionProcess('', Comment()).Run()
def main(): global do_ee382v_experiment do_ee382v_experiment = DoEE382VExperiment() ActionProcess('', do_ee382v_experiment).Run()
def on_interrupt(action): global do_ee382v_experiment do_ee382v_experiment.SetInterrupted(True) ActionProcess('', LookCenter()).Run()
def Task(self): bowl_phrases = [ " is full", " is blue", " can hold things", " can hold food", " can be full", " can hold soup" ] banana_phrases = [ " is yellow", " can be peeled", " is a vegetable", " is something I can eat", " is liked by monkeys", " is sour" ] mug_phrases = [ " is full", " is blue", " can hold tea", " can hold liquid", " has a handle", " might be hot" ] tongs_phrases = [ " can grab things", " are metal", " are plastic", " are purple", " are black and silver", " can grab food" ] pitcher_phrases = [ " can be poured", " is metal", " is black", " is blue", " can hold tea", " is plastic" ] sugar_phrases = [ " is sweet", " is salty", " is black", " is for dessert", " has grains", " is blue" ] time.sleep(self.wait_time_) ActionProcess('', LookAtObject(self.object_name_)).Run() ActionProcess( '', Speak(150, 50, "I know some things about the " + self.object_name_)).Run() time.sleep(self.wait_time_) phrases_used = [] for i in range(3): random_phrase = random.randint(0, 5) while (random_phrase in phrases_used): random_phrase = random.randint(0, 5) phrases_used.append(random_phrase) phrase = "" if (self.object_name_ == 'bowl'): phrase = "The " + self.object_name_ + bowl_phrases[ random_phrase] elif (self.object_name_ == 'banana'): phrase = "The " + self.object_name_ + banana_phrases[ random_phrase] elif (self.object_name_ == 'mug'): phrase = "The " + self.object_name_ + mug_phrases[random_phrase] elif (self.object_name_ == 'tongs'): phrase = "The " + self.object_name_ + tongs_phrases[ random_phrase] elif (self.object_name_ == 'pitcher'): phrase = "The " + self.object_name_ + pitcher_phrases[ random_phrase] elif (self.object_name_ == 'sugar'): phrase = "The " + self.object_name_ + sugar_phrases[ random_phrase] ActionProcess('', Speak(150, 50, phrase)).Run() time.sleep(self.wait_time_) ActionProcess('', LookCenter()).Run()
def main(): ActionProcess('', AskAboutObject('mug')).Run()
def main(): point_at_object_action = PointAtObject('mug') action_process = ActionProcess('point_at_ketchup_action_process', point_at_object_action) action_process.Run()
def main(): ActionProcess('', Comment()).Run()