def gui_command_cb(self, command): '''Callback for when a GUI command is received''' if (not self.arms.is_executing()): if (self.session.n_actions() > 0): if (command.command == GuiCommand.SWITCH_TO_ACTION): action_no = command.param self.session.switch_to_action(action_no, self.world.get_frame_list()) response = Response(Interaction.empty_response, [RobotSpeech.SWITCH_SKILL + str(action_no), GazeGoal.NOD]) response.respond() elif (command.command == GuiCommand.SELECT_ACTION_STEP): step_no = command.param self.session.select_action_step(step_no) rospy.loginfo('Selected action step ' + str(step_no)) else: rospy.logwarn('\033[32m This command (' + command.command + ') is unknown. \033[0m') else: response = Response(Interaction.empty_response, [RobotSpeech.ERROR_NO_SKILLS, GazeGoal.SHAKE]) response.respond() else: rospy.logwarn('Ignoring GUI command during execution: ' + command.command)
def speech_command_cb(self, command): '''Callback for when a speech command is received''' if command.command in self.responses.keys(): rospy.loginfo('\033[32m Calling response for command ' + command.command + '\033[0m') response = self.responses[command.command] if (not self.arms.is_executing() and not self._is_busy): response.respond() else: if command.command == Command.STOP_EXECUTION: response.respond() else: rospy.logwarn('Ignoring speech command during execution or busy: ' + command.command) else: switch_command = 'SWITCH_TO_ACTION' if (switch_command in command.command): action_no = command.command[ len(switch_command):len(command.command)] action_no = int(action_no) if (self.session.n_actions() > 0): self.session.switch_to_action(action_no, self.world.get_frame_list()) response = Response(self.default_response, [RobotSpeech.SWITCH_SKILL + str(action_no), GazeGoal.NOD]) else: response = Response(self.default_response, [RobotSpeech.ERROR_NO_SKILLS, GazeGoal.SHAKE]) response.respond() else: rospy.logwarn('\033[32m This command (' + command.command + ') is unknown. \033[0m')
def speech_command_cb(self, command): '''Callback for when a speech command is receieved''' if command.command in self.responses.keys(): rospy.loginfo('\033[32m Calling response for command ' + command.command + '\033[0m') response = self.responses[command.command] if (not self.arms.is_executing()): if (self._undo_function != None): response.respond() self._undo_function = None else: response.respond() else: if command.command == Command.STOP_EXECUTION: response.respond() else: rospy.logwarn('Ignoring speech command during execution: ' + command.command) else: switch_command = 'SWITCH_TO_ACTION' if (switch_command in command.command): action_no = command.command[ len(switch_command):len(command.command)] action_no = int(action_no) if (self.session.n_actions() > 0): self.session.switch_to_action(action_no, self.world.get_frame_list()) response = Response(Interaction.empty_response, [RobotSpeech.SWITCH_SKILL + str(action_no), GazeGoal.NOD]) else: response = Response(Interaction.empty_response, [RobotSpeech.ERROR_NO_SKILLS, GazeGoal.SHAKE]) response.respond() else: rospy.logwarn('\033[32m This command (' + command.command + ') is unknown. \033[0m')