Team:
Joseph Kopacz
Kasey Ackerman
Patrick Barrett
Topher Peter
My team and I programmed this adept robot to use a mounted vision system to sort a stack of widgets into two piles. In one pile the widget has a hole and the other pile the widget does not have a hole. The robot locates the stack of widgets using the symbol on the jig then brings the widget to a pre-determined place on the table to be analyzed and stacked. In this video the robot is only running at 50% of the max speed.
Reach Analysis:
Frame Assignment:
Forward Kinematics:
Reverse Kinematics:
Jacobian and Inverse Jacobian:
Adept Programming:
;grp3proj.v2 ;Mech 564 Group 3 ; Joseph Kopacz ; Kasey Ackerman ; Patrick Barrett ; Chris Peter ; ;Written 3/28/12 ;Last modified 4/5/12 ; ; ;NOTE: ***ALL NECESSARY CALIBRATION MUST BE LOADED PRIOR TO PROGRAM EXECUTION*** ; ***LOAD ALL ASSOCIATED DATA INTO MEMORY WITH PROGRAM*** ; ***THE FOLLOWING PARAMETERS MUST BE DEFINED PRIOR TO EXECUTION OF PROGRAM*** ; to.cam[1] must be defined by camera calibration ; part.grip is a trained relative transformation ; stack.rel is a trained relative transformation ; coordinates of the unsorted stack relative to the home location ; good.rel is a trained relative transformation ; coordinates of the location to place good widgets relative to the home location ; bad.rel is a trained relative transformation ; coordinates of the location to place good widgets relative to the home location ; test.loc and test_pic.loc are pretrained locations ; test.loc is the location where the widget should be placed to check for a hole ; test_pic.loc is the location where the camera can see the widget at test.loc ; ***NOTE: Lefty-righty configuration is important for this location. ; It is recommended that test.loc and test_pic.loc be stored as precision points ; ;***BEFORE PROGRAM EXECUTION, THE CAMERA SETTINGS MUST BE ADJUSTED AND THE RELEVANT INFORMATION LOADED INTO MEMORY ; 1. Clear the memory by entering ZERO at the command prompt ; 2. In the vision window, select LIST PROTOTYPES ; 3. Clear all prototype information by entering VDELETE <prototype_name> at the command prompt for all prototypes ; 4. Load HOME and TARGET prototypes into memory using VLOAD <prototype_file> (<prototype_file> is protos.vs in this instance) ; 5. Load program into memory by entering LOAD <program> (<program> is grp3proj.v2 to load this file) ; ; ;BEGIN PROGRAM ;Begin sort program SPEED 50 ALWAYS TYPE "Welcome" ;Load necessary predefined calibration data MC load c:\util\loadarea CALL load.area("c:\mech564\area201.dat", cam.virt, threshold, backlight, to.cam, cam.cal[], pmm.to.pix[,], pix.to.pmm[,], pmm.to.mm[,], mm.to.pmm[,], $error) ;check for errors loading calibration ; program should not be executed without loading calibration IF NOT ($error == "") THEN TYPE "Error loading AREA201.DAT:" TYPE $error GOTO 900 ELSE TYPE "done" END TYPE "" 100 ;Variable declarations $positive = "y" num_good = 0 num_bad = 0 200 ;Get number of widgets in the unsorted stack PROMPT "How many widgets would you like to process? (max=10) ", num_widgets ;Check that the stack contains between 1 and 10 widgets IF (num_widgets < 1) THEN TYPE "The number of widgets must be >0. Please enter an integer value [1,10]." GOTO 200 END IF (num_widgets > 10) THEN TYPE "The maximum number of widgets is 10. Please enter an integer value [1,10]." GOTO 200 END ;Verify that the user information is correct TYPE "Processing ", num_widgets, "widgets." PROMPT "Proceed? [y,n] ", response IF NOT (response == positive) THEN GOTO 900 END 300 ;Locate the home location and define reference locations ;home.loc = the location of the black marker on the jig ;All other locations are defined relative to home.loc ;stack.loc = the location of the unsorted stack of widgets ;temp.loc = the location at which a widget is temporarily placed to determine if it is good or bad ;temp_pic.loc = the location at which a picture of a single widget can be taken to determine if it is good or bad ;good.loc = the location where good widgets will be deposited ;bad.loc = the location wher bad widgets will be deposited ;Locate the home marker VPICTURE VLOCATE (, 2) "HOME", fov.loc ;Verify the home marker is found IF NOT (VFEATURE(1)) THEN TYPE "HOME is not in the FOV of the camera" PROMPT "Move HOME into the FOV and hit RETURN", $cr GOTO 300 END ;Define the home marker location HERE pict.loc HERE #pict.loc DECOMPOSE jt[1] = #pict.loc SET link2 = pict.loc:RZ(-jt[4]):TRANS(,,-jt[3]) SET obj.loc = link2:to.cam[1]:fov.loc SET home.loc = obj.loc:part.grip ;Define other locations relative to the home location SET stack.loc = home.loc:stack.rel SET good.loc = home.loc:good.rel SET bad.loc = home.loc:bad.rel ;Process the stack of widgets ;For each widget in the stack, ; Pick the widget up, ; Move it to the temporary location ; Take a picture of the widget ; Determine if the widget has a hole (good) or not (bad) ; Move the widget to the appropriate stack FOR i=1 TO num_widgets APPRO stack.loc, 150 BREAK SPEED 25 APPRO stack.loc, 6*(num_widgets-i) ; Increment stack height based on how many are widgets are left DELAY 0.2 CLOSEI DELAY 0.2 DEPART (150-(6*num_widgets-i)) BREAK APPRO #test.loc, 150 SPEED 25 MOVE #test.loc ; go to preset location to look at widget to determine good or bad DELAY 0.2 OPENI DELAY 0.2 DEPART 150 MOVE #test_pic.loc BREAK ; wait for move to finish before taking picture VPICTURE VLOCATE (, 2) "WIDGET", fov.loc ;Verify the widget is identified IF NOT (VFEATURE(1)) THEN TYPE "Could not locate WIDGET. Ending sort." TYPE "Please remove or replace WIDGET and enter number of remaining widgets when prompted to finish sorting stack." TYPE " " GOTO 900 END ;Pick up widget that was tested APPRO #test.loc, 150 SPEED 25 MOVE #test.loc DELAY 0.2 CLOSEI DELAY 0.2 DEPART 150 ;Check for a hole in the widget and move to appropriate stack IF (VFEATURE(17)) THEN APPRO good.loc, 150 SPEED 25 APPRO good.loc, 6*num_good DELAY 0.2 OPENI DELAY 0.2 DEPART (150-6*num_good) num_good = num_good+1 ELSE APPRO bad.loc, 150 SPEED 25 APPRO bad.loc, 6*num_bad DELAY 0.2 OPENI DELAY 0.2 DEPART (150-6*num_bad) num_bad = num_bad+1 END END 900 ;End of sorting procedure ;Process another stack of widgets if requested, otherwise terminate program ;Display number of widgets in each catagory MOVE pict.loc TYPE "" TYPE "Finished processing ", (num_good+num_bad), "widgets." TYPE "Sort results:" TYPE num_good, " Good widgets" TYPE num_bad, " Bad widgets" TYPE " " PROMPT "Process another stack of widgets? [y,n] ", response IF (response == positive) THEN GOTO 100 END TYPE "Goodbye" ;END OF PROGRAM
No comments:
Post a Comment