Example #1
0
    def __init__(self):
        # TODO: Check whether the tool is early or on time
        rand = random.choice([0, 1, 2])
        if rand == 0:
            publish_state_update(YEETBotState.RECEIVING_TOOL_EARLY)
        else:
            publish_state_update(YEETBotState.RECEIVING_TOOL_ON_TIME)

        user_interface.reset()

        tool = user_interface.tool_requested
        if (tool != 'pliers' and tool != 'screw_driver'
                and tool != 'wire_strippers' and tool != 'vernier_calipers'):
            raise RuntimeError("Unknown tool {}".format(tool))

        speech_msg = String()
        if item_database.is_tool_missing(tool):
            speech_msg.data = "Please return the {} to the drawer that I am opening for you.".format(
                tool.replace('_', ' '))
            item_database.change_drawer_state(tool, True)
            self.false_request = False
        else:
            speech_msg.data = "I'm not missing any of those!"
            self.false_request = True

        text_msg_pub.publish(speech_msg)

        self.tool = tool

        user_interface.tool_requested = ''
        user_interface.user_requested_borrow = False

        self.time_started = rospy.Time.now()
Example #2
0
    def __init__(self):
        publish_state_update(YEETBotState.GIVING_TOOL)

        user_interface.reset()

        tool = user_interface.tool_requested
        if (tool != 'pliers' and tool != 'screw_driver'
                and tool != 'wire_strippers' and tool != 'vernier_calipers'):
            raise RuntimeError("Unknown tool {}".format(tool))

        speech_msg = String()
        if item_database.contains_tool(tool):
            speech_msg.data = "Please take the {} from the drawer that I am opening for you.".format(
                tool.replace('_', ' '))
            item_database.change_drawer_state(tool, True)
            self.false_request = False
        else:
            speech_msg.data = "I'm sorry, I don't have that tool in stock. Perhaps you could return it to me?"
            self.false_request = True

        text_msg_pub.publish(speech_msg)

        self.tool = tool

        user_interface.tool_requested = ''
        user_interface.user_requested_borrow = False

        self.time_started = rospy.Time.now()
Example #3
0
    def next(self, input_array):
        if input_array['request_verified'] == 1:
            if self.request_type == 'lend':
                # Reset the flag
                user_interface.user_requested_borrow = False
                return LendTool()
            elif self.request_type == 'return':
                # Reset the flag
                user_interface.user_requested_return = False
                return ReturnTool()
            else:
                print "Request is verified but we don't know which type of request we are? {}".format(
                    self.request_type)
                raise NotImplementedError

        if self.request_type != 'lend' and self.request_type != 'return':
            speech_msg = String()
            if input_array['request'] == 'lend':
                self.request_type = 'lend'
                speech_msg.data = "Which tool would you like to borrow?"
                user_interface.borrow_choices()
            elif input_array['request'] == 'return':
                self.request_type = 'return'
                speech_msg.data = "Which tool would you like to return?"
                user_interface.return_choices()
            text_msg_pub.publish(speech_msg)
        return self
Example #4
0
    def __init__(self):
        (target, self.id) = self.calculate_target_pose()
        rospy.logerr(target)
        super(TravelToRequest, self).__init__(goal=target)

        speech_msg = String()
        speech_msg.data = "I'm on my way to help you! Please don't move too much or I might get lost..."
        text_msg_pub.publish(speech_msg)
Example #5
0
    def run(self):
        super(ForceReturn, self).run()
        if self.state == navigation_interface.ARRIVED:
            speech_msg = String()
            speech_msg.data = "I am looking for my " + self.tool + ". Please return it to me."
            text_msg_pub.publish(speech_msg)

        return "ForceReturn"
Example #6
0
    def __init__(self):
        publish_state_update(YEETBotState.IDLE)

        speech_msg = String()
        speech_msg.data = "Hello, I am yeetbot3000!\n\nTo get my attention, just wave and say \"Snow Boi\".\n\nHow can I help you today?"
        text_msg_pub.publish(speech_msg)

        user_interface.idle_screen_choices()

        self.start_time = rospy.Time.now()
Example #7
0
    def __init__(self):
        home = PoseStamped()
        home.header.stamp = rospy.Time.now()
        home.header.frame_id = 'map'
        home.pose.position.x = HOME_X
        home.pose.position.y = HOME_Y
        home.pose.orientation.w = cos(HOME_YAW / 2)
        home.pose.orientation.z = sin(HOME_YAW / 2)
        super(ReturnHome, self).__init__(goal=home)

        speech_msg = String()
        speech_msg.data = "I am currently returning home. Please mind out of my way!"
        text_msg_pub.publish(speech_msg)
Example #8
0
    def __init__(self):
        pose = PoseStamped()
        pose.pose.position.x = 5.89
        pose.pose.position.y = 2.15
        pose.pose.orientation.w = 1
        pose.header.frame_id = 'map'
        pose.header.stamp = rospy.Time.now()
        super(ForceReturn, self).__init__(goal=pose)
        publish_state_update(YEETBotState.RECEIVING_TOOL_LATE)
        self.tool = item_database.get_timed_out_tool_named()

        speech_msg = String()
        speech_msg.data = "I am looking for my " + self.tool + ". Please return it to me."
        user_interface.return_choices()
        text_msg_pub.publish(speech_msg)
Example #9
0
    def __init__(self, request_type):
        publish_state_update(YEETBotState.RECEIVING_REQUEST)

        self.request_type = request_type

        speech_msg = String()
        if request_type == 'lend':
            speech_msg.data = "Which tool would you like to borrow?"
            user_interface.borrow_choices()
        elif request_type == 'return':
            speech_msg.data = "Which tool would you like to return?"
            user_interface.return_choices()
        else:
            speech_msg.data = "How may I help you?"
            user_interface.idle_screen_choices()
        text_msg_pub.publish(speech_msg)
Example #10
0
    def response_cb(self, response_msg):
        if response_msg.id != self.choice_id:
            print "User response ID did not match expected ID"
            return
        if response_msg.invalid_choice:
            self.reset()
            msg = String()
            msg.data = "I'm sorry, I didn't understand that. Could you try again?"
            text_msg_pub.publish(msg)
            self.choices_pub.publish(self.choices)
            return
        try:
            resp = self.choices.user_options[response_msg.choice]
        except IndexError:
            print "IndexError"
            return

        if resp == BORROW:
            self.user_requested_borrow = True
        elif resp == RETURN:
            self.user_requested_return = True
        elif resp == BORROW_PLIERS:
            self.tool_requested = 'pliers'
        elif resp == BORROW_SCREW_DRIVER:
            self.tool_requested = 'screw_driver'
        elif resp == BORROW_WIRE_STRIPPERS:
            self.tool_requested = 'wire_strippers'
        elif resp == BORROW_VERNIER_CALIPERS:
            self.tool_requested = 'vernier_calipers'
        elif resp == RETURN_PLIERS:
            self.tool_requested = 'pliers'
        elif resp == RETURN_SCREW_DRIVER:
            self.tool_requested = 'screw_driver'
        elif resp == RETURN_WIRE_STRIPPERS:
            self.tool_requested = 'wire_strippers'
        elif resp == RETURN_VERNIER_CALIPERS:
            self.tool_requested = 'vernier_calipers'
Example #11
0
 def __init__(self):
     super(LowVoltage, self).__init__()
     speech_msg = String()
     speech_msg.data = "I am low on battery! Please help me charge myself!"
     text_msg_pub.publish(speech_msg)