def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False num1 = random.randint(1, 4) if num1 == 1: text1 = "singe" mouvement = self._movem1 elif num1 == 2: text1 = "poulet" mouvement = self._movem2 elif num1 == 3: text1 = "nager" mouvement = self._movem3 elif num1 == 4: text1 = "manger" mouvement = self._movem4 else: text1 = "singe" mouvement = self._movem1 print (text1) print "lancer vrai4 si le patient répond bien, faux si il se trompe." text = "Devine ce que je mime." with open(self._move) as f: m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(0.5) self._speak.start(text) time.sleep(3) with open(mouvement) as f: m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start()
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False num1 = random.randint(1, 4) if num1 == 1: text1 = "singe" mouvement = self._movem1 elif num1 == 2: text1 = "poulet" mouvement = self._movem2 elif num1 == 3: text1 = "nager" mouvement = self._movem3 elif num1 == 4: text1 = "manger" mouvement = self._movem4 else: text1 = "singe" mouvement = self._movem1 print(text1) print "lancer vrai4 si le patient répond bien, faux si il se trompe." text = "Devine ce que je mime." with open(self._move) as f: m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(0.5) self._speak.start(text) time.sleep(3) with open(mouvement) as f: m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start()
def run(self): with open(self.path.format(self.record_name)) as f: move = Move.load(f) self.player = MovePlayer(self.robot, move, max_start_speed=0) self.player.start() self.player.wait_to_stop()
def run(self): try: self.robot.upper_body_idle_motion.stop() self.robot.torso_idle_motion.stop() # self.robot.head_idle_motion.stop() except: pass else: pass finally: pass # initialize the time variable t = time.time() # find the right move with open("./moves/" + self.move + ".move") as f: m = Move.load(f) # chargement du .move # start the move movey = MovePlayer(self.robot, m) movey.start() #time to start the move el = time.time() - t # taking into account the movement time in itself (pos_number * framerate) md = movey.duration() - 0.3 time.sleep(md) # sleeping the wanted duration
def run(self): with open(self._move) as f: m = Move.load(f) self._robot.compliant = False move_player = MovePlayer(self._robot, m) move_player.start()
def __init__(self, file): WalkerModule.WalkerModule.__init__(self) self.filename = file self.move = None #file should be recorded with correct frequency with open(self.filename ) as f: self.move = Move.load(f) self.init()
def openFile(): savedPositions = None try: with open(saved_positions_file ) as f: savedPositions = Move.load(f) savedPositions = savedPositions._positions except: savedPositions = [] return savedPositions
def openFile(): savedPositions = None try: with open(saved_positions_file) as f: savedPositions = Move.load(f) savedPositions = savedPositions._positions except: savedPositions = [] return savedPositions
def __init__(self, file): WalkerModule.WalkerModule.__init__(self) self.filename = file self.move = None #file should be recorded with correct frequency with open(self.filename) as f: self.move = Move.load(f) self.init()
def readSavedPositions(): savedPositions = None try: with open(saved_positions_file ) as f: savedPositions = Move.load(f) savedPositions = savedPositions._positions except: print "could not read file" savedPositions = [] return savedPositions
def start_move_player(self, move_name): """Move player need to have a move file <move_name.json> in th PATH to play it""" with open(move_name + '.record') as f: loaded_move = Move.load(f) move_name += '_player' player = MovePlayer(self.robot, loaded_move) self.robot.attach_primitive(player, move_name) player.start() player.wait_to_stop() return move_name
def readSavedPositions(): savedPositions = None try: with open(saved_positions_file) as f: savedPositions = Move.load(f) savedPositions = savedPositions._positions except: print "could not read file" savedPositions = [] return savedPositions
def run(self): move = '\home\poppy\resources\move\merciDeTaVisite.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("Maintenant il faut laisser la place aux autres, c’était bien sympa, je te remercie pour ta visite ! Je t’invite à remplir ce questionnaire, ça va beaucoup aider mes amis." ) move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\reponseSousmarins.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("Les sous-marins! J’aime cette blague pas toi?" ) move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\super.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("Super ! J’aimerais beaucoup aussi." ) move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\monnaiePoissons.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("Quelle monnaie utilise les poissons ?" ) move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = "\home\poppy\resources\move\devinette.move" with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("J’ai une devinette pour toi, ça te dis ?") move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\savoirPlus.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("Tu veux que je t’explique un peu plus ?") move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\devinette.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("J’ai une devinette pour toi, ça te dis ?") move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\explicationsPlus.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("Je serais là pour jouer avec les enfants, et pour les accompagner quand ils sont dans la chambre! Grace à moi ils pourront garder contact avec leur famille et leur amis!" ) move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\savoirPlus.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("Tu veux que je t’explique un peu plus ?" ) move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\commentTuTeSens.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("Et comment tu te sens quand tu parles à un robot ?") move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\quiJeSuis.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("Sais-tu qui je suis ?" ) move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\emotionsCommeToi.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("C’est intéressant, j’aimerai bien avoir des émotions comme toi." ) move_player = MovePlayer(self._robot, m) move_player.start()
def start(self): with open(self._move) as f : m = Move.load(f) move_player = MovePlayer(self.robot, m) with open(self._move2) as f : m = Move.load(f) move_player2 = MovePlayer(self.robot, m) move_player.start() move_player2.start() time.sleep(1.5) # print "1" # phrase="Je vais te parler de l’Hyperthyroïdie. Ne t’inquiète pas, ce n’est pas très compliqué ! Je vais t’expliquer ce que c’est, pourquoi ça arrive et comment les médecins le soignent." # self._speak.start(phrase) # print "2" # phrase="Dans ton cou, juste au-dessous de la pomme d’Adam, se trouve ta glande thyroïde. Cette glande aide à contrôler la vitesse à laquelle ton corps travaille. Elle le fait en envoyant un message à tes organes grâce à l’hormone Thyroxine." # print phrase # self._speak.start(phrase) # phrase="Si la glande thyroïde envoie trop de thyroxine, ton corps travaille trop vite. Si elle en envoie trop peu, ton corps travaille trop lentement. Pour que ton corps travaille bien, il te faut une quantité normale de thyroxine." # self._speak.start(phrase) # phrase="""Quand ta glande thyroïde produit trop de thyroxine, on appelle cela l’hyperthyroïdie.""" # self._speak.start(phrase) # phrase="""Les médecins peuvent diagnostiquer l’hyperthyroïdie grâce à un prélèvement de sang, qui leur permet de savoir quelle quantité d’hormones tu as.""" # self._speak.start(phrase) # phrase="""Pour traiter ton hyperthyroïdie, les médecins vont te prescrire des comprimés. Ces comprimés vont diminuer la quantité de tes hormones thyroïdiennes. Il est très important que tu prennes bien tes médicaments tous les jours.""" # self._speak.start(phrase) # phrase="""Si, après quelques années, les médicaments ne suffisent pas pour te guérir, il est possible que tu reviennes pour un nouveau traitement.""" # self._speak.start(phrase) # phrase="""J’espère que tu comprends mieux l’hyperthyroïdie maintenant. Si tu as des questions, ou des choses que tu n’as pas bien comprises, n’hésite pas à en parler à ton médecin ou à une autre personne de l’hôpital. Ils pourront t’aider et t’expliquer.""" # self._speak.start(phrase) self._saytext.start("textToSpeech/disc_med.txt")
def run(self): move = '\home\poppy\resources\move\commentTuTeSens.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("Et comment tu te sens quand tu parles à un robot ?" ) move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\explications.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("Je suis le nouveau compagnon des enfants dans les hôpitaux, je serais là pour participer à leur bonheur, avec moi tu vas t’amuser !" ) move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\quiJeSuis.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("Sais-tu qui je suis ?") move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\\parlerAvecMoi.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start("Tu serais content de parler avec moi ?" ) move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = "\home\poppy\resources\move\premiereFoisRobot.move" with open(move) as f: m = Move.load(f) self._robot.compliant = False # speak.start("C’est gentil de passer me voir, c’est la première fois que tu parles avec un robot?") # move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\emotionsCommeToi.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start( "C’est intéressant, j’aimerai bien avoir des émotions comme toi.") move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\explicationsPlus.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False speak.start( "Je serais là pour jouer avec les enfants, et pour les accompagner quand ils sont dans la chambre! Grace à moi ils pourront garder contact avec leur famille et leur amis!" ) move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): move = '\home\poppy\resources\move\bonjourCaVa.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False # speak.start("Bonjour, je me présente je m’appelle Cherry ! Comment t’appelles tu ?" ) # move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False with open(self._move) as f : m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(1.5) self._speak.start("Bien joué! On croirait presque que tu lis dans mes électrons!")
def run(self): move = '\home\poppy\resources\move\premiereFoisRobot.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False # speak.start( "C’est gentil de passer me voir, c’est la première fois que tu parles avec un robot?" ) # move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False filename = '../utils/temp.mp3' with open(self._move) as f : m = Move.load(f) tts = gTTS(self._text, lang='fr') tts.save(filename) call(["play", '../utils/temp.mp3'])
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False filename = '../utils/temp.mp3' with open(self._move) as f: m = Move.load(f) tts = gTTS(self._text, lang='fr') tts.save(filename) call(["play", '../utils/temp.mp3'])
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False with open(self._move) as f: m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(1.5) self._speak.start("Bravo! Eh oui je suis un robot.")
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False with open(self._move) as f : m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(2) self._speak.start("Non, ce n'est pas ça. Essaye encore!")
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False with open(self._move) as f: m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(1.5) self._speak.start("Dommage, mon nombre est plus petit. Essaye encore!")
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False with open(self._move) as f : m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(1.5) self._speak.start("Hé non, mon nombre est plus grand. Essaye encore!")
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False with open(self._move) as f: m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(2) self._speak.start("Non, ce n'est pas ça. Essaye encore!")
def run(self): move = '\home\poppy\resources\move\bonjourCaVa.move' with open(move) as f: m = Move.load(f) self._robot.compliant = False # speak.start( "Bonjour, je me présente je m’appelle Cherry ! Comment t’appelles tu ?" ) # move_player = MovePlayer(self._robot, m) move_player.start()
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False with open(self._move) as f: m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(1.5) self._speak.start("Bravo! Tu t'y connais en orthographe!")
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False with open(self._move) as f : m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(1.5) self._speak.start("Bravo! Quel génie mathématique!")
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False with open(self._move) as f : m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(1.5) self._speak.start("Bravo! Tu t'y connais en orthographe!")
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False with open(self._move) as f: m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(1.5) self._speak.start( "Bien joué! On croirait presque que tu lis dans mes électrons!")
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False text = "Bonjour, " + self._name + ". Comment vas tu aujourd'hui?" with open(self._move) as f: m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(1.5) self._speak.start(text)
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False text = "Bonjour, " + self._name + ". Comment vas tu aujourd'hui?" with open(self._move) as f : m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(1.5) self._speak.start(text)
def start_move_player(self, move_name, speed=1.0, backwards=False): """Move player need to have a move file <move_name.record> in the working directory to play it""" # check if running try: player = getattr(self.robot, '_{}_player'.format(move_name)) if player.running: return except AttributeError: pass # if not running, override the play primitive with open('{}.record'.format(move_name)) as f: loaded_move = Move.load(f) player = MovePlayer(self.robot, loaded_move, play_speed=speed, backwards=backwards) self.robot.attach_primitive(player, '_{}_player'.format(move_name)) player.start() return player.duration()
def run(self): ### Geste poppy = self.robot for m in poppy.motors: m.compliant = False with open(self._move) as f: m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(0.5) ### Son self._speak.start(self._text)
def run(self): poppy = self.robot for m in poppy.motors: m.compliant = False num = random.randint(1, 100) print(num) print "lancer plus, moins ou egal suivant la réponse du patient" with open(self._move) as f: m = Move.load(f) move_player = MovePlayer(self.robot, m) move_player.start() time.sleep(0.5) self._speak.start( "Essaye de deviner à quel nombre je pense. Il est compris entre 1 et 100" )