An efficient system based on model segmentation for weld seam grinding robot

Uneven surface quality often occurs when manual grinding butt welds, so robot welding seam grinding automation has become a fast-developing trend. Weld seam extraction and trajectory planning are important for automatic control of grinding process. However, the research on weld extraction is mostly focused on pre-welding. Due to the irregular shape of the weld after welding and the complex grinding process, there is seldom work that has been devoted to the weld grinding after welding. Consequently, a novel simple but efficient weld extraction algorithm is proposed in this paper, and the robot grinding path is planned. Firstly, a multi-degree of freedom bracket is designed for welding seam extraction. Secondly, the weld profile model is established, and a simple but effective weld extraction algorithm based on model segmentation is proposed to transform the calculating process of spatial point cloud into a two-dimensional point cloud calculating process. The least-square method (LSM) based on threshold comparison is used to segment the weld seam, which greatly improves the processing speed and accuracy. Then, the grinding path and grinding pose are calculated according to the extracted spatial structure of weld seam. Finally, an efficient robotic welding seam automatic grinding system based on model segmentation is built. Experiments’ results showed that the proposed method could make the irregular weld seam contour well-extract after welding and the built grinding system is efficient and reliable. The grinding efficiency is increased by 50%.


Introduction
Welding technology plays an irreplaceable role in shipbuilding, automobile, rail transport, aerospace, and other fields [1,2]. However, welding stress will be generated in the welding zone after welding, which greatly reduces the connection strength between the workpiece. The welding stress can be reduced and the fatigue strength of the workpiece can be improved by grinding the weld seam [3,4]. Therefore, it is of greatly important practical value and significance to grind the weld after welding. At present, the grinding process for weld seam is usually done by workers who endure the dust and noise constantly. With the development of industrial technology, robot grinding has been widely used in aerospace, energy, and other high-tech industries with its open and complex kinematic chain [5,6].
Nowadays, CAD offline programming and manual teaching are the two main working modes of robots [7,8]. However, the manual teaching cannot adapt to the changing environment, which may lose efficacy when grinding the large and weak-stiffness welding workpieces, especially the large structural parts such as pump truck bodies and high-speed rail bodies. Therefore, in order to meet the requirements of automatic welding seam grinding of structural parts in engineering machinery, aerospace, and other manufacturing fields, it is necessary to develop an intelligent grinding robot that can well adapt to environmental changes.
Weld identification and trajectory planning are the core of intelligent grinding robots, and robot sensor is the key part to realize weld identification and trajectory planning.
At present, various sensors are used in robots, such as vision sensors [9,10], laser sensors [11], force sensors [12,13], and acoustic emission sensors [14]. Among them, visual sensors are widely utilized because of their advantages of high accuracy and non-contact [15]. Passive vision technology uses cameras to capture the welding seam under natural light to detect the weld seam characteristics and the position deviation. Numerous published studies have applied passive vision technology for weld tracking in welding process [16][17][18][19][20]. Xu [19] designed a set of special vision sensor system for weld tracking and proposed a new improved Canny edge detection algorithm and achieved good results. However, the weld images collected in this process are often disturbed by dust, which affects the accuracy of image processing.
Structured light vision is a representative of active vision, including coded structured light [21] and laser structured light [22]. Coded structure light is mainly used for 3D reconstruction and machining path planning of workpiece. Yang [22] proposed a 3D seam extraction system based on coded structured light to plan robot welding tasks. However, due to the high environmental requirements of this method, welding efficiency is difficult to guarantee. Laser structured light is usually used to extract and track the weld contour in the form of a laser emitter and monocular camera. There are a variety of shapes of the laser stripe, including linear [23], multi-linear [24], cross [25], and triangle [26]. Shao [24] designed three lasers with different wavelengths for the welding process to measure the seam width, seam center, and the normal vector of the weld surface. The result of experiment revealed that the proposed method could meet the precision demand of space narrow butt joint. Zhang [25] proposed a weld line localization approach for mobile platform based on cross-structured light for robot welding process, and this approach could effectively reduce the influence of illumination and noise. However, the laser structured is a local-type sensor and cannot perceive the global range. Some scholars use three-dimensional coordinate scanner and binocular camera to obtain the global contour. The above methods have a series of problems, such as complex algorithms, a large amount of data processing, and high cost. It is still a difficult problem to accurately extract the weld parameters from the three-dimensional weld seam profile [27]. At present, due to the complexity of the grinding process and the irregular shape of the weld, the measurement-processing system for welding seam grinding is still immature.
In view of the problems in the above research, this work takes the unequal thickness steel plate as the research object, and investigates the robot automatic weld grinding system, including weld feature extraction method and grinding path planning technology. (1) A robotic welding seam automatic grinding system is built. (2) A simple but effective weld extraction algorithm based on model segmentation is proposed to transform the processing process of spatial point cloud into a two-dimensional point cloud processing process, then a data buffer area is created to reconstruct the weld seam morphology. (3) The mathematical model of the weld surface is established, and the rotation angle of the robot end posture is calculated through the obtained normal vector coordinates. The experimental results show that the system is reliable, the processing efficiency is increased by 50%, and the average roughness value of the weld surface after grinding can reach 0.382 μm. The research results are of great significance for engineering applications.
The rest of this paper is organized as follows. Section 2 describes the design and construction of the system. Section 3 describes the weld extraction process in detail. Section 4 describes the planning process of weld grinding path and pose and the realization process of system data interaction. Section 5 describes experiment results.

Construction of system platform
In this paper, a weld seam grinding robot system platform is set up to ensure the feasibility of the method (see Fig. 1). It mainly includes three parts, which are KUKA Robot Control (KRC) system, grinding system, and laser visual system. The KRC system includes a teaching pendant, manipulator, and controller. The grinding system includes the motor, frequency converter, and grinding wheel. The visual system includes a laser vision sensor, industrial PC, and a multidegree of freedom bracket.
The LJ-G500 laser vision sensor developed by the Keyence company is adopted (see Table 1), which can obtain 3D data combined with the robot. And it has many advantages, such as rapid projection, high precision, and high stability. At the same time, it is also easy for installation because of small size.

Design of multi-degree of freedom bracket
To satisfy the processing requirement, a multi-degree of freedom is designed to install a laser vision sensor and a grinding wheel, which can ensure that the laser is projected to the surface of the weld at any angle. As shown in Fig. 1, bracket 1 is used to install the motor and grinding wheel, with regular through holes on the left. Bracket 2 is designed with 3 U-shaped grooves, which can move in the Y and Z directions on bracket 1. Bracket 4 fixed with bracket 5 can rotate at any angle around bracket 3. The sensor laser head is fixed with the bracket 5 by 3 screws.

Hand-eye calibration
The hand-eye calibration is performed to obtain the transformation matrix between the sensor coordinate system and robot end coordinate system. In this paper, a highprecision standard ball was used as a fixed target to solve the hand-eye relationship by controlling the robot to move three times in translation and four times in any posture. After each movement, a line laser scanner installed on the robot end-effector was used to scan the standard ball to obtain a column of point clouds on the surface contour of the target ball (see Fig. 2). Then, the spherical center space coordinates of the target ball were obtained. Finally, the equation could be listed according to the constraint relationship, and the hand-eye relationship could be solved by singular value decomposition. We used a set of quaternions ( Q 1 , Q 2 , Q 3 , Q 4 ) and T to represent the rotation matrix part and the translation matrix part, respectively. The calibration matrix X s can be expressed as Eq. (1). To calculate the calibration accuracy, five calibration experiments were performed (see Table 2). The experimental results show that the process is fast, effective, and has a small amount of calculation. The result of the average calibration accuracy is about 0.2 mm, which can meet industrial requirements. (1) Robot welding seam grinding system based on model segmentation

Method of weld seam segmentation
When processing spatial point cloud data, there are common problems such as large amount of data, complex algorithm, and slow processing speed. In this paper, the processing of spatial point data cloud data is transformed into the processing of two-dimensional point cloud data. For this purpose, a method based on region segmentation is proposed to extract the contours of welds with unequal thickness steel plates (see Fig. 3). On the weld section, the plane point cloud is firstly segmented, then the slope point cloud data is further extracted. Finally, the weld seam point cloud is obtained through the model segmentation and stored in the data buffer. After scanning the whole welding seam, the 3D morphology of the complete welding seam is extracted by combining the robot coordinates. Compared with directly processing spatial point cloud data, this processing method is fast, efficient, and with a small data amount. Figure 3 illustrates the butt welding formed by two types of steel plate with unequal height. Note that in order to strengthen the connection strength after welding, the groove is usually processed in the area to be welded. Hence, the welding surface includes four parts, which are the bead, the 1st type of base material, and the 2nd type of base material and groove area. When the laser scans the weld contour, the laser line can be divided into five areas, including two planes (A, B), two bevels (C, D), and irregular weld surfaces (E). Therefore, point cloud data is mainly composed of plane point cloud, bevel point cloud, and weld seam point cloud. Considering the complexity of weld shape, it is difficult to extract point cloud data directly by building model. Thus, if models can be found to represent the plane region and the bevel region respectively, the weld data can be used as outliers to segment the weld profile.    According to the above analysis, the laser cloud data are orderly arranged based on the A-C-E-D-B region. In butt welding, the base metal in a certain area on both sides of the weld is considered to be an ideal flat. The region ( A, C, D, B ) can be represented by a first-order polynomial, respectively.

Model building
where y Ai , y Ci , y Di , y Bi is the distance between the laser sensor and the region of ( A, C, D, B ) at the location of x i , x i is laser point position, and a A , a C , a D , a B ;b A , b C , b D , b B are the polynomial parameters fitted by least square method (LSM). The distance between the point cloud and the fitting function is then represented as follows: where y i is the value predicted from Eq. (2), y is the measured value (between the laser sensor and workpiece surface), and d S is the threshold to split the outliers.

Point cloud segmentation
On the weld section, the data collected by the sensor is arranged in an orderly manner. Starting from the first point of the data, 10 points were randomly selected with a certain range and fitted by the least square method. The point cloud in region A was separated by Eqs. (2)-(4). When the continuous data was greater than the threshold value, it was regarded as region C. Then, 10 points were selected and fitted by the least square method to extract data from region C. At this moment, the starting point of the weld could be obtained.
Through the above process, regions A and C can be separated. Then, as shown in Fig. 4, in order to search from the last point in the data, the least square method is used to fit the degree polynomial to divide the region B and D.
After the above process, the 2D weld profile of the section is extracted and stored in the data buffer. Combined robot coordinate system synchronously, the three-dimensional morphology of the weld seam can be obtained by scanning the whole weld section profile. The flow chart of weld extraction based on model segmentation is shown in Fig. 5.
The algorithm is aimed at the extraction of welds of steel plates with unequal thicknesses, and the premise is to obtain ordered weld point cloud data. Firstly, the weld section model is established, and different areas are divided according to the section characteristics. Then, the LSM based on threshold comparison is utilized to extract the weld contour according to the order of A − C − B − D.
To extract the weld seam accurately, it is the key to set the appropriate threshold d s . Whether the threshold value is too large or too small will affect the judgment of the region. Therefore, before the actual grinding, the right d s by experiment need to be confirmed. As shown in Figs. 6, 7 and 8, a is actual weld profile, and b-e are the profile extracted according to different d s that are preliminarily set as 0.05 mm, 0.15 mm, and 0.25 mm.
The experimental results show that the size of the threshold has a greater impact on the accuracy of weld extraction. When the threshold value is 0.05 mm (see Fig. 6), areas C and D are easily misjudged, failing to extract the weld contour. When the threshold value is 0.25 mm (see Fig. 8), it is difficult to accurately judge the starting and ending point of the weld. According to the experimental results, the extraction accuracy is satisfied when d z =0.15 (see Fig. 7).

Feature information extraction
In order to accurately track the weld seam, the height, width, and normal vector of the weld seam need to be further calculated. The process can be expressed as follows.
1. Obtain starting and ending position p 1 (x 1 , y 1 ), p 2 (x 2 , y 2 ) of the weld seam based on model segmentation.

Grinding path fitting
To ensure good grinding quality, the grinding path must be smooth to avoid the vibration caused by the discontinuous speed and acceleration of the robot. The traditional trajectory fitting methods include three polynomial fitting [28] and five polynomial fitting [29], which have low fitting accuracy. In this paper, the U-direction utilized a spline function to fit the grinding trajectory based on the obtained weld profile, which is expressed as Eq. (6). In the actual grinding process, the grinding step in U-direction is obtained by the isometric method. Under the condition of ensuring the grinding efficiency and accuracy at the same time, it is more appropriate to set the step as 15 mm according to experimental experience.
where C(u) is a vector function of the B-spline curve, N i,k (u) is the k order spline basis function, which can be obtained by Eqs. (7) and (8), P i is the known feature point, and u is the sequence of parameters.

Calculation of end pose
The end pose of the robot is a key factor affecting the quality of grinding. The surface topography of the weld seam is reconstructed and the normal vector can be obtained. Then, the pose of the grinding wheel can be calculated according to the normal vector value.
The pose model of the weld seam is established in Fig. 10, which includes direction vectors, normal vectors, and proximity vectors. The starting and ending points P a (x a , y a , z a )  where ⃗ m is the proximity vector, ⃗ n is the normal vector, and ⃗ a is a proximity vector.
According to the D-H method, six joint coordinate systems of the robot were constructed, and the end-tool coordinate system {G} and the laser coordinate system {L} were also considered. The transformation matrices between {G} and {L} can be expressed as G L T . The end pose of robot can be determined by Euler angles (see Fig. 11), which is calculated by Eqs. (12)- (15).
where {W} is world coordinate system. p x , p y , p z are robot base coordinate system, and nP x is the projection of ⃗ n onto the plane p x op y . np y is the projection of ⃗ n onto the plane p z op y . , , are Euler angles. Before the robot grinding, the transformation relationship between coordinate system  The calculation process of the above trajectory and pose is obtained by MATLAB calculation (see Fig. 12) and realized by OrageEdit programming.

Weld extraction experiment
In order to verify the effectiveness of the welding seam extraction and reconstruction method, the feature extraction experiment was carried out on the welds of unequal-thickness steel plates. As shown in Fig. 13a, the width and height values were obtained with vernier calipers at five different positions. The feature data were extracted by the model segmentation algorithm and compared with the actual values. To evaluate the accuracy of the algorithm, five extraction experiments were carried out at five different positions (see Fig. 13c, d). The error range of the extraction width was ± 0.7− ± 1.4mm , and the error range of height was ± 0.15 − ± 0.5mm . The reason for the large width error is due to the influence of external environmental factors, resulting in the weld seam boundary not obvious. However, the extraction results can meet the error requirements. Finally, the extracted weld data was stored in the cache area to reconstruct the three-dimensional morphology of the weld. The reconstruction results are shown in Fig. 13b.

System grinding quality experiment
Weld grinding experiments were carried out based on the above methods of weld extraction and trajectory planning. As shown in Table 3, the alumina grinding wheel speed is kept as 10.46 m/s during the grinding process, the robot feed speed is 20 mm/s, and the grinding depth is set as 1.25 mm.
The diameter and width of alumina grinding wheel are 200 mm and 20 mm, respectively. Through grinding parameters shown in Table 3, the measured normal grinding force fluctuates around 50 N (see Fig. 14).
The grinding track and pose were calculated by MAT-LAB, and the robot grinding trajectory was programmed in OrageEdit. After grinding, 10 points were selected equidistantly to measure the weld surface roughness by the surface roughness tester (TR200) with the evaluation length of 0.8 mm. As shown in Fig. 15, the average roughness value can reach 0.382 μm, which completely satisfied the request of industry. Due to the instability of grinding starting point, the roughness value at the initial position is relatively high, which reaches 0.532 μm (see Fig. 15c). Subsequently, the grinding process tends to be stable and the weld surface roughness decreases.
To fully characterize the grinding quality, the weld height was extracted respectively based on the proposed method before and after grinding (see Fig. 16). The average height of the weld before grinding was 1.25 mm while was 0.098 mm after grinding. In order to observe the grinding quality more intuitively, the three-dimensional shape of weld surface was reconstructed based on hand-eye calibration (see Fig. 17). After grinding, the weld bead has been completely removed, the weld seam and base metal transition smoothly, and the weld seam surface is flat and smooth without obvious damage and crack, which proves that the system is reliable.

Grinding system efficiency experiment
To test the working efficiency of the system, the grinding experiment was carried out both in the manual teaching way and the method introduced in this article through the welds of unequal thickness steel plate with the same material,  shape, and length (40 cm). The grinding time was recorded under the same grinding parameters. The traditional teaching method had low efficiency and poor quality due to complicated procedures and large teaching errors, which took 7 min to grind (see Fig. 18a). The proposed system guaranteed the grinding quality and improved the polishing efficiency through accurate and efficient welding seam extraction and path planning methods, which only took 3 min to grind. The surface consistency after grinding was good, and the average roughness can reach 0.382 μm (see Fig. 18b). The specific experimental comparison effect is shown in Table 4.

Conclusion
In order to achieve high-quality and efficient welding seam grinding, a simple but effective method of welding seam feature extraction was proposed. A robot automatic welding seam grinding system was built to solve a series of problems in manual grinding. The experimental results proved that the system was reliable and efficient. The main contributions of this paper are as follows.
1. A multi-degree of freedom bracket for weld seam feature extraction is designed, which can ensure that the laser is projected to the weld surface at any angle. Based on this, a grinding equipment and a laser sensor are integrated at the end of the robot to realize a robot weld automatic grinding platform. The grinding efficiency is increased by 50%. 2. A simple but effective weld extraction algorithm based on model segmentation is proposed to transform the calculating process of spatial point cloud into a twodimensional point cloud calculating process. 3. The mathematical model of the weld surface is established, then the attitude angle of the robot end grinding is calculated based on the reconstructed 3D surface of the weld seam, which ensured the integrity of the grinding surface.

Declarations
Ethical approval We confirm that the manuscript has not been submitted to any other journal. The submitted work is original and has not been published elsewhere in any form or language.

Consent to participate
We confirm that all authors agree with the content and give explicit consent to submit.