def initiate_picking(data): if data.robot_id == self.robot_id: pickerx = robot_storage.getRobotWithId(data.robot_id) self.x_start = self.position['x'] self.y_start = self.position['y'] self.add_action( NavigatePickAction(pickerx.position["x"], self.maxY + 5))
def callback(data): """Execute method in response to "bin_status" message.""" if data.is_empty: # Data used to calculate if it's the closest to the bin rospy.loginfo("Bin call: " + data.bin_id + " %.1f %.1f" % (data.x, data.y)) self.current_bin_x = data.x self.current_bin_y = data.y # rospy.loginfo(len(self.picker_dict)) if self.is_closest( ) and not self.has_bin: # and not self.slave and not data.is_carried: self.has_finished = False current_bin = robot_storage.getRobotWithId(data.bin_id) if current_bin.designated_picker == None: self.has_bin = True self.add_action( NavigateAction(self.current_bin_x, self.current_bin_y)) rospy.loginfo("P Robot: " + self.robot_id + " " + "Bin closest: " + data.bin_id) msg = empty_response() msg.robot_id = self.robot_id msg.bin_id = data.bin_id rospy.loginfo(self.robot_id + msg.robot_id + msg.bin_id + data.bin_id) empty_response_pub.publish(msg) rospy.loginfo( "??????????????????////???????????????????")
def mimic_now(data): """Execute method in response to a robot_status message""" if not self.should_face and data.robot_id == self.designated_picker and not self.master: if (data.x - 0.4) <= self.position['x'] <= (data.x + 0.4): if (data.y - 0.4) <= self.position['y'] <= (data.y + 0.4): picker = robot_storage.getRobotWithId(data.robot_id) # rospy.loginfo(data.robot_id) self.latch(picker) self.empty_response_msg.robot_id = data.robot_id self.empty_response_msg.bin_id = self.robot_id if not self.should_face and data.robot_id == self.designated_carrier and not self.master: if (data.x - 0.4) <= self.position['x'] <= (data.x + 0.4): if (data.y - 0.4) <= self.position['y'] <= (data.y + 0.4): carrier = robot_storage.getRobotWithId(data.robot_id) # rospy.loginfo(data.robot_id) self.latch(carrier) self.empty_response_msg.robot_id = data.robot_id self.empty_response_msg.bin_id = self.robot_id
def id_response(data): """Execute method in response to an empty_response message.""" # rospy.loginfo("SDAFDFDSFDSAFDSAFDSAFDSAFDSAFSADFADSFSADF") if data.bin_id == self.robot_id: self.is_publishing = False robot = robot_storage.getRobotWithId(data.robot_id) if robot.type == "PickerRobot": self.designated_picker = data.robot_id elif robot.type == "CarrierRobot": self.designated_carrier = data.robot_id
def bin_carrying(data): if data.robot_id == self.robot_id: rospy.loginfo("carrier " + self.robot_id + " going up to driveway") carrierx = robot_storage.getRobotWithId(data.robot_id) for i in range(0,3): if not bin_locations[i]['occupied']: bin_locations[i]['occupied'] = True self.add_action(NavigateAction(bin_locations[i]['x'], bin_locations[i]['y'])) self.add_action(UnlatchAction(self.slave)) break if i is 3: # Locations should never be all full, but who knows? bin_locations[i]['occupied'] = True self.add_action(NavigateAction(bin_locations[i]['x'], bin_locations[i]['y']))
def callback(data): if not data.is_empty: self.current_bin_x = data.x self.current_bin_y = data.y current_bin = robot_storage.getRobotWithId(data.bin_id) if self.is_closest() and not self.has_bin and not current_bin.designated_carrier: self.going_towards = data.bin_id current_bin.designated_carrier = self.robot_id rospy.loginfo("Carrier bot coming towards bin " + data.bin_id + " at " + str(self.current_bin_x) + ", " + str(self.current_bin_y)) self.has_bin = True self.add_action(NavigateAction(self.current_bin_x, self.current_bin_y)) rospy.loginfo("P Robot: " + self.robot_id + " " + "Bin closest: " + data.bin_id) msg = empty_response() msg.robot_id = self.robot_id msg.bin_id = data.bin_id empty_response_pub.publish(msg)
def bin_carrying(data): if data.robot_id == self.robot_id: rospy.loginfo("carrier " + self.robot_id + " going up to driveway") carrierx = robot_storage.getRobotWithId(data.robot_id) for i in range(0, 3): if not bin_locations[i]['occupied']: bin_locations[i]['occupied'] = True self.add_action( NavigateAction(bin_locations[i]['x'], bin_locations[i]['y'])) self.add_action(UnlatchAction(self.slave)) break if i is 3: # Locations should never be all full, but who knows? bin_locations[i]['occupied'] = True self.add_action( NavigateAction(bin_locations[i]['x'], bin_locations[i]['y']))
def callback(data): """Execute method in response to "bin_status" message.""" if data.is_empty: # Data used to calculate if it's the closest to the bin rospy.loginfo("Bin call: " + data.bin_id + " %.1f %.1f" % (data.x, data.y)) self.current_bin_x = data.x self.current_bin_y = data.y # rospy.loginfo(len(self.picker_dict)) if self.is_closest() and not self.has_bin: # and not self.slave and not data.is_carried: self.has_finished = False current_bin = robot_storage.getRobotWithId(data.bin_id) if current_bin.designated_picker == None: self.has_bin = True self.add_action(NavigateAction(self.current_bin_x, self.current_bin_y)) rospy.loginfo("P Robot: " + self.robot_id + " " + "Bin closest: " + data.bin_id) msg = empty_response() msg.robot_id = self.robot_id msg.bin_id = data.bin_id rospy.loginfo(self.robot_id + msg.robot_id + msg.bin_id + data.bin_id) empty_response_pub.publish(msg) rospy.loginfo("??????????????????////???????????????????")
def callback(data): if not data.is_empty: self.current_bin_x = data.x self.current_bin_y = data.y current_bin = robot_storage.getRobotWithId(data.bin_id) if self.is_closest( ) and not self.has_bin and not current_bin.designated_carrier: self.going_towards = data.bin_id current_bin.designated_carrier = self.robot_id rospy.loginfo("Carrier bot coming towards bin " + data.bin_id + " at " + str(self.current_bin_x) + ", " + str(self.current_bin_y)) self.has_bin = True self.add_action( NavigateAction(self.current_bin_x, self.current_bin_y)) rospy.loginfo("P Robot: " + self.robot_id + " " + "Bin closest: " + data.bin_id) msg = empty_response() msg.robot_id = self.robot_id msg.bin_id = data.bin_id empty_response_pub.publish(msg)
def test_get_robot_with_id(self): """Test get robot with id method returns robot""" robot_storage.addRobot(self.robot_obj, self.robot_obj.robot_id) result = robot_storage.getRobotWithId(self.robot_obj.robot_id) self.assertEqual(result, self.robot_obj)
def initiate_picking(data): if data.robot_id == self.robot_id: pickerx = robot_storage.getRobotWithId(data.robot_id) self.x_start = self.position['x'] self.y_start = self.position['y'] self.add_action(NavigatePickAction(pickerx.position["x"], self.maxY + 5))