Multiseam tracking with a portable robotic welding system in unstructured environments

Most welding manufacturing in heavy industries, such as shipbuilding and construction, is conducted in unstructured workspaces, indicating that the production environment is irregular, changeable, and unmodeled. In this case, changeable workpiece position/shape and environmental background/illumination should be carefully considered. Owing to these complicated characteristics, welding currently relies on manual operation, resulting in high cost, low efficiency, and inconsistent quality. This study proposes a portable robotic welding system and a novel seam-tracking method. Compared with existing methods, it can track more general and complex spatial weld seams. First, the tracking pose of the robot was modeled using a proposed dual-sequence tracking strategy. On this basis, the working parameters can be adjusted to avoid robot-workpiece collision around the workpiece corners during tracking processes. By associating the forward direction of a welding torch with the viewpoint direction of a camera, the problem that the weld seam feature points are prone to lost during tracking processes can be solved by conventional methods. Point cloud registration is adopted to locate the multi-segment weld seams in the workpiece globally because the system deployment location is not fixed. Various experiments on single or multiple weld seams under different environmental conditions show that even if the robot was deployed in different positions, it could reach the initial points of the seams smoothly and accurately track along them.


Introduction
Welding plays an irreplaceable role in modern manufacturing, especially in heavy industries, as a basic fabrication method in joining materials, usually metals or thermoplastics. It is well known that up to 70% of the world's steel production is used to manufacture welded products, structures, and equipment. Therefore, it remains one of the leading technological processes in the global economy [1]. It is employed in constructing numerous industrial sectors, such as shipbuilding, railway construction, machine manufacturing, bridge construction, the petrol industry, and aerospace engineering. In many cases, welding is the only possible and most effective method for building unassembled structures with approximately optimal shapes. However, most welding work in unstructured environments relies on manual work. According to statistics, more than 90% of welding work is still done manually, which is even higher in heavy industries [2]. However, manual welding production has inherent drawbacks. For instance, human work is costly, and workers may suffer from health problems owing to the unavoidable intense heat radiation, smoke, and arcs during welding. More importantly, human work cannot consistently guarantee welding quality, which may influence the reliability and safety of products, especially in public transport products such as ships, high-speed railways, and bridges. Unfortunately, unlike structured production lines in traditional workshops, it is challenging to conduct automatic welding in heavy industries because the working environment is often unstructured, including the following: (i) workpiece diversity. Unlike an assembly line, where everything is fixed, various structural parts with different shapes and sizes in heavy industry are assembled on-site. This constraint usually results in a significant deviation between the actual product size and ideal model design, making it difficult to apply traditional offline programming or teaching-playback mode for robotic processing. (ii) Workplace variability. Much welding work is conducted in an outdoor environment, requiring robotic welding systems to have excellent mobility, which is difficult to achieve using conventional cumbersome industrial robots.
The first issue above drives research on weld seam-tracking technology, but there are currently few methods capable of fully autonomous welding of multi-seams in unstructured environments. On the one hand, almost all existing methods require certain prior information, such as the curve equation [3] or nominal path [4][5][6][7][8], which is extremely difficult to satisfy in an unstructured environment. For instance, a weld seam trajectory recognition method based on laser scanning displacement sensing was proposed for the automated guidance of a welding torch in skip welding of a spatially intermittent weld seam [8]. This method requires scanning all seams before welding, which is inefficient and even impossible in some special environments, such as the autonomous welding of certain nuclear facilities and large outdoor structures. In 2020, Zou et al. [3] presented a tracking method for complex spatially curved weld seams, but this method requires prior knowledge of the mathematical curve for the seams and has major limitations. However, most current studies only show the tracking of single-segment linear seams or single planar curved weld seams by employing various sensors. A curved weld seam is characterized by irregular shapes, and its width and angle may frequently change, which is undoubtedly challenging for seam tracking [9]. The sensors utilized for automatic robotic welding are generally based on arc and optical sensing [10]. In the early stage before 2010, arc sensing was studied to track single-segment continuous seams [11][12][13]. Arc sensors are available in the market from company IGM and POWER-TRACTM from SERVO-ROBOT. Vision-based sensors are considered to be the most promising because of their non-contact characteristics, high precision, fast detection, and strong adaptability [9,14]. Passive vision has been adopted to track a straight weld seam [5,15] and a curved seam [16,17]. In [18][19][20], stereo passive vision systems with multiple optical paths were designed to realize straight line weld seam tracking. Active vision is currently popular for seam tracking. Based on this new technology, tracking of a straight weld seam [7,[21][22][23] and a single-section curved weld seam [24][25][26] have been studied. Liu et al. [27] applied a composite sensor system including an RGB-D camera and a laser vision sensor to detect weld seams automatically.
The key to the tracking of multi-segment weld seams lies in identifying the initial point of each seam, especially for welding tasks where the workplace needs to be changed in an unstructured environment. Earlier studies [28][29][30] used RGB cameras to extract the initial points of weld seams, whereas recent studies [26,[31][32][33] have revealed the potential of laser vision sensors in searching for initial points. However, in contrast to the initial point identification problem of single-segment weld seams, the initial point identification of multi-segment weld seams also involves the pose estimation of the entire workpiece. Kim et al. [34] proposed extracting all detectable weld seams from multi-view RGB images and then filtering and merging them in the corresponding RGB-D images to detect multiple weld seams in workpieces. However, they did not consider the influence of environmental factors on object edge extraction and indiscriminately regarded the detected edge lines as weld seams. The problem of initial point identification for multi-segment weld seams still needs to be researched.
In unstructured environments, welding carriages have good application prospects for automatic welding technology. They are convenient to deploy because of their small sizes . This type of system, including representative commercial products, is usually driven by portable rails, such as LIZARD from ITM company [35], or wheels, such as products from [36,37]. These products use manual assistance and internal motor encoders to locate weld seams to complete the automatic welding of simple trajectories such as straight lines or circular arcs, similar to [38]. Mao et al. [13] studied the automatic welding of circular weld seams using arc sensors to guide the trolleys. Because the arc sensor is unable to identify the initial point of a weld seam, it is unsuitable for the autonomous welding of multi-segment seams. Wang et al. [39] utilized vision sensors for real-time seam identification. Laser vision sensors were adopted in [40][41][42] to make the welding carriage more intelligent in a wall-climbing welding robot. However, one drawback of this platform is that it cannot weld complex spatially curved weld seams because the end-effector has only two or three degrees of freedom.
This fact motivates to complement multiple-seam tracking with a 6-DOF cooperative manipulator. This portable platform can complete the welding of curved seams and achieve the effect of "placing it wherever you need it and carrying it away after welding." The main contributions of this work are as follows: (1) a technique that calibrates the laser-vision sensor with a common chequerboard calibration board; (2) a fully autonomous tracking technique for spatial curve weld seams; (3) a novel method to estimate the real-time pose of a weld seam using three feature points on a laser stripe; and (4) the initial point identification of multiple seams with point cloud registration.
The remainder of this paper is organized as follows: Sect. 2 introduces the design of the portable robotic welding system and an overview of the weld tracking algorithm; Sect. 2.3 describes the designed laser vision sensing system and its calibration method; Sect. 3 presents the tracking method for complex curved weld seams and the global positioning method for multiple welds; Sect. 4 illustrates the laboratory tests and results; Sect. 6 concludes this work.

System overview
The proposed system for mobile-robotic welding in unstructured environments is shown in Fig. 1. It mainly consists of a cooperative manipulator (Elfin E05), a robot controller, a vision system, a welding power supply (Panasonic YD-500GR5), and a host computer (Intel NUC11). The cooperative robot carries the welding torch under motion control signals from the controller. The host computer processes the information captured by the vision sensor and sends commands to the robot controller. The sensor is installed around the end of the cooperative robot. The system can be placed on various mobile platforms such as AGVs or easily carried by workers to different worksites. As shown in Fig. 1b, the mass of the cooperative robot with the end-effector is merely 23kg. The vision system contains two sensors: a RGB-D camera (Realsense D435i) to locate the workpiece globally, and a customized laser vision sensor to accurately detect the position and orientation of the weld seam.

Weld seam tracking algorithm
The weld seam tracking algorithm of our system is divided into several modules: global seam identification, seam local identification, and abnormal monitoring. The entire process is illustrated in Fig. 2. 1. Seam global identification: Workpiece geometry is used to determine the spatial distribution of each weld seam in the robot base coordinate frame by extracting the global characteristics of each weld seam from the CAD model of workpieces. Subsequently, offline attitude planning of the end-effector and accurate positioning of the weld seam can be performed. 2. Seam local detection: Seam local detection primarily uses an image-processing algorithm for feature points extraction of the weld seam. In particular, geometric morphological processing was used to obtain the position of the seam feature points. 3. Abnormal monitoring: The module monitors two safety indicators: the vision system state, Flag cam , and robot state Flag R . When the camera stops working (detected by indicator Flag cam ) or the motion position of the cooperative manipulator deviates significantly from the expected position (detected by indicator Flag R ), the robotic system stops in a timely manner.

Mathematical model of 3D reconstruction
As illustrated in Fig. 3b, the laser-vision sensor obtains the 3D coordinates of any point on the laser stripe using its pixel position p img (u, v) in the image coordinate frame. Here, the laser light plane equation is first introduced, followed by correcting the image distortion. The lens distortion model [43,44] can be expressed as: where (ũ,ṽ) is the distorted pixel in an image captured by the camera, and the corrected pixel is denoted as (u, v). K 1 , K 2 , and K 3 are the radial distortion coefficients, and P 1 and P 2 are the tangential distortion coefficients. These parameters can be obtained by camera calibration, and the distorted image can be corrected according to Eq. (1). As shown in Fig. 3, for a particular point P c = [X c , Y c , Z c ] T on the laser stripe in the camera coordinate frame, according to the linear imaging model, the corresponding relationship between the pixel coordinate system and camera coordinate system is: where M I represents the camera intrinsics. Assuming that the plane equation of the laser light plane in the camera coordinate system is: Combining Eqs. (2) and (3), the transformation between the camera coordinate system and the pixel coordinate system for any point on the laser stripe is: We then can obtain :  Thus, we can obtain P c = [X c , Y c , Z c ] T on the laser stripe from the pixel point p img (u, v) of the image using Eq. (5). To guide the robot to work, P c from the camera coordinate still needs to be converted to the robot base coordinate frame: where t T c is the pose of the camera coordinate system with respect to the robot tool coordinate system and can be obtained by hand-eye calibration. B T t is the pose and position of the robot tool coordinate system in the robot base coordinate system and can be read from the robot controller in real time.

Calibration of laser-vision sensor
This subsection introduces the calibration of the coefficients in Eq. (3): A, B, C, and D. Although there have been many related studies on the calibration of laser-vision sensors, the current and primary problem is the demand for the use of complex calibration artifacts and excessive model parameters. For instance, Idrobo-Piz et al. [45] proposed a calibration model using a camera, a lens, two lasers, and a special calibration board to calibrate the position parameters of the laser. This approach is difficult to implement because there are too many model parameters, and the calibration board is a customized product that is difficult to obtain. In a similar study [46], a particular serrated stereo target was used to calibrate the hand-eye relationship between the laser vision sensor and robot. To solve the problem of tedious calibration, Xiao et al. [47] adopted a plane calibration board with a special pattern to implement an automatic calibration. However, this type of calibration board is also a specially customized product. The most common calibration board was used for our laser-vision sensor. Assume that the coordinates of a point P on the laser stripe in the coordinate system of the calibration plate are P w = [X w , Y w , Z w ] T , and R and t are external parameters of the camera relative to the calibration board, then it can be verified as: Then, Eq. (7) becomes: Fig. 4, because all points on the laser stripe are located on the plane of the calibration plate, that is, Z w = 0 , then we have: combining with Eq. (2), we can obtain: Any point P c in the camera coordinate system can be obtained via Eqs. (2) and (10) from p img . We can then keep the camera posture still, change the calibrated posture, and repeat the steps shown in Fig. 4 to collect multiple images. After converting all collected points to the camera coordinate system, the singular value decomposition (SVD) image of the laser stripe is taken. c Transforming all points p img on the laser stripe to point P c in the camera coordinate system. Then, repeating (a) and (b) to obtain multiple lines (in yellow color) in the camera coordinate system. Finally, fitting the points to a spatial plane method is used to fit these spatial points into a plane; the plane equation coefficients in Eq. (3) can be finally obtained.

Seam tracking methods
There are two main cases of seam tracking in an unstructured environment: single-weld seam tracking and multipleweld seam tracking. In Subsect. 3.1, the pose modeling and tracking method for a particular weld seam are discussed in detail. On this basis, in Subsect. 3.2, taking ship structural part welding as an example, the continuous tracking method of multi-segment weld seams using 3D vision to guide the robot to transition between different seams is presented.

Seam trajectory generation
Weld joints can be categorized into several different types. However, it is helpful to classify commonly used weld joints into the following types: butt joint, lap joint, and T joint [48]. These three typical types of weld joints can be represented by different combinations of points, which can be regarded as the features of the weld seam in this paper. Once those feature points were obtained from the images, the position and orientation of the weld seam are calculated according to the type of weld joint. In this study, the features of the weld joint are defined as three points, as shown in Fig. 5. The first step in single-seam welding involves extracting the seam features via image processing. The seam shape can be obtained via 3D reconstruction of the feature points on the laser stripe of the image (see p i , p i,l , and p i,r in Fig. 5a-c).
We first extract the center line (red line in Fig. 5a) of the laser strip at the sub-pixel level. We then find the intersection point p i of the two lines and give p i,l and p i,r on the center line, which are equal distances from p i . The feature point p i represents the position of the weld seam path point, and the two auxiliary points on both sides are used to calculate the direction of the seam. We save p i of every frame captured in the dynamic buffer during the tracking process. From { p 1 , p 2 , p 3 , ..., p i , ...} in the dynamic buffer, the corresponding target points on the weld seam { P 1 , P 2 , P 3 , ..., P i , ...} in the robot base coordinate system can be computed using Eqs. (5) and (6) and the robot is driven sequentially through each target point.
When the robot moves along the weld seam, due to the difference between the moving speed of the robot and the camera capture frequency, the time steps are not synchronized. If the feature points detected by the camera are sent directly to the robot, significant errors will occur. For example, if the robot moves at a speed of 100 mm/s while the sensor captures at 2 frames per second, the interval between the two images is approximately 50 mm, which is sparse compared with extracting a continuous laser stripe on each image. However, when the robot moves at a much lower speed and the camera captures at a higher rate, the feature points obtained from the camera will be dense with little difference between them, which produces a large number of invalid feature points.
To filter out the redundant points, every subsequent point P i+1 should satisfy: where d denotes the Euclidean distance between P i+1 and P i . Typically, d thres is set to 1 − 2 mm. The algorithm only processes qualified points, as described by down-sampling in Fig. 5c.

Tracking posture computation
After obtaining the seam path point sequence, the posture of the weld seam [X p i , Y p i , Z p i ] is obtained by curve fitting. For a certain point P i in the sequence, the adjacent 2m points are curve-fitted using polynomial as follows: Afterwards, the tangent vector i = (1, y x , z x ) = (1, n i,y , n i,z ) T of P i can be calculated. As shown in Fig. 6a-b, the plane 1i with its normal vector i is defined as the posture plane of P i . To ensure that the welding torch is always located at the center of the seam, the unit vectors n i,l (from p i to p i,l ) and n i,r (from p i to p i,r ) on both sides of the laser stripe are projected onto plane i,1 to obtain ń i,l and ń i,r , respectively: where proj i (n i,l ) represents the projection vector of n i,l on i : and the rest is the same. The vector Z p i is the direction of the angular bisector between ń i,l and ń i,r .
To define the forward direction of tracking, the plane i,2 is defined as the plane passing through point P i with Z p i being the normal vector. To ensure that the feature point of the weld seam is always within the field of view of the camera during the tracking process, line P i+1 O c is defined between feature point P i+1 and the origin of the camera coordinate system O c . The intersection point of the extended line P i+1 O c and the plane 2i is M i . The unit vector from the current weld feature point P i to M i is defined as the forward direction vector X p i : Another direction vector Y p i can be obtained via the righthand rule, that is, Y p i = Z p i × X p i . Through the above steps, a local posture coordinate system constructed, representing its attitude at each point P i . Compared with traditional methods [3,4], the advantage of this tracking posture calculation method is that it can better deal with complex large-curvature weld seams. In particular, the robot moves to P i+1 while pointing to M i rather than P i+1 , such that the laser-vision sensor would not lose the tracking of the curved seam, as shown in Fig. 7.

Dual-queue tracking strategy
In actual welding, the welding pose also has a significant impact on the mechanical properties of welded joints [49]. The robot is in a normal posture has been given. However, in many manufacturing scenarios, the welding torch is not required to be in contact with (or perpendicular to) the welding surface. This requires the robot to adjust its posture appropriately during welding. Three main parameters can be tuned: the welding pitch d, travel angle , and working angle [50,51]. As shown in Fig. 8, for each weld seam path point P i , its local attitude is assumed to be B T i . Then, we have: where BT i is the expected pose for the welding torch to be at P i , and and are the angular offset between the tracking coordinate system and the local coordinate system for P i . By regulating T , the tracking sequence corresponding to each point in the path point sequence can be generated, as shown in Fig. 8. We used a position-based visual servo (PBVS) mechanism to control the movement of the robot. The robot keeps moving towards the target point Q i in the tracking sequence; once it reaches the point, the point is deleted from the memory, and the robot moves towards the next target point Q i+1 until the entire tracking process is completed. During this process, the welding torch of the robot must constantly change its position and attitude. To control the robot by adapting to different intervals of points in the tracking sequence, a novel and simple approach to for robot motion control is proposed.
Assuming that the robot moves in the velocity mode, the motion from point Q i to Q i+1 can be decomposed into where t x , t y , and t z are the translation velocities in the X, Y, and Z directions of the tool coordinate system, respectively, and R x , R y , and R z are the rotational velocity speeds in the corresponding directions. Let the translation vector between the current point Q i and the next point Q i+1 be: Suppose the time required for the robot to move from Q i to Q i+1 is t, then the speed of position movement is where = 1∕t is the speed adjustment of the position translation. The translation speed of the welding torch can be set during the tracking process by adjusting .
Assuming that when the welding torch reaches Q i+1 and simultaneously completes its posture transformation, it is preferable to set the posture transformation speed consistent with the translation speed . Let the pose of Q i and Δt z t = Δd Fig. 7 Forward direction comparison in normal tracking attitude with conventional methods [3,4]. The traditional method defines the tangential direction i of the path point as the forward direction of the torch, which is easy to lead the feature point to escape from the camera's field of view. a Forward direction defined by this method. b Forward direction defined by traditional methods Fig. 8 Dual-sequence tracking strategy for adjusting working parameters Q i+1 in the robot base coordinate system be R i and R (i+1) , respectively, and the transformation matrix between the two be ΔR , then By converting ΔR to RPY angle form, we can obtain Let Δr = R x ,R y ,R z and its normalized vector be Δr ; then, the final speed of pose transformation for the robot is Finally, the calculated speeds are transmitted to the robot to realize real-time changes in the robot pose. Despite tracking discrete points in the path, overall motion properties can be maintained consistently by unitizing the motion vector.

Continuous tracking of multi-weld seams
Because our welding system needs to be deployed in various workplaces and the posture of each placement is not fixed, it is necessary to guide the robot to the initial point of the weld seam. As introduced in Sect. 1, under an unstructured workspace and, for multi-seam welding, the initial position of every seam should be located. Fortunately, the CAD model of the workpiece provides us with reliable prior information. From the CAD model, the iterative closest point (ICP) algorithm [52] is used to obtain the pose of the workpiece CAD T C in the camera coordinate system using a 3D camera.

Global working parameters
As shown in Fig. 9a-b, the robot may collide with the workpiece near the corner. To accurately locate the initial point of the seam, we defined the direction vector Γ to guide the robot to scan the seam (Table 1). Several parameters are defined for multi-seam welding in the coordinate system of the CAD model {M} and the coordinate system of the robot base {B}, as shown in Table 1.

Global positioning of multiple welds
Point cloud registration is used to position the workpiece, as illustrated in Fig. 10. First, we sample points from the CAD model (Fig. 10b) to form a high-density point cloud, as shown in Fig. 10c. Then, we downsample the high-density point cloud to a sparse point cloud, as shown in Fig. 10d. The point cloud from the RGB-D camera is obtained after deploying the robot. Owing to the imaging mechanism of the laser speckle of the camera, there may be a large number of point cloud clutter in the field of view, as shown in Fig. 10e. Point cloud data filtering is applied to remove outlier and noise with the help of the filter module of the Point Cloud Library (PCL) [53], as illustrated in Fig. 10f. Correspondingly, we downsample the captured point cloud to a sparse cloud, as shown in Fig. 10g. Finally, the iterative closet point (ICP) algorithm is employed to match the two-point clouds in Fig. 10d and g, respectively, as shown in Fig. 10h.

Initial posture for different docking locations
For the portable system, the placement position is not necessarily the same each time; it is necessary to set a proper posture fixed to the workpiece to ensure that the robot can correctly image when it reaches the initial point of the weld seam. For any seam, after each placement of the robot, the following formula holds where superscript B, c, M, and t represent the base coordinate system {B} , camera coordinate system {c} , CAD model coordinate system {M} , and tool coordinate system {t} , respectively; t R c is the attitude of the camera coordinate system in the tool coordinate system, which can be obtained by hand-eye calibration; B R t can be queried from the robot controller; and M R c can be obtained by point cloud registration using a 3D camera.
To determine an appropriate posture, we assign the posture of the robot at the initial point in advance such that the laser stripe line is approximately in the middle of the image. We denote the pose of the robot as B ℜ t , and substitute it into Eq. (22) to compose the pose M ℜ B . From Eq. (23), we can obtain the required parameter denoted as M ℜ t . Because this attitude is the end-effector relative to the CAD coordinate system, it is independent of the deployment location of the robot. For any placement, where superscript i represents the deployment time. In this manner, the relative attitude of the end-effector to the workpiece can be kept unchanged by simply sending B R i t to the robot controller after each deployment of a robot.

Positioning of initial point
The automatic guidance of the initial point of the weld seam determines the success of welding. However, research on positioning the initial welding point remains problematic [54], and few studies have been reported. In this work, we use the point cloud registration method to roughly locate multiple weld seams and guide the robot to move to a point near the initial point. Then, a laser-vision sensor is scanned to locate the initial point accurately. As illustrated in Table 1, assuming that the initial point of a certain weld seam in the CAD model is x 0 , after applying the transformation in Eq. (6), we obtain the corresponding x 0 . Directing the robot to the initial point x 0 may lead to collisions due to an error in point cloud registration. Therefore, we construct a virtual ball using x 0 as the center and r as the radius so that the actual position of the welding torch falls on the ball sphere, as shown in Fig. 11a. Assuming that the coordinates of the initial alignment point on the sphere x m,0 , it can be determined by: where O is the origin of {B}, and BẐ t is the z-axis of B R i t in Eq. (24).
After reaching x m,0 , the weld seam is scanned according to the pre-defined direction Γ , and the initial point of the weld seam is accurately approximated by determining the shape of the light line. As shown in Fig. 11c, we consider the length of the laser stripe line on the left as the basis for the

Experiments
Three types of experiments were carried out to verify the feasibility of the proposed seam-tracking method. The first experiment was to verify the accuracy of our laser-vision sensor; the second experiment was to confirm the effect of single-weld seam tracking; and the last was to test the performance of multi-weld seam tracking with considering changeable elements under unstructured environments.
In the test of single-weld seam tracking, instead of choosing a real torch with a welding wire as the end-effector, we adopted a displacement sensor with a rigid pen as the experimental torch, see Figs. 13a and 15a. Compared with the deformable welding wire, it became easier to observe the subtle collision and interference between the end-effector and workpiece. After testing our tracking method for a single weld, we used a ship structure as a test artifact to verify the feasibility of the continuous tracking of multiple weld seams. The difference between multi-seam and single-seam tracking is that multiseam tracking requires the global positioning of the artifact. In this section, the system performance in terms of global positioning in an unstructured environment is also verified. The experimental platform for the case of multi-seam tracking is shown in Fig. 17.

Precision evaluation
Based on the mathematical model in Eq. (5) in Subsect. 2.3, we can obtain the three-dimensional coordinate P i = [X c , Y c , Z c ] T of a point in the camera coordinate system through the 2-dimensional pixel coordinate p i = [u, v] T in the image coordinate system. As shown in Fig. 12a, we kept the laser vision sensor stationary and placed the calibration plate at an appropriate position so that the edge of the chequerboard grid coincided with the laser stripe. We evaluate the accuracy of our model by measuring the sides of the squares. The side length error of each square is very small, and its declared value can be used as a theoretical value for the measurement. For a certain grid in a row, it is assumed that the coordinates of the left and right corner points were c P L = [x L , y L , z L ] T and c P R = [x R , y R , z R ] T , respectively. We define the measurement error as: We measured all the 324 squares on the calibration board and calculated their measurement errors, as shown in Fig. 12b. The results show that the average measurement error is Ẽ = 0.0991 mm, and the overall deviation range can be controlled within 0.1659 ∼ 0.0152 mm using our calibration method in Sect. 2.3.2. To further verify the 3D reconstruction capability of the designed sensor, we performed a 3D reconstruction of all pixel points on the entire laser stripe. As shown in Fig. 12c, the robot carried the sensor to scan a straight weld seam. The obtained result is shown in Fig. 12d, which clearly shows that our reconstructed data points reflect the 3D shape of the weld seam. (26)  c Relocating the position of the initial point by observing the shape of the laser stripe: 1-scenario far from the initial point; 2-scenario approaching the initial point; 3-scenario reaching the initial point

Seam tracking of a complex space curve
To verify the tracking method proposed in this work, a special part with a large curvature was selected for the experiment. As shown in Fig. 13a, when the initial point was given, the robot first moved toward it. Once it reached the initial point, the robot end-effector started an autonomous movement along the curved weld seam until it reached the given endpoint. A portion of the snapshots taken during the tracking process is shown in Fig. 13c. The entire tracking process did not require any manual intervention or prior information such as the curve equation of the weld seam, CAD model, or pre-taught trajectory. While the robot was tracking along the weld seam, we recorded the position of the robot end-effector in the backend program of the host computer and projected these position points onto the XOY plane of the robot base coordinate frame, as shown in Fig. 13b. It can be observed that the motion trajectory of the robot matches the profile of the part to be welded. The forward direction is vital for tracking the complex curved weld seams. To confirm the tracking stability, we recorded the pixel coordinates of all the feature points, as shown in Fig. 14a. The size of the image frame is 1920 × 960 pixels, and the red anchor is located at its center (960, 480). This shows that the feature points were maintained at the image center throughout the entire tracking process by our menthod. As illustrated in Fig. 7, for comparison, we set the forward direction as the tangent direction of the weld seam, and the result is shown in Fig. 14b-c. Noticeably, after a certain tracking time, the weld feature points escaped from the visible range of the image, which definitively led the tracking to fail.

Accuracy evaluation in single-weld seam tracking
The basic principle of the accuracy evaluation for weld seam tracking is to compare the moving trajectory of the welding torch with the actual weld seam curve. However, it is difficult to precisely obtain the true coordinates of the points on the weld seam. For this reason, most existing practices sampled the weld seam points using the teaching method to obtain the true coordinates of multiple trajectory points [3,4]. To compare the difference between the two kinds of trajectories more accurately, we first calibrated the position and pose between the coordinate system of the workpiece and the robot base coordinate system. The purpose is to convert the point coordinates of the weld to the base coordinate frame of the robot. The established workpiece coordinate system is shown in Fig. 15a. The coordinates of each point on the weld seam were extracted from the CAD model of the workpiece to obtain the actual trajectory of the weld seam via coordinate system transformation. Because we strictly controlled the manufacturing precision of the workpiece, we were able to ensure the consistency of the actual weld seam and trajectory on the CAD model. Assuming that a point on the weld seam in the workpiece coordinate system is expressed as P i , it can be converted to the base coordinate system by the following equation: By applying Eq. (27) to all the points on the weld seam, the trajectory of the actual weld in the robot base coordinate system can be obtained. Similarly, the normal attitude of each point can be calculated using the CAD model and used as the theoretical value.
The accuracy evaluation experiments were divided into four groups, as shown in Fig. 15b. When the working parameters were separately regulated, it was observed that the endeffector could move in the expected posture throughout the entire process, as shown in Fig. 15a. This demonstrates that the proposed dual-sequence tracking strategy is effective. For accuracy evaluation, we compare the recorded robot trajectory with the actual weld seam trajectory. After tracking with a normal attitude, we plot the motion trajectory of the robot and the actual weld seam, as shown in Fig. 16a. Evidently, the two trajectories are highly coincident. Fig. 16b shows that the tracking pose was close to the theoretical pose during the tracking process. Adding welding pitch, Fig. 16b shows that the robot motion trajectory is almost parallel to the actual weld seam trajectory and fits the actual trajectory well. For any point P i (x, y, z) on the motion trajectory of the end-effector, the nearest Euclidean point P i (x, y, z) is taken as its corresponding point on the weld joint, and the Euclidean distance e i = ‖P i − P i ‖ 2 between two points is regarded as the trajectory tracking error. The error statistics for the 4 groups of experiments are shown in Table 2. It can be quantitatively observed from Table 2 that the proposed method can maintain the mean error within 0.6 mm. Furthermore, (27)  it can be observed that the tracking test with the normal attitude has the highest accuracy, and adjusting the working parameters does not have a significant influence on the tracking accuracy.

Multi-weld seam tracking
It is known that illumination is the main factor affecting image quality and further affecting the positioning   performance. We also tested the global positioning performance of the system in an unstructured environment with different illumination conditions, that is, indoor and outdoor environments on a sunny summer day between 13:00 and 18:00. An adjustable light source was used to generate different lighting conditions in an indoor environment. An easy-to-measure assessment point in the structural part was used as a reference point to replace the initial point for testing, as shown in Fig. 17. As illustrated in Fig. 18, to evaluate the global positioning performance of the portable system, we positioned the workpiece at different placement positions and verified the reaching accuracy to a specified point and the retention of its end pose.
As shown in Fig. 18, even at different placement positions, the posture of the robot end-effector when reaching the assessment point is largely the same, which verifies the feasibility of our initial point positioning method.
Under certain lighting conditions, after the robot endeffector reached the assessment point in the desired posture, a vernier caliper was used to measure the distance between the end of the torch and the reference point. This distance is regarded as the positioning error of global positioning. We then maintained the lighting condition and changed the placement position of the robot to measure its positioning result, as shown in Fig. 19. This experiment was repeated 20 times, and the positioning errors were recorded along with the illumination conditions. Then, we moved the system to an outdoor environment and performed the same operation. As shown in Fig. 19, the first group of data is the statistical result of positioning errors 20 times under the 315 LX illumination, and the result of 1789−81400 LX illumination is from the outdoor environment test. It can be seen that even under strong sunlight, the positioning error is in the range of 10−25 mm, indicating that even if the robot is placed at different sites, our method can guide the robot to the vicinity of the initial point of the weld seam. We conducted a multi-seam tracking test with an experimental structure in an outdoor environment. The results show that the robot could track the multi-segment weld seam smoothly without human intervention. The recorded tracking trajectory is shown in Fig. 20. It can be seen that the welding trajectory of the robot fits the actual trajectory very well.
Overall, in terms of spatial weld seams, the proposed algorithm has better flexibility than the traditional teachingplayback working modes. Because of the excellent lightweight of the collaborative manipulator, the system is easy to place. Through human-machine collaboration, we can easily adjust the photo posture of the 3D camera to globally position the multiple weld seam in the workpiece, even if it is placed in a different position. We first performed experimental tests on a single weld seam under various conditions and then performed autonomous welding tests on multiple seams, and both obtained satisfactory results.

Discussion
Although certain progress has been made by this work, some technical limitations still exist and need to be further considered in future research. Here, the following four aspects are discussed.
1. Application scenario: Although a 6-DOF manipulator was used in the experimental setup, the proposed tracking method could also be applied to a welding cart with fewer DOFs. One potential application is mounting a 6-DOF cooperative manipulator on a mobile platform for more flexible welding tasks in unstructured environments. 2. Noise interference: The welding arc light can potentially interfere with feature point recognition. Because the effectiveness of the tracking method depends on the real-time detection accuracy of weld seams, a large amount of noises such as arc light and spatter during welding may affect feature point recognition. This problem needs to be solved in future studies. 3. Joint adaptability: In this work, the position and orientation are calculated using three feature points, and we performed verification for the lap joint, butt joint with V-groove, and T joint by experiments. However, different types of weld joints have different laser stripes appearances. Whether other types of weld seams, such as U-shaped weld joints or discontinuous weld seams whose laser stripes in images are broken at weld seam edges, can also be calculated in this way is a subject for further study. 4. Control unpredictability: In this study, a cubic polynomial was used to fit the path points and generate the direction of the weld seam. The fitting order must be adjusted based on the actual situation. An empirical suggestion is that the 3rd or 4th order is sufficient for most tasks, whereas the 5th order is prone to the Runge phenomenon, which may cause unstable robot motion. In addition, the parameter used to control the number of fitting points should be set within the range in [70,100] . Smaller values are also prone to unstable motions.

Conclusion
This study demonstrates an autonomous tracking method for multi-segment spatial weld seams. The experiments reveal good tracking performance. Applying the visual guidance method, a dual sequence tracking mechanism was proposed, which can effectively solve the problem that traditional methods cannot flexibly adjust important welding parameters such as working and travel angles. Autonomous tracking of multi-segment weld seams can be realized using point cloud registration for global workpiece positioning. By using a collaborative robot to form a portable automatic welding system, our research could better address the problem of autonomous tracking of spatial welds under an unstructured environment. The proposed method facilitates fully autonomous robotic welding in unstructured environments.

Declarations
Ethics approval Not applicable.
Consent for publication All authors have read and agreed to the published version of the manuscript.

Competing interests
The authors declare no competing interests.