Automatic Compensation of Workpiece Positioning Tolerances for Precise Laser Welding

Despite significant advances in micro-technology lasting recent decades, precise and cost-efficient welding still poses a big challenge. Usually, tedious and error-prone manual interaction is required to adjust currently available welding machines to precisely join two parts with a laser beam. This adjustment is additionally exacerbated if flexible parts or parts with loosely fixed counter pieces (see Fig. 1) are to be welded. In these cases each part has to be adjusted individually or clamped precisely, which leads to an increase in production costs. One of the major applicatios of laser welding is the production of medical devices, e.g., welding the housing for cardiac pacemakers or endoscopes. Other applications are in environmental engineering, e.g., water filters that are capable of filtering harmful microorganisms out of drinking water, see Fig. 1.


Introduction
Despite significant advances in micro-technology lasting recent decades, precise and cost-efficient welding still poses a big challenge.Usually, tedious and error-prone manual interaction is required to adjust currently available welding machines to precisely join two parts with a laser beam.This adjustment is additionally exacerbated if flexible parts or parts with loosely fixed counter pieces (see Fig. 1) are to be welded.In these cases each part has to be adjusted individually or clamped precisely, which leads to an increase in production costs.
One of the major applicatios of laser welding is the production of medical devices, e.g., welding the housing for cardiac pacemakers or endoscopes.Other applications are in environmental engineering, e.g., water filters that are capable of filtering harmful microorganisms out of drinking water, see Fig. 1.
To provide these high-tech goods for emerging markets, a production technology is needed which meets the require-ments concerning accuracy and production costs.We therefore aim to simplify the production process by equipping an existing assembly system with sensors and intelligence.To avoid an excessive increase in costs, we try to make efficient use of system-immanent components.More precisely -firstly, we enable the machine to acquire high-resolution images of the workpieces with a single camera, secondly we enable the positions of the workpiece to be estimated automatically, and finally we adapt the position of the laser to possible offsets between nominal and detected positions.
The paper is organized as follows: First, the hardware setup for welding and image acquisition is described.Second, the concept for position estimation and for transforming the welding contours is introduced.Finally, an evaluation of position estimation and a typical welding result is presented.The paper concludes with a summary and conclusions.

Hardware setup
To perform laser welding with an assembly machine, one of the most important problems concerns the positioning of the focused laser beam on the object to be welded.The solutions to this problem are highly diverse, ranging from moving workpieces via translation stages to static workpieces with fiber lasers moved by robots.We chose a constellation which is close to the latter.The workpiece is immobile and the laser adapts to the position of the workpiece.To achieve a high dynamics of the assembly machine, a so-called scanner is employed instead of a robotic arm.This scanner consists of two orthogonal turnable mirrors, which are capable of precisely positioning the laser beam in the plane of the workpieces (see Fig. 2).Corresponding to the reduced moving mass of the mirrors in comparison to a robotic arm, the dynamics and thus the throughput rates of the welding parts can be significantly increased.In addition to laser positioning, this setup can be beneficially used for high-resolution image acquisition with a standard camera.To this end, we employ specially designed beam splitter optics, which allows the optical path of the laser through the scanner to be shared with that of the camera (see Fig. 3).Thus, the camera field-of-view (FOV) can be moved within the plane of the workpiece just like the laser.With this system we acquire high resolution image tiles and corresponding information about the FOV positions in order to stitch the tiles to an overall image.In contrast to systems which use static cameras, we can hence create an overall picture with much greater resolution or size.High resolution is required because the size of the workpieces is approximately 6 orders of magnitude higher than the sought accuracy of position detection.Since the diameter of the welding spot is approximately 300 mm, an offset of ±50 mm is in most cases tolerable.

Structure of the software framework
In order to implement the adaptation of the welding laser to the position of the workpiece, several steps have to be carried out, as follows: 1. Image acquisition and stitching.
3. Feature based position estimation and computation of the offset to nominal position.4. Transformation of the welding contour. 5. Welding.
First, as already mentioned, image tiles have to be acquired and stitched to an overall image.Since the scanner knows the positions of these tiles with sub-pixel accuracy, we can omit time-consuming matching and position estimation steps and directly stitch the tiles at the correct positions.However, to avoid artifacts at the image junctions due to different brightnesses, single-band blending is used, which smoothly blends one image into the adjacent image.
The second step is to define and extract the features to be used for identifying the position of the workpiece.These features have once to be defined by the user, since it is difficult to automatically omit features which are not relevant for estimating the subsequent position.The filter part in Fig. 1 provides a good example of this: The aim is to weld the loosely positioned membrane along its rim to the body of the filter.Therefore, it is essential to use only features of the membrane, e.g. its edge, instead of features of the body of the filter, which would hamper the correct detection of the membrane's position.A further aspect that motivates the proposed feature based position estimation is related to the third step in the item list.Here, the difficulty is to obtain nominal values for the positions which are later used to determine the offsets, and to transform the welding contour correspondingly.Since these nominal values are usually available from CAD-data (Computer Aided Design), it is meaningful to use a procedure that is "compatible" with this data.As the appearance of surfaces is still only coarsely modeled in present-day CAD--Programs, and it is often far from reality, only edges and their geometric representations appear to be suitable for being matched with real images.Thus, the nominal values for lines, circles, arcs of circles, corners and ellipses can be extracted from CAD-data without excessive effort.

Feature extraction
The feature extraction algorithm is required to achieve high robustness, high accuracy and a high throughput rate.Since the user is required to explicitly define the features to be selected for position estimation, for the reasons given above, it is not too time-consuming to also select a region of interest (ROI) that is big enough to cover position tolerances.Within the ROI, the desired feature is extracted robustly and with sub-pixel accuracy, as described in greater detail below.The detection of only one feature per ROI may be seen as a restriction, but it inherently avoids ambiguity of feature detection and matching within one ROI.In addition, it has not shown to be adverse in practice.
After defining the ROI and selecting one of five possible features -such as line, circle, arc of a circle, ellipse, cornerthe next step is robust and sub-pixel accurate extraction.Since the size of the overall image can exceed 10 million pixels, the ROI-size may still be about 1 megapixel and more.Well-known algorithms such as the Canny edge detector [2] in combination with the Hough Transform [7] for line or circle fitting are too costly, since they are not perfectly adapted to the problem at hand and they evaluate the entire ROI.To obtain the required throughput in detection, further speedup is needed.To this end, we have developed an approach which is time-efficient and robust.This approach consists of two steps: estimating the positions of contour points, and fitting a chosen model to the points determined in this way.This approach can be used for robust estimations of the parameters of the mentioned features, except for the edge, which is determined using the SUSAN corner detector [12].

Contour point estimation
To estimate the contour points, a predetermined number of line profiles is evaluated.These profiles are roughly positioned orthogonally and equally spaced to the sought contour, when defining the ROI.Thus, the sought contour is sampled by only considering the pixels of the line profiles (and their neighborhoods), instead of evaluating the entire ROI.To make a robust estimate of the contour points within these profiles, we applied two different models.

Step edge model
This model consists of a set of step edges with predefined edge positions, which are correlated with the line profiles [10].The resulting position of the contour point is determined by evaluating which step edge model corresponds to the maximal correlation value.Thus, the position of the step edge in this model defines the position of the sought contour point.Since the models always cover entire profiles and, consequently, all pixels are considered, a high degree of robustness is achieved -outliers due to noise are canceled out.In addition, the step edge approach is well tailored to the problem, since it finds the one sought contour point for each profile.
The step edge approach is most suitable to robustly detect the transition between two adjacent areas of slightly different gray values, even in noisy images.

Sobel edge model
The Sobel edge model utilizes the well-known filter kernel from the Sobel operator [1].Here, it is assumed that an edge is defined as a sharp transition orthogonal to the edge and a small transition in the direction of the edge.This model is transferred to the Sobel filter kernel, which consists of Gaussian smoothing combined with a derivation in the orthogonal direction.To apply this model to contour point detection, we first rotated the filter kernel so that the derivation is computed in the direction of the profile and the smoothing is computed orthogonally to the profile.Then, this rotated filter is applied to each pixel of the profile and its neighborhood.This procedure yields an optimal response to edges orthogonal to the profiles.A simplification of this procedure may be to compute the dot product of the gradient and the unit vector pointing in the direction of the profile.However, this procedure would lack the directional smoothing of the rotated Sobel kernel, and would therefore yield a lower degree of robustness.The Sobel edge model is suitable for detecting edges, when the step edge model cannot be applied because the constraint of large adjacent and homogeneous areas is violated.

Model fitting
Since the detected contour points may not be free from outliers, it seems reasonable to use robust methods for fitting the geometric models to the points.To this end, the RANSAC algorithm (RANdom SAmple Consensus) [3,11] is used.This algorithm is able to eliminate outliers and hence use the points that are assumed to be undisturbed for fitting.To this end, we need mathematical definitions of the geometric primitives to be fitted and a measure for assessing the distance of each contour point to the given model.A description of all four models (circle, circle arc, ellipse, line) would go beyond the scope of this paper.We therefore elaborate more on the example of circle detection, since the basic steps are similar to the algorithms for the other models.
The algebraic model of a circle in the plane can be expressed as [5] a c T T with a ¹ 0, p = ( , ) The center of the circle c and the radius r can be determined from these parameters as The insertion of n > 3 contour points in (1) results in an overdetermined linear system of equations, which is B is the matrix of the contour points and u is the vector of the sought circle parameters.Thus, the problem to be minimized can be formulated as with the constraint of u 2 1 = to avoid obtaining the trivial solution.This can be reformulated as where the eigenvector v opt of B T B, which belongs to the smallest eigenvalue l 4 , equals the sought parameter vector u.Thus, the circle parameters c and r can be determined.
As already mentioned, the detected contour points may be subject to gross outliers, which can corrupt the fitting result and thus deteriorate the accuracy of the position estimation.Therefore, we utilize the RANSAC algorithm for robust outlier elimination.In the case of circle fitting, the procedure is as follows [3]: 1. Select a set of at least three determined contour points randomly, 2. Construct a circle through these (e.g. with least squares circle fitting), 3. Count the number of points which lie within a predetermined error tolerance to the circle (so-called inliers), 4. If the number of inliers is greater than some predefined threshold, do least squares circle fitting (as explained above) for all inliers, else repeat the process, i.e. start again at 1., until a maximum number of trials is reached.
With this procedure, a circle can be correctly fitted even in challenging images.
The use of line-shaped profiles for contour point detection instead of entire images or ROIs permits a speed up, which is required for executing one detection and welding cycle per second (detection with a standard PC, 2.6 GHz, Dual-Core, C++ implementation).In addition, sub-pixel accuracy is accomplished by means of least squares fitting to the RANSAC-Inliers.

Offset computation and correction
In the case of extracting a single feature, e.g. a circle, it is easy to determine an offset between the detected value and a given nominal value.Since the system is restricted to the correction of translation and rotation, one circle only contributes to translation estimation.Thus, correction of the welding contour is a simple shift in its coordinates.
In the case of two or more detected circles with different center positions, a rotation may be additionally determined.
To avoid approaches such as chamfer matching [6], which require costly iterative optimization for position estimation, we used a direct algebraic and model-oriented way.In contrast to (local) optimization approaches, we thus avoid missing the global optimum, which represents the sought position.
In order to apply our direct algebraic approach, which uses the RANSAC algorithm and the similarity transform [9], the different features have first to be brought to a uniform level.To this end, an examination of the descriptions of the feature is replaced by considering (center) points and angles.Thus, e.g. an ellipse is represented by its centroid and an angle, a circle is represented by its center, and so on.
In the next step, the RANSAC algorithm is used to eliminate outliers.Then, at first, a rotation is computed by only considering the mentioned points and their corresponding nominal values (angles are considered later).Hence, we use the similarity transform in order to obtain a linear set of equations and thus avoid sine and cosine terms.The structure of the linear equation set is where u i x i y i T u u = ( , ) , and ( 8 ) Between this value and the angles, possibly determined directly by the features (e.g. the angles of lines and ellipses), the weighted average is computed.After the computation of this result, the points of the feature are rotated inversely and the translation is determined as the mean of the distances between the point pairs.
Hence, the sought rotation and the offset are determined robustly and without iterative optimization steps.Finally, the welding contour has to be transformed correspondingly.This is straightforwardly implemented as a multiplication of the welding coordinates with an adapted transformation matrix.

Experimental results
To evaluate the accuracy of the position estimation, images of real workpieces were acquired using a galvanometer scanner and stitched (see Fig. 5).These images were synthetically rotated and shifted with sub-pixel accuracy.Hence, a reliable ground truth is created.Within these images, the pro- posed algorithms for feature extraction and offset estimation are applied.The results obtained with the images in Fig. 5 are presented in the boxplot [8] in Fig. 6.Despite the challenging real world images, the range of deviations for circle detection is smaller than 2 pixels, which is in our case less than 13 mm.In case of the arc of a circle, the same image is used but only a quarter of a circle is employed for position detection.This is more time efficient, since only a quarter of the overall image has to be acquired, but the accuracy is significantly decreased.In position estimation with two orthogonally intersecting lines, the worst case scenario is a deviation of 9 pixels, which corresponds to 60 mm.However, the image used for line detection depicts an SMD-chip (Surface Mounted Device), where the lines are fitted to the rows of pins.The rows are fragmented due to the gaps between the pins.This complicates the task of fitting a line with such high accuracy.The image of the ellipse is affected by strong artifacts which hamper higher accuracy.In addition, the ellipse has the highest number of degrees of freedom.Since the number of contour points which are used for fitting is constant, the relative number (related to the degrees of freedom) for the ellipse is lower.This causes a decay in accuracy.
The results of the algorithm for offset computation are used for rotating and shifting the welding contour correspondingly.The final aim is to execute the welding process at the correct position.In order to obtain preliminary evidence, three of the filter membranes in Fig. 1 have been welded at position variations of about 1 mm.The final position deviation of the overall system did not exceed 30 mm.An example of successive welding obtained with our system is presented in Fig. 7.

Summary, conclusions
This paper addresses the problem of tedious and error-prone adjustment of present-day laser welding machines.Especially for high-tech goods in medical or environmental applications, high precision is required at moderate levels of production costs.To this end, a conventional welding machine has been equipped with the capability to react automatically to varying positions of the parts to be welded.In this way, costly manual adjustment can be reduced to a minimum and high-tech goods could become more attractive for emerging markets.
The proposed procedure can be subdivided into the steps of image acquisition, stitching, feature extraction, position estimation, transformation of the welding contour and, finally, successful welding.These steps have been described and eval-Fig.6: Boxplot, illustrating the deviations of 20 measurements from ground truth ("Circle x" e.g.denotes the deviations in the x-direction, when a circle is used for position estimation."Lines rot." denotes the deviation of the determined rotation from ground truth, in degrees).The lines in the boxes mark the medians, the boxes encompass the two inner quartiles of the quantity of results, while the "whiskers" and crosses mark the two remaining outer quartiles.Fig. 7: Welding result: Filter part and its weld seam uated in detail.The evaluation results show that high standards of accuracy can be achieved by the entire system.

Fig. 1 :
Fig. 1: Prototype of a clear water filter: (a) filter membrane, (b) fil-ter body with deepening, (c) membrane loosely positioned within the deepening.To prevent it from warping, the membrane has to be welded exactly along its edge.

Fig. 2 :Fig. 4 :
Fig.2: Scheme of a galvanometer-driven scanner[4] build a set of m point pairs, which are composed of the detected points such as the centers of the circles and their corresponding nominal values.The parameters a, b, c, d form the matrix of the similarity transform and encode the sought rotation and a scaling.The rotation angle a can be computed by determining the pseudoinverse of A, e.g., via singular value decomposition and the computation of a = arctan ( , ) 2 b a .

Fig. 5 :
Fig. 5: Stitched images used for evaluating the accuracy in position estimation