1. Trang chủ
  2. » Luận Văn - Báo Cáo

Thiết Kế Và Chế Tạo Hệ Thống Nhận Diện Mối Hàn Cho Robot Tự Động.pdf

131 1 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Untitled THÀNH PHỐ HỒ CHÍ MINH BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC SƯ PHẠM KỸ THUẬT Tp Hồ Chí Minh, tháng S K L 0 0 8 1 0 6 TRƯỜNG ĐẠI HỌC SƯ PHẠM KỸ THUẬT THÀNH PHỐ HỒ CHÍ MINH KHOA ĐÀO TẠO CHẤT LƯ[.]

BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC SƯ PHM K THUT THNH PH H CH MINH ẩ1771*+,3 1*ơ1+&é1*1*+ầ. 0) and range (0;640) # pt1[0] (X_1) must be in (pt2[0] < 640 and pt2[0] > 0) and # pt2[0] (X_2) must be in range (0;640) # pt1[0] (X_1) and pt2[0] (X_2) cannot be (pt1[0] != and pt2[0] != 0) and (pt1[0] != pt2[0])): # pt1[0] (X_1) and pt2[0] (X_2) mu st be different #y1 != y2 all_point_x_top.append(pt1) all_point_x_bottom.append(pt2) num_line = len(all_point_x_top) if (num_line != 0): #Calculate the lines then take their average line ave_top_point = ave_bottom_point = for i in range(0, num_line): ave_top_point += all_point_x_top[i][0] ave_bottom_point += all_point_x_bottom[i][0] ave_top_point = int(ave_top_point/num_line) ave_bottom_point = int(ave_bottom_point/num_line) cv.line(img_copy, (ave_top_point, 0), (ave_bottom_point, 640), (0, 0, 255), 1) 109 for j in range(0, 640): if ((img_copy[240, j][0] == 0) and (img_copy[240, j][1] == 0) and (img_copy[240, j][2] == 255)): # Distance of X x_dis = (j/ppm) + 33.6848 # delta_X = 33.6848 # Delta Time from the starting of state to current DeltaTime = (end_time - start_time) y_dis = round((DeltaTime*(300/60) + 105.6454), 4) # #visme 33mm from base # #DATA SAMPLE G90 G1 F2000 X Y str_gcode = "G1 X" + \ str(round(x_dis, 4)) + " Y" + str(y_dis) + " F300" # Add the new str_gcode line above the previous one line_prepend(str_gcode) # cv.putText(img_copy,str(round(distance_line,4)),(50,50 ),fontFace=cv.FONT_HERSHEY_COMPLEX,fontScale=1,color=(150,100,200),thickness =2) # cv.arrowedLine(img_copy,(0,240),(j,240),(255,255,0),5) # cv.arrowedLine(img_copy,(j,240),(0,240),(255,255,0),5) # cv.line(img_copy,(0,240),(640,240),(0,255,0),1) break # else: #print("LINE NOT FOUND") cv.imshow("Detected Lines (in red) - Standard Hough Line Transform", img _copy) if (y_dis >= 240): cv.destroyAllWindows() state = #==========================================================================# # MAIN CODE #==========================================================================# print("State - SETUP MACHINE PLEASE WAIT 30 SECONDS ") if(state == 0): state_0() state = print("State ANALYZE AND GENERATE GCODE") cap_video = cv.VideoCapture(0,cv.CAP_DSHOW) 110 start_time = time.monotonic() while(state == 1): ret, img = cap_video.read() # read frame then timing end_time = time.monotonic() # end of time delta # if frame is read correctly ret is True if not ret: print("Can't receive frame (stream end?) Exiting ") break img = cv.flip(img, 1) img = cv.flip(img, 0) state_1() # Check key key = cv.waitKey(1) if key & 0xFF == ord('q'): break # Press "q" to quit print("DONE") print("THE GCODE IS SAVED IN "+str(filename_output)) cap_video.release() cv.destroyAllWindows() 111 S K L 0

Ngày đăng: 24/06/2023, 19:13

Xem thêm:

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN