def asr_result(self, asr, text, uttid): """ This function is called when pocketsphinx gets a full result (spoken command with a pause) """ global flagRecActive if flagRecActive == False : if text == "MOFRERE" : #os.system('aplay ~/Documents/voiceRecoTest/audio/moussa/yeahMan.wav') print "\n\nmon frere detected!\n\n" print "\n\nreco activee !\n\n" flagRecActive = True else : flagRecActive = False print "\n\naction comprise, reco desactivee !\n\n" '''r = requests.post("http://192.168.200.111:8080/textAnalyzer/text", data=text) print(r.status_code, r.reason) if r.status_code != 200: print("erreur de comprehension") else :''' print("ta mere ca marche !") generalPurposeCmd = GeneralPurposeCmd() generalPurposeCmd.Person = "Samy" generalPurposeCmd.Instruction = "LIGHT ON" generalPurposeCmd.Location = "KITCHEN" generalPurposeCmd.Type = "type" #generalPurposeCmd.Date = "???" pub = rospy.Publisher('publication', GeneralPurposeCmd, queue_size=10) pub.publish(generalPurposeCmd) self.final_cb(self.name, uttid, text)
def talker(): pub = rospy.Publisher('chatter', GeneralPurposeCmd, queue_size=10) rospy.init_node('talker', anonymous=True) while 1: generalPurposeCmd = GeneralPurposeCmd() generalPurposeCmd.Person = raw_input("Person? ") instruction = raw_input("Instruction? ") generalPurposeCmd.Instruction = instruction location = raw_input("Location? ") generalPurposeCmd.Location = location type1 = raw_input("Type? ") generalPurposeCmd.Type = type1 time = raw_input("Time? ") generalPurposeCmd.Time = time pub = rospy.Publisher('publication', GeneralPurposeCmd, queue_size=10) pub.publish(generalPurposeCmd)