# Vision Systems for a UR5 Cobot on a Quality Control Robotic Station
## 2 Experimental Setup of the Robotic Station
### Quality Control Process  
The primary purpose of the robotic station (Figure 1, red dotted line--cobot station) is to perform a series of measurements of basic geometric quantities of semi-final products employing the developed vision and communication libraries.  
In the first stage, the i4-550L SCARA robot places objects in the cobot's workspace, and then the locations of the objects are determined by a vision system equipped with the USB camera placed in the UR5 arm. UR5 takes semi-finished products and places them in the measuring zone which is equipped with a Mako camera and backlight. After the measurements are taken, the objects are segregated. Objects that satisfy the accepted criteria are moved to the collection station and objects that do not satisfy the criteria are rejected.  
A group of semi-finished products differing in shape and dimensions were developed to carry out functional tests. A detailed description of the basic geometric dimensions of the semi-final products is presented in Section 3 (Figure 10).  
A scheme of the quality control working algorithm of the designed station is shown in Figure 5 and described below:  
* Step 1--waiting for the signal to pick up the semi-finished product (true value on digital_in0 sent from i4-550L robot).
* Step 2--after receiving the signal (digital_in0), semi-finished products are grasped by the UR5 cobot and transferred to the measuring section (Figure 2, '2'). (The position and orientation of objects are determined based on images acquired from the USB camera placed on the cobot's flange, Figures 2 and 6).
* Step 3--in the measurement area, based on the image from the Mako G-125B camera, the semi-finished product is detected, and its dimensions (width and height) and the radius of internal holes are measured. Sample analysis results are presented below (Figure 7) (the dimensions of internal holes are ordered relative to the designated X and Y coordinates of their centroid in descending order, and external dimensions are presented as width and height).
* Step 4--semi-finished products that do not meet the requirements regarding shape (Figure 8) (the shape of the analyzed part is not included in the database of defined patterns or the part has a defect) and dimension (at least one of the dimensions does not fit within the assumed dimensional tolerance) are rejected (Figure 2, '5'). However, parts that satisfy the assumed dimensional criteria for overall dimensions, namely width, height, and internal hole diameter values, are transferred to the storage section (Figure 2, '6'). A symmetrical dimensional deviation (acceptable tolerances) of \(\pm 0.5\) mm was assumed for overall dimensions, and for the diameter of internal holes, this was \(\pm 0.3\) mm.  
Figure 5: Block diagram of the designed algorithm of the robotic quality control station.  
Figure 8: The semi-finished product does not meet the accepted criteria: the object has been recognized and the dimensions are within the accepted tolerances, but one of the holes is missing (screenshot of running vision app: the ‘inner dim’ section refers to the length of the inner hole radius; the ‘outer dim’ section refers to the external dimensions of width and height of the part).  
Figure 6: Detecting semi-finished products and determining position and orientation. Examples of preliminary analysis (screenshot of running vision app v.03). Red boxes—detected objects, green border—detected outer contours, arrows—orientation of detected object, X (red arrow) and Y (green arrow) axes.  
Figure 7: The result of the deployed vision measurement tool. The semi-finished product meets all the criteria; the object has been recognized; all dimensions are within the accepted tolerances (screenshot of running vision app v.03, the ‘inner dim’ section refers to the length of the inner hole radius; the ‘outer dim’ section refers to the external dimensions of width and height of the part).