def send_motion_message(motion): """ Publish JiboAction do motion message """ #print 'sending motion message: %s' % motion print 'sending motion message' msg = JiboAction() msg.do_motion = True msg.motion = motion pub_re.publish(msg)
def send_speech_message(speech): """ Publish JiboAction playback audio message """ #print '\nsending speech message: %s' % speech print '\nsending speech message' msg = JiboAction() msg.do_sound_playback = True msg.wav_filename = speech pub_re.publish(msg)
def send_lookat_message(lookat): """ Publish JiboAction lookat message """ #print 'sending lookat message: %s' % lookat print 'sending lookat message' msg = JiboAction() msg.do_look_at = True msg.look_at = lookat pub_re.publish(msg) rospy.loginfo(msg)
def send_tts_message(): #not working """ Publish JiboAction tts message """ #print '\nsending speech message: %s' % speech print '\nsending tts message' msg = JiboAction() msg.do_text_to_speech = True msg.tts_text = "hello" pub_re.publish(msg) rospy.loginfo(msg)
def send_robot_anim_transition_cmd(tran): msg = JiboAction() # add header msg.header = Header() msg.header.stamp = rospy.Time.now() msg.do_anim_transition = True msg.anim_transition = tran robot_commander.publish(msg) rospy.loginfo(msg)
def send_robot_anim_transition_cmd(self, tran): msg = JiboAction() # add header msg.header = Header() msg.header.stamp = rospy.Time.now() msg.do_anim_transition = True msg.anim_transition = tran self.robot_commander.publish(msg) rospy.loginfo(msg) # def main(): # new_rule = "TopRule = $* (love candy){%slotAction='world'%} | (love choco){%slotAction='mars'%} $*;" # mySender = RobotSender() # mySender.start_robot_publisher() # mySender.send_robot_motion_cmd('reset.keys') # # Animation transition mode testing # mySender.send_robot_anim_transition_cmd(JiboAction.ANIMTRANS_KEEP_LASTFRAME) # mySender.send_robot_motion_cmd("spider.keys") # mySender.send_robot_motion_cmd("snail.keys") # mySender.send_robot_motion_cmd("snail.keys") # mySender.send_robot_motion_cmd("snail.keys") # time.sleep(5) # mySender.send_robot_anim_transition_cmd(JiboAction.ANIMTRANS_RESET) # # Send TTS # time.sleep(5) # mySender.send_robot_tts_cmd('Tell me something') # # Start listening # mySender.send_robot_asr_cmd(JiboAsrCommand.START, False, True, new_rule) # time.sleep(10) # # Play audio # mySender.send_robot_audio_cmd(JiboAction.RING_IN_SOUND) # time.sleep(20) # # Stop listening # mySender.send_robot_asr_cmd(JiboAsrCommand.STOP) # # Motion and Audio command # mySender.send_robot_audio_motion_cmd("instruments/Blocks.mp3", "heart-beat.keys") # # LED color # mySender.send_robot_led_cmd(0,1,0) # rospy.spin() # if __name__ == '__main__': # main()
def send_robot_volume_cmd(self, v): """ send LED ring color Command to Jibo """ msg = JiboAction() # add header msg.header = Header() msg.header.stamp = rospy.Time.now() msg.do_volume = True msg.volume = v self.robot_commander.publish(msg) rospy.loginfo(msg)
def send_robot_led_cmd(self, r, g, b): """ send LED ring color Command to Jibo """ msg = JiboAction() # add header msg.header = Header() msg.header.stamp = rospy.Time.now() msg.do_led = True color = JiboVec3(r, g, b) msg.led_color = color self.robot_commander.publish(msg) rospy.loginfo(msg)
def send_speech_motion_message(speech, motion): """ Publish JiboAction playback audio message """ print '\nsending speech and motion message' msg = JiboAction() msg.do_sound_playback = True msg.wav_filename = speech msg.do_motion = True msg.motion = motion pub_re.publish(msg)
def send_robot_motion_cmd(command): msg = JiboAction() # add header msg.header = Header() msg.header.stamp = rospy.Time.now() msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.motion = command jibo_publisher.publish(msg)
def send_robot_tts_cmd(text): msg = JiboAction() # add header msg.header = Header() msg.header.stamp = rospy.Time.now() msg.do_motion = False msg.do_tts = True msg.do_lookat = False msg.tts_text = text jibo_publisher.publish(msg)
def send_robot_audio_cmd(self, audio_command): """ send a Motion Command to Jibo """ msg = JiboAction() # add header msg.header = Header() msg.header.stamp = rospy.Time.now() msg.do_motion = False msg.do_tts = False msg.do_lookat = False msg.do_sound_playback = True msg.audio_filename = audio_command self.robot_commander.publish(msg) rospy.loginfo(msg)
def send_robot_tts_cmd(self, text, *args): """ send a Motion Command to Jibo """ msg = JiboAction() # add header msg.header = Header() msg.header.stamp = rospy.Time.now() msg.do_motion = False msg.do_tts = True msg.do_lookat = False msg.tts_text = text self.robot_commander.publish(msg)
def send_robot_audio_motion_cmd(self, a, m): """ send LED ring color Command to Jibo """ msg = JiboAction() # add header msg.header = Header() msg.header.stamp = rospy.Time.now() msg.do_sound_playback = True msg.do_motion = True msg.audio_filename = a msg.motion = m self.robot_commander.publish(msg) rospy.loginfo(msg)
def send_robot_motion_cmd(self, command): """ send a Motion Command to Jibo """ msg = JiboAction() # add header msg.header = Header() msg.header.stamp = rospy.Time.now() msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.motion = command self.robot_commander.publish(msg) rospy.loginfo(msg)
def send_robot_tts_cmd(self, text): """ send a Motion Command to Jibo """ msg = JiboAction() # add header msg.header = Header() msg.header.stamp = rospy.Time.now() msg.do_motion = False msg.do_tts = True msg.do_lookat = False msg.tts_text = text self.robot_commander.publish(msg) rospy.loginfo(msg) print("\nSent TTS message: ", text)
def send_robot_lookat_cmd(self, x, y, z): """ send a Motion Command to Jibo """ msg = JiboAction() # add header msg.header = Header() msg.header.stamp = rospy.Time.now() msg.do_motion = False msg.do_tts = False msg.do_lookat = True position = JiboVec3(x, y, z) msg.look_at = position self.robot_commander.publish(msg) rospy.loginfo(msg)
def send_robot_motion_cmd(command): """ send a Motion Command to Jibo """ msg = JiboAction() # add header msg.header = Header() msg.header.stamp = rospy.Time.now() msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.motion = command robot_commander.publish(msg) rospy.loginfo(msg)
def get_msg_from_behavior(command, *args): #pylint: disable=too-many-branches, too-many-statements msg = JiboAction() msg.header = Header() msg.header.stamp = rospy.Time.now() if command == RobotBehaviors.LOOK_AT_TABLET: msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.do_sound_playback = False msg.motion = JiboAction.LOOK_DOWN elif command == RobotBehaviors.LOOK_CENTER: msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.do_sound_playback = False msg.motion = JiboAction.DEFAULT elif command == RobotBehaviors.SAY_HI: msg.do_sound_playback = True msg.audio_filename = "SSA_hello.wav" elif command == RobotBehaviors.RING_ANSWER_CORRECT: msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.do_sound_playback = False msg.motion = JiboAction.RING_IN_ANIM elif command == RobotBehaviors.LATE_RING: msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.do_sound_playback = False msg.motion = JiboAction.RING_IN_ANIM elif command == RobotBehaviors.PRONOUNCE_CORRECT: msg.do_motion = False msg.do_tts = True msg.do_lookat = False msg.tts_text = args[0][0] print(args[0][0]) elif command == RobotBehaviors.PRONOUNCE_WRONG_SOUND: msg.do_motion = False msg.do_tts = False msg.do_lookat = False msg.do_sound_playback = True num = randint(0, 2) if num == 0: msg.audio_filename = "SSA_disappointed.m4a" elif num == 1: msg.audio_filename = "SSA_wrong.m4a" elif num == 2: msg.audio_filename = "SSA_wompwomp.m4a" elif command == RobotBehaviors.PRONOUNCE_WRONG_SPEECH: msg.do_motion = False msg.do_tts = True msg.do_lookat = False msg.do_sound_playback = False num = randint(0, 3) if num == 0: msg.tts_text = "gee I don't know" elif num == 1: msg.tts_text = "wow I'm not sure about this one" elif num == 2: msg.tts_text = "I don't know this one" elif num == 3: msg.tts_text = "I don't know this one" elif command == RobotBehaviors.REACT_ROBOT_CORRECT: msg.do_motion = True msg.do_tts = False msg.do_lookat = False num = randint(0, 1) if num == 0: msg.motion = "Misc/Eye_to_Happy_01.keys" elif num == 1: msg.motion = "Misc/Eye_to_Happy_02.keys" elif command == RobotBehaviors.REACT_ROBOT_WRONG: msg.do_sound_playback = False msg.do_tts = False msg.do_lookat = False msg.do_motion = True num = randint(0, 2) if num == 0: msg.motion = "Misc/Eye_Sad_03_01.keys" elif num == 1: msg.motion = "Misc/Eye_Sad_03_02.keys" elif num == 2: msg.do_motion = True msg.motion = "Misc/Frustrated_01_04.keys" elif command == RobotBehaviors.REACT_PLAYER_CORRECT: msg.do_motion = True msg.do_tts = False msg.do_lookat = False num = randint(0, 1) if num == 0: msg.motion = "Misc/Eye_to_Happy_01.keys" elif num == 1: msg.motion = "Misc/Eye_to_Happy_02.keys" elif command == RobotBehaviors.REACT_PLAYER_WRONG: msg.do_sound_playback = False msg.do_tts = False msg.do_lookat = False msg.do_motion = True num = randint(0, 2) if num == 0: msg.motion = "Misc/Eye_Sad_03_01.keys" elif num == 1: msg.motion = "Misc/Eye_Sad_03_02.keys" elif num == 2: msg.do_motion = True msg.motion = "Misc/Frustrated_01_04.keys" elif command == RobotBehaviors.REACT_TO_BEAT_CORRECT: msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.do_sound_playback = False msg.motion = "Misc/Frustrated_01_04.keys" elif command == RobotBehaviors.REACT_TO_BEAT_WRONG: msg.do_motion = False msg.do_tts = False msg.do_lookat = False msg.do_sound_playback = True msg.audio_filename = "SSA_laugh.m4a" elif command == RobotBehaviors.WIN_MOTION: msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.motion = JiboAction.HAPPY_GO_LUCKY_DANCE elif command == RobotBehaviors.WIN_SPEECH: msg.do_motion = False msg.do_tts = True msg.do_lookat = False msg.tts_text = "I win I win I win I win I win" elif command == RobotBehaviors.LOSE_MOTION: msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.motion = "Misc/Sad_03.keys" elif command == RobotBehaviors.LOSE_SPEECH: msg.do_motion = False msg.do_tts = True msg.do_lookat = False msg.tts_text = "You beat me. I'll try to do better next time" elif command == RobotBehaviors.EYE_FIDGET: msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.motion = JiboAction.EYE_FIDGET elif command == RobotBehaviors.REACT_TO_BEAT: msg.do_motion = True msg.do_lookat = False msg.motion = "Misc/Frustrated_01_04.keys" elif command == RobotBehaviors.PLAYER_RING_PROMPT: msg.do_motion = False msg.do_tts = False msg.do_lookat = False msg.do_sound_playback = True msg.audio_filename = "SSA_prompt.m4a" return msg
def get_msg_from_behavior(command, *args): #pylint: disable=too-many-branches, too-many-statements msg = JiboAction() msg.header = Header() msg.header.stamp = rospy.Time.now() if command == RobotBehaviors.LOOK_AT_TABLET: msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.do_sound_playback = False msg.motion = JiboAction.LOOK_DOWN elif command == RobotBehaviors.LOOK_CENTER: msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.do_sound_playback = False msg.motion = JiboAction.DEFAULT elif command == RobotBehaviors.WIN_SPEECH: msg.do_motion = False msg.do_tts = True msg.do_lookat = False msg.tts_text = "I win I win I win" elif command == RobotBehaviors.ROBOT_TURN_SPEECH: msg.do_motion = False msg.do_tts = True msg.do_lookat = False msg.tts_text = "It is my turn now" elif command == RobotBehaviors.RING_ANSWER_CORRECT: msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.do_sound_playback = False msg.motion = JiboAction.RING_IN_ANIM # elif command == RobotBehaviors.LATE_RING: # msg.do_motion = True # msg.do_tts = False # msg.do_lookat = False # msg.do_sound_playback = False # msg.motion = JiboAction.RING_IN_ANIM elif command == RobotBehaviors.PRONOUNCE_CORRECT: msg.do_motion = False msg.do_tts = True msg.do_lookat = False msg.tts_text = args[0][0] print(args[0][0]) elif command == RobotBehaviors.REACT_CHILD_ANSWER_WRONG: msg.do_motion = False msg.do_tts = False msg.do_lookat = False msg.do_sound_playback = True msg.audio_filename = "SSA_disappointed.m4a" # elif command == RobotBehaviors.PRONOUNCE_WRONG_SPEECH: # msg.do_motion = False # msg.do_tts = True # msg.do_lookat = False # msg.do_sound_playback = False # msg.tts_text = "I dont know this one" elif command == RobotBehaviors.REACT_CHILD_ANSWER_CORRECT: msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.motion = "Misc/Eye_to_Happy_01.keys" # elif command == RobotBehaviors.REACT_ANSWER_WRONG: # msg.do_motion = False # msg.do_tts = False # msg.do_lookat = False # msg.do_sound_playback = True # msg.audio_filename = "SSA_disappointed.m4a" # elif command == RobotBehaviors.REACT_TO_BEAT_CORRECT: # msg.do_motion = True # msg.do_tts = False # msg.do_lookat = False # msg.do_sound_playback = False # msg.motion = "Misc/Frustrated_01_04.keys" elif command == RobotBehaviors.REACT_GAME_START: msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.motion = "Misc/Eye_to_Happy_01.keys" elif command == RobotBehaviors.REACT_GAME_START2: msg.do_motion = False msg.do_tts = False msg.do_lookat = False msg.do_sound_playback = True msg.audio_filename = "SSA_laugh.m4a" elif command == RobotBehaviors.WIN_MOTION: msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.motion = JiboAction.HAPPY_GO_LUCKY_DANCE # elif command == RobotBehaviors.LOSE_MOTION: # msg.do_motion = True # msg.do_tts = False # msg.do_lookat = False # msg.motion = JiboAction.EMOJI_RAINCLOUD # elif command == RobotBehaviors.LOSE_SPEECH: # msg.do_motion = False # msg.do_tts = True # msg.do_lookat = False # msg.tts_text = "I lost. Oh well. I'll beat you next time" elif command == RobotBehaviors.EYE_FIDGET: msg.do_motion = True msg.do_tts = False msg.do_lookat = False msg.motion = JiboAction.EYE_FIDGET # elif command == RobotBehaviors.REACT_TO_BEAT: # msg.do_motion = True # msg.do_lookat = False # msg.motion = "Misc/Frustrated_01_04.keys" # elif command == RobotBehaviors.PLAYER_RING_PROMPT: # msg.do_motion = False # msg.do_tts = False # msg.do_lookat = False # msg.do_sound_playback = True # msg.audio_filename = "SSA_prompt.m4a" return msg