コード例 #1
0
ファイル: mime.py プロジェクト: jerome-guichard/primitiveWS
    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()
コード例 #2
0
ファイル: mime.py プロジェクト: GregoireMelin/primitiveWS
    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()
コード例 #3
0
ファイル: record.py プロジェクト: ericyao2013/ROBOT-reachy
    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()
コード例 #4
0
ファイル: movePlayer.py プロジェクト: Cherry-project/robot
    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
コード例 #5
0
ファイル: launchMove.py プロジェクト: Tsumenokage/primitiveWS
    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()
コード例 #6
0
ファイル: launchMove.py プロジェクト: Andylaux/primitiveWS
    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()
コード例 #7
0
    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()
コード例 #8
0
def openFile():
    savedPositions = None
    try:
        with open(saved_positions_file ) as f:
            savedPositions = Move.load(f)
            savedPositions = savedPositions._positions
    except:
        savedPositions = []
        
    return savedPositions
コード例 #9
0
def openFile():
    savedPositions = None
    try:
        with open(saved_positions_file) as f:
            savedPositions = Move.load(f)
            savedPositions = savedPositions._positions
    except:
        savedPositions = []

    return savedPositions
コード例 #10
0
    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()
コード例 #11
0
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
コード例 #12
0
 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
コード例 #13
0
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
コード例 #14
0
 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()
コード例 #15
0
 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()
コード例 #16
0
 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()
コード例 #17
0
 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()
コード例 #18
0
    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()
コード例 #19
0
    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()
コード例 #20
0
    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()
コード例 #21
0
 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()
コード例 #22
0
ファイル: savoirPlus.py プロジェクト: Tsumenokage/primitiveWS
 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()
コード例 #23
0
    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()
コード例 #24
0
ファイル: quiJeSuis.py プロジェクト: Tsumenokage/primitiveWS
 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()
コード例 #25
0
 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()
コード例 #26
0
ファイル: disc_med.py プロジェクト: GregoireMelin/primitiveWS
    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")
コード例 #27
0
 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()
コード例 #28
0
 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()
コード例 #29
0
    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()
コード例 #30
0
 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()
コード例 #31
0
    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()
コード例 #32
0
    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()
コード例 #33
0
    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()
コード例 #34
0
 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()
             
コード例 #35
0
ファイル: egal.py プロジェクト: Tsumenokage/primitiveWS
    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!")
コード例 #36
0
    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()
コード例 #37
0
ファイル: speech.py プロジェクト: Tsumenokage/primitiveWS
    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'])
コード例 #38
0
    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'])
コード例 #39
0
ファイル: vrai2.py プロジェクト: jerome-guichard/primitiveWS
    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.")
コード例 #40
0
ファイル: vrai2.py プロジェクト: GregoireMelin/primitiveWS
    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.")
コード例 #41
0
ファイル: faux.py プロジェクト: Tsumenokage/primitiveWS
    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!")
コード例 #42
0
    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!")
コード例 #43
0
ファイル: plus.py プロジェクト: Tsumenokage/primitiveWS
    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!")
コード例 #44
0
    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!")
コード例 #45
0
    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()
コード例 #46
0
ファイル: vrai3.py プロジェクト: GregoireMelin/primitiveWS
    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!")
コード例 #47
0
ファイル: vrai1.py プロジェクト: Tsumenokage/primitiveWS
    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!")
コード例 #48
0
ファイル: vrai3.py プロジェクト: Tsumenokage/primitiveWS
    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!")
コード例 #49
0
    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!")
コード例 #50
0
    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)
コード例 #51
0
ファイル: say_hello.py プロジェクト: Tsumenokage/primitiveWS
    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)
コード例 #52
0
    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()
コード例 #53
0
    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)
コード例 #54
0
    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"
        )