def tubeBox_cube(self): self.get_data = CollectData() self.get_data.loadfile() tube_dimensions, tube_location = self.get_data.get_tubeRack_data() self.x = float(tube_dimensions["width"]) / 10 self.y = float(tube_dimensions["height"]) / 10 self.z = float(tube_dimensions["length"]) / 10 self.locationXtube = tube_location["x"] self.locationYtube = tube_location["y"] self.locationZtube = tube_location["z"] tube_location = [ self.locationXtube, self.locationYtube, self.locationZtube ] verticies = ((self.x, -self.y, -self.z), (self.x, self.y, -self.z), (-self.x, self.y, -self.z), (-self.x, -self.y, -self.z), (self.x, -self.y, self.z), (self.x, self.y, self.z), (-self.x, -self.y, self.z), (-self.x, self.y, self.z)) return verticies, tube_location
def set_path_boundaries(self): ''' Implement checks to ensure robot does not hit things that we do not want it to hit Takes dimensions and coordinates from user and then transfroms these to verticies of 2D box. The z coordinate of each item remains fixed and is what finally maps this boundary to 3D. Each time the user tries to move the robot the path boundary is checked ***** Assumed that user defined coordinates are the upper left hand corner of each box **** ''' space = self.define_threeDspace() #get coordinate locations of objects in standard json file self.get_data = CollectData() self.get_data.loadfile() #get coordinate locations of each item bot_loc, tube_loc, tip_loc, micro_loc, waste_loc = self.get_data.get_real_coordinates() location_array = [bot_loc,tube_loc,tip_loc,micro_loc,waste_loc] all_nodes = [] top_nodes =[] bottom_nodes=[] robot_dimensions, _ = self.get_data.get_robot_data() tip_dimensions, _ = self.get_data.get_tipBox_data() tube_dimensions, _ = self.get_data.get_tubeRack_data() waste_dimensions, _ = self.get_data.get_wasteContainer_data() micro_dimensions, _ = self.get_data.get_microPlate_data() dimension_array = [robot_dimensions,tube_dimensions,tip_dimensions,micro_dimensions,waste_dimensions] #define all the places where the BenchBot should not go past for i in range(0,len(location_array)): for j in range(0,4): coordinates = self.create_twoDbox(dimension_array[i],location_array[i]) top_nodes.append([coordinates[j][0],coordinates[j][1], location_array[i]["z"]-1]) #add all new x,y coords of boxes in our path bottom_nodes.append([coordinates[j][0],coordinates[j][1],location_array[i]["z"]-1]) # draw bottom of cube for i in range(0,len(top_nodes)): if bottom_nodes[i][0] <= space[i][0] <= top_nodes[i][0]: # if x coord in range if bottom_nodes[i][1] <= space[i][1] <= top_nodes[i][1]: #if y coord in range if bottom_nodes[i][2] <= space[i][2] <= top_nodes[i][2]: #if z coord in range space.remove(top_nodes[i]) #remove these from access to robot space.remove(bottom_nodes[i]) return top_nodes,bottom_nodes #return the spaces where the robot shouldnt go
def robot_cube(self): self.get_data = CollectData() self.get_data.loadfile() robot_dimensions, robot_location = self.get_data.get_robot_data() self.x = float(robot_dimensions["width"]) / 10 self.y = float(robot_dimensions["height"]) / 10 self.z = float(robot_dimensions["length"]) / 10 self.locationX = robot_location["x"] self.locationY = robot_location["y"] self.locationZ = robot_location["z"] robot_location = [self.locationX, self.locationY, self.locationZ] verticies = ((self.x, -self.y, -self.z), (self.x, self.y, -self.z), (-self.x, self.y, -self.z), (-self.x, -self.y, -self.z), (self.x, -self.y, self.z), (self.x, self.y, self.z), (-self.x, -self.y, self.z), (-self.x, self.y, self.z)) return verticies, robot_location
def run_path_way(self): ''' Path of robot for now will follow that which is set in the drawCubes python script and shown by the blue line in the WorkSpace tab 3D model Graph Def: robot_vert[2] -> tube_vert[5] -> tipbox_vert[2] -> micro_vert[1] -> waste_vert[2] if robot clears these verticies it will not hit anything ''' self.get_data = CollectData() self.get_data.loadfile() #get coordinate locations of each item bot_loc, tube_loc, tip_loc, micro_loc, waste_loc = self.get_data.get_real_coordinates() location_array = [bot_loc,tube_loc,tip_loc,micro_loc,waste_loc] logic_array = [False,True] for i in range(0,len(location_array)-1): for j in range(0,len(logic_array)): self.defined_path(location_array[0],location_array[i+1],logic_array[j]) #last call puts robot back at initial position self.defined_path(bot_loc,waste_loc,reverse=True)
def micro_cube(self): self.get_data = CollectData() self.get_data.loadfile() micro_dimensions, micro_location = self.get_data.get_microPlate_data() self.x = float(micro_dimensions["width"]) / 10 self.y = float(micro_dimensions["height"]) / 10 self.z = float(micro_dimensions["length"]) / 10 self.locationX = micro_location["x"] self.locationY = micro_location["y"] self.locationZ = micro_location["z"] micro_location = [self.locationX, self.locationY, self.locationZ] verticies = ((self.x, -self.y, -self.z), (self.x, self.y, -self.z), (-self.x, self.y, -self.z), (-self.x, -self.y, -self.z), (self.x, -self.y, self.z), (self.x, self.y, self.z), (-self.x, -self.y, self.z), (-self.x, self.y, self.z)) return verticies, micro_location
def tipBox_cube(self): self.get_data = CollectData() self.get_data.loadfile() tip_dimensions, tip_location = self.get_data.get_tipBox_data() self.x = float(tip_dimensions["width"]) / 10 self.y = float(tip_dimensions["height"]) / 10 self.z = float(tip_dimensions["length"]) / 10 self.locationXtip = tip_location["x"] self.locationYtip = tip_location["y"] self.locationZtip = tip_location["z"] tip_location = [ self.locationXtip, self.locationYtip, self.locationZtip ] verticies = ((self.x, -self.y, -self.z), (self.x, self.y, -self.z), (-self.x, self.y, -self.z), (-self.x, -self.y, -self.z), (self.x, -self.y, self.z), (self.x, self.y, self.z), (-self.x, -self.y, self.z), (-self.x, self.y, self.z)) return verticies, tip_location
def waste_cube(self): self.get_data = CollectData() self.get_data.loadfile() waste_dimensions, waste_location = self.get_data.get_wasteContainer_data( ) self.x = float(waste_dimensions["width"]) / 10 self.y = float(waste_dimensions["height"]) / 10 self.z = float(waste_dimensions["length"]) / 10 self.locationX = waste_location["x"] self.locationY = waste_location["y"] self.locationZ = waste_location["z"] waste_location = [self.locationX, self.locationY, self.locationZ] verticies = ((self.x, -self.y, -self.z), (self.x, self.y, -self.z), (-self.x, self.y, -self.z), (-self.x, -self.y, -self.z), (self.x, -self.y, self.z), (self.x, self.y, self.z), (-self.x, -self.y, self.z), (-self.x, self.y, self.z)) return verticies, waste_location