Laser galvanometer automatic focus searching method based on polynomial regression algorithm
The automatic focusing method based on the polynomial regression algorithm solves the problem of large errors in traditional manual focusing, and achieves high-precision focusing and efficient processing of the laser beam, especially high-quality welding in scenarios where the workpiece surface is uneven.
Patent Information
- Application Number
- CN202510777896.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2045-06-11
AI Technical Summary
Traditional laser galvanometer focus search relies on manual adjustment, resulting in large focus errors, affecting the accuracy and quality of laser processing.
An automatic focusing method based on a polynomial regression algorithm is adopted to overcome the surface fluctuations and height changes of the target through real-time modeling and dynamic adjustment, ensuring that the laser beam is focused on the target surface.
It achieves high-precision focusing of the laser beam, improves processing accuracy and quality, especially in complex scenarios, reduces processing errors, and improves welding efficiency and product consistency.
Smart Images

Figure CN120669383A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of laser processing, optical focusing and automatic control, and in particular to a laser galvanometer automatic focusing method based on a polynomial regression algorithm. Background Art
[0002] In the field of laser processing, precise focusing is crucial to ensuring processing quality and accuracy. Traditional laser galvanometer focus search relies on manual mechanical adjustment or empirical parameter adjustment. This experience-based focus search can lead to large focus errors due to differences in human skill level, experience level, operating method, material type, flatness, lighting environment, and other factors, affecting laser processing accuracy and quality. Summary of the Invention
[0003] The purpose of the present invention is to provide a laser galvanometer automatic focusing method based on a polynomial regression algorithm. Through real-time modeling and dynamic adjustment, the defocusing problem caused by factors such as surface undulations and height changes of the target can be overcome, ensuring that the laser beam can always be well focused on the target surface.
[0004] To achieve the above object, the present invention provides the following technical solution: a laser galvanometer automatic focusing method based on a polynomial regression algorithm, characterized in that it includes the following steps:
[0005] Step S1, input variable definition: laser power P, workpiece inclination θ, galvanometer height H, actual roundness value D, predicted value D, actual roundness value D and predicted value Deviation ∈, actual roundness deviation threshold Th, optimal height H * ;
[0006] Step S2: collecting sample data in different power ranges from 10% to 80%, where each set of data contains a quaternion (P, θ, H, D), and performing data preprocessing;
[0007] Step S3: adopt a piecewise polynomial regression model and add an L2 regularization term to prevent the model from overfitting;
[0008] Step S4: For the piecewise polynomial regression model, by minimizing the observed value D i and predicted value The sum of squared errors between them is used to estimate the model parameters β0, β1, β2, β3, β4, γ0, γ1, γ2, γ3;
[0009] Step S5: Use the model to predict the predicted value in real time based on the current P, θ, and H input values Get predicted values The absolute value of the deviation ∈ from the actual roundness value D. If the absolute value of the deviation ∈ exceeds the threshold Th, the galvanometer height H or laser power P is dynamically adjusted to make the actual roundness value D approach the target value D. target =0;
[0010] Step S6: Obtain the optimal height H * , the system is based on the optimal height H * Adjust the Z-axis position of the galvanometer in real time to focus the laser beam at the optimal position;
[0011] Step S7: Periodically collect the actual roundness value D and the predicted value The deviation∈ is used to update the regression model coefficients to compensate for interference such as equipment aging and ambient temperature.
[0012] Furthermore, the data preprocessing in step S2 includes data cleaning, missing value processing, and standardization.
[0013] Furthermore, the piecewise polynomial regression model in step S3 is further:
[0014]
[0015] Where D is the actual roundness value, P is the laser power percentage value from 10% to 80%, and θ is the inclination of the workpiece.
[0016] H is the distance from the galvanometer to the workpiece surface, ∈ is the deviation term, and β0, β1, β2, β3, β4, γ0, γ1, γ2, γ3 are model coefficients.
[0017] Furthermore, the objective function after adding the L2 regularization term in step S3 is:
[0018]
[0019] in is the predicted value and minimize the observed value D i The sum of squared errors between λ||β|| 2 is the L2 regularization term, λ is the regularization parameter, and β is the coefficient vector.
[0020] Furthermore, the optimal height H in step S6 * The formula for obtaining is
[0021] Among them, P current is the current power of the sample, θ target is the sample target tilt angle. The calculation method is to find an optimal H value, which is recorded as H * , so that P current ,θtarget The function D of H reaches its minimum.
[0022] Furthermore, in step S4, the error sum of squares is calculated as Where n represents the number of samples, D i is the i-th minimized observation value, is the i-th predicted value, What is calculated is the sum of squares of the errors between the observed value and the predicted value. This sum is minimized by changing the model parameters, that is, using the least squares method to calculate. It means to find the minimum value of the following expression under the functional relationship of β. Here β is the parameter in the model. This method is introduced to find the optimal fitting curve.
[0023] Furthermore, the step S7 is further as follows: setting the collection period, determining the appropriate periodic collection time interval T according to the equipment operation characteristics and the frequency of interference factors, and starting at the start time t n Execute, where n=1,2,3..., at the start time t of each cycle n , collect the actual roundness deviation D and the predicted value The actual D of the equipment is collected through sensors and other devices n ; At the same time, the existing regression model is used to predict the operating status at the same time, and the prediction is obtained Calculate the actual value D n and predicted value The deviation ∈ n , deviation∈ n It reflects the error of the current regression model prediction, and the calculation formula is: The obtained deviation ∈ n , combined with historical deviation data, the gradient descent method is used to update the coefficients of the regression model to minimize the mean square error (N is the number of acquisition cycles) as the target, update the regression coefficient by gradient descent method, the learning rate is α, and the coefficient update formula is as follows:
[0024]
[0025] The updated regression model is used for subsequent prediction and control. The new model prediction will automatically consider the impact of factors such as equipment aging and ambient temperature, compensate for interference, and improve prediction accuracy and equipment control precision.
[0026] Beneficial effects of the present invention: The present invention realizes the coordinated optimization control of power-height-workpiece inclination, meets the precision requirements of complex processing scenarios, adopts a fully automatic galvanometer focus search method, based on a polynomial regression algorithm, effectively solves the bottlenecks of large error range of manual focus search, unstable welding quality, low welding efficiency, etc., has fast focus search speed and high precision, up to ±0.05mm, and through reasonable data processing, model design and optimization, improves the stability and generalization ability of the model, providing a strong guarantee for the high quality and high precision of laser processing. In practical applications, the system is expected to be widely used in various laser processing fields such as laser welding and laser cleaning to improve processing efficiency and product quality. In particular, for some processing scenarios where the surface of the workpiece is tilted or uneven, it can focus the laser beam more accurately, reduce processing errors, and improve product consistency and yield. Before each welding cycle, a one-button focus search function can be realized, and the galvanometer focus search and verification functions can be quickly executed. In the field of new energy lithium battery laser welding, the welding yield of the battery module is effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 is a flow chart of the method of the present invention;
[0028] Figure 2 This is a flow chart for preventing model overfitting of the present invention;
[0029] Figure 3 It is a flow chart of the adaptive compensation of the present invention. DETAILED DESCRIPTION
[0030] The present invention will be further described below with reference to the accompanying drawings.
[0031] See also Figures 1 to 3 The present invention provides a laser galvanometer automatic focusing method based on a polynomial regression algorithm, comprising the following steps:
[0032] Step S1, input variable definition: laser power P, workpiece inclination θ, galvanometer height H, actual roundness value D, predicted value D, actual roundness value D and predicted value Deviation ∈, actual roundness deviation threshold Th, optimal height H * ;
[0033] Step S2: collecting sample data in different power ranges from 10% to 80%, where each set of data contains a quaternion (P, θ, H, D), and performing data preprocessing;
[0034] Step S3: adopt a piecewise polynomial regression model and add an L2 regularization term to prevent the model from overfitting;
[0035] Step S4: For the piecewise polynomial regression model, by minimizing the observed value D iand predicted value The sum of squared errors between them is used to estimate the model parameters β0, β1, β2, β3, β4, γ0, γ1, γ2, γ3;
[0036] Step S5: Use the model to predict the predicted value in real time based on the current P, θ, and H input values Get predicted values The absolute value of the deviation ∈ from the actual roundness value D. If the absolute value of the deviation ∈ exceeds the threshold Th, the galvanometer height H or laser power P is dynamically adjusted to make the actual roundness value D target =0;
[0037] Step S6: Obtain the optimal height H * , the system is based on the optimal height H * Adjust the Z-axis position of the galvanometer in real time to focus the laser beam at the optimal position;
[0038] Step S7: Periodically collect the actual roundness value D and the predicted value The deviation∈ is used to update the regression model coefficients to compensate for interference such as equipment aging and ambient temperature.
[0039] The present invention will be further described below with reference to a specific embodiment:
[0040] A laser galvanometer automatic focus search method based on polynomial regression algorithm,
[0041] 1. Input variable definition: laser power P, workpiece inclination θ, galvanometer height H, actual roundness value D and predicted value Deviation ∈, actual roundness deviation threshold Th, optimal height H * ; Among them: Laser power P: the value range is 10% to 80% of the percentage value, and its change directly affects the energy input and spot characteristics of laser processing. Workpiece inclination θ: indicates the degree of inclination of the workpiece surface or axis relative to the reference, which has a potential impact on laser focusing and processing effects. Galvanometer height H: the distance from the galvanometer to the workpiece surface (mm), which is a key parameter for adjusting the laser focus position. Actual roundness value D: the measured spot roundness value (μm), the actual roundness value D is different from the predicted value Deviation ∈: the actual roundness value D and the predicted value The difference.
[0042] 2. Collect sample data in different power ranges from 10% to 80%. Each set of data contains a four-tuple (P, θ, H, D), and perform data preprocessing.
[0043] 2.1 Data preprocessing includes data cleaning, missing value processing, and standardization.
[0044] 2.2 The piecewise polynomial regression model is further:
[0045]
[0046] Where D is the actual roundness value, P is the laser power percentage value from 10% to 80%, θ is the inclination of the workpiece, H is the distance from the galvanometer to the workpiece surface, ∈ is the deviation term, and β0, β1, β2, β3, β4, γ0, γ1, γ2, and γ3 are model coefficients.
[0047] 2.3 As Figure 2 , in order to prevent the model from overfitting, the objective function after adding the L2 regularization term is:
[0048]
[0049] The objective function is the loss function J of the model fitting; is the predicted value and minimize the observed value D i The sum of squared errors between λ||β|| 2 is the L2 regularization term, λ is the regularization parameter, and β is the coefficient vector. This process describes the process of iteratively updating parameters based on the loss function until convergence during model fitting.
[0050] Calculate the loss function value J: The process begins by calculating the loss function value J based on the current model parameters. The loss function measures the difference between the model prediction value and the true value.
[0051] Judgment condition: Check whether the loss function value J is less than the preset loss function convergence threshold Tj, or whether the number of fitting iterations reaches the preset upper limit N max The convergence value Tj is a small value. When the loss function decreases to near this value, the model is considered to have converged. The upper limit of the number of iterations is the maximum number of iterations set to prevent the fitting process from looping infinitely.
[0052] If the conditions are met: it means that the model fitting has reached an acceptable state, the process enters the "output model parameters" step, outputs the current model parameters, and the fitting ends.
[0053] If the conditions are not met, the model has not converged and training needs to continue. At this point, the "Update Model Parameters" step is entered, where optimization algorithms such as gradient descent are used to adjust and update the model parameters based on the gradient calculated by the loss function, bringing the model predictions closer to the true values.
[0054] Loop calculation: After updating the model parameters, return to the "Calculate loss function value J" step, recalculate the model loss function value J after the updated parameters, and make a judgment again. Repeat this cycle until the judgment conditions are met and the fitting ends.
[0055] By adjusting the value of λ, a balance can be achieved between goodness of fit and model complexity, thereby improving the generalization ability of the model.
[0056] 3. Use a piecewise polynomial regression model and add an L2 regularization term to prevent the model from overfitting;
[0057] 4. For the piecewise polynomial regression model, by minimizing the observed value D i and predicted value The sum of squared errors between them is used to estimate the model parameters β0, β1, β2, β3, β4, γ0, γ1, γ2, γ3; the least squares method is the parameter estimation method in this system.
[0058] In step S4 described in 4.1, the error sum of squares is calculated as follows: Where n represents the number of samples, D i is the i-th minimized observation value, is the i-th predicted value, What is calculated is the sum of squares of the errors between the observed value and the predicted value. This sum is minimized by changing the model parameters, that is, using the least squares method to calculate. It means to find the minimum value of the following expression under the functional relationship of β. Here β is the parameter in the model. This method is introduced to find the optimal fitting curve.
[0059] 5. Based on the current P, θ, H input values, use the model to predict the predicted value in real time Get predicted values The absolute value of the deviation ∈ from the actual roundness value D. If the absolute value of the deviation ∈ exceeds the threshold Th, the galvanometer height H or laser power P is dynamically adjusted to make the actual roundness value D target =0;
[0060] 6. Obtain the optimal height H * , the system is based on the optimal height H * Adjust the Z-axis position of the galvanometer in real time to focus the laser beam at the optimal position;
[0061] 6.1 Optimal height H * The formula for obtaining is Among them, P current is the current power of the sample, θ target is the sample target tilt angle. The calculation method is to find an optimal H value, which is recorded as H * , so that P current ,θ targe The function D of t and H reaches its minimum.
[0062] 7. Periodically collect actual roundness value D and predicted value The deviation ∈ is used to update the regression model coefficients and compensate for interference such as equipment aging and ambient temperature. The flowchart of adaptive compensation is as follows: Figure 3 shown.
[0063] 7.1 Set the collection cycle. According to the equipment operation characteristics and the frequency of interference factors, determine the appropriate periodic collection time interval T. At the start time of each cycle, t n Execute, where n=1,2,3..., at the start time t of each cycle n , collect the actual roundness value D and the predicted value The actual D of the equipment is collected through sensors and other devices n ; At the same time, the existing regression model is used to predict the operating status at the same time, and the prediction is obtained Calculate the actual value D n and predicted value The deviation ∈ n , deviation∈ n It reflects the error of the current regression model prediction, and the calculation formula is: The obtained deviation ∈ n , combined with historical deviation data, the gradient descent method is used to update the coefficients of the regression model to minimize the mean square error (N is the number of acquisition cycles) as the target, update the regression coefficient by gradient descent method, the learning rate is α, and the coefficient update formula is as follows:
[0064]
[0065] The updated regression model is used for subsequent prediction and control. The new model prediction will automatically consider the impact of factors such as equipment aging and ambient temperature, compensate for interference, and improve prediction accuracy and equipment control precision.
[0066] The process starts with continuous detection and adjustment, constantly checking the real-time data D. When data anomalies or insufficiency are detected, data cleaning strategies such as missing value processing or supplementing boundary data are adopted. Then it is determined whether the processing strategy is satisfied. If not, the data cleaning strategy is repeated. If so, continuous detection and adjustment are continued.
[0067] In summary, the present invention realizes the coordinated optimization control of power-height-workpiece inclination, meets the precision requirements of complex processing scenarios, adopts a fully automatic galvanometer focus search method based on a polynomial regression algorithm, and effectively solves the bottlenecks of large error range of manual focus search, unstable welding quality, and low welding efficiency. It has fast focus search speed and high precision, which can reach ±0.05mm. Through reasonable data processing, model design and optimization, the stability and generalization ability of the model are improved, providing a strong guarantee for the high quality and high precision of laser processing. In practical applications, the system is expected to be widely used in various laser processing fields such as laser welding and laser cleaning to improve processing efficiency and product quality. Especially for some processing scenarios where the surface of the workpiece is tilted or uneven, it can focus the laser beam more accurately, reduce processing errors, and improve product consistency and yield. Before each welding cycle, a one-button focus search function can be realized, and the galvanometer focus search and verification functions can be quickly executed. In the field of new energy lithium battery laser welding, the welding yield of the battery module is effectively improved.
[0068] The above description is only a preferred embodiment of the present invention and should not be understood as limiting the present application. All equivalent changes and modifications made within the scope of the patent application of the present invention should fall within the scope of the present invention.
Claims
1. A laser galvanometer automatic focusing method based on a polynomial regression algorithm, characterized by: Including the following step: Step S1, input variable definition: laser power P, workpiece inclination θ, galvanometer height H, actual roundness value D, predicted value Actual roundness value D and predicted value Deviation ∈, actual roundness deviation threshold Th, optimal height H * ; Step S2: collecting sample data in different power ranges from 10% to 80%, where each set of data contains a quaternion (P, θ, H, D), and performing data preprocessing; Step S3: adopt a piecewise polynomial regression model and add an L2 regularization term to prevent the model from overfitting; Step S4: For the piecewise polynomial regression model, by minimizing the observed value D i and predicted value The sum of squared errors between them is used to estimate the model parameters β0, β1, β2, β3, β4, γ0, γ1, γ2, γ3; Step S5: Use the model to predict the predicted value in real time based on the current P, θ, and H input values Get predicted values The absolute value of the deviation ∈ from the actual roundness value D. If the absolute value of the deviation ∈ exceeds the threshold Th, the galvanometer height H or laser power P is dynamically adjusted to make the actual roundness value D approach the target value D. target =0; Step S6: Obtain the optimal height H * , the system is based on the optimal height H * Adjust the Z-axis position of the galvanometer in real time to focus the laser beam at the optimal position; Step S7: Periodically collect actual value D and predicted value The deviation∈ is used to update the regression model coefficients to compensate for interference such as equipment aging and ambient temperature.
2. The laser galvanometer automatic focusing method based on polynomial regression algorithm according to claim 1, Its characteristics are: The data preprocessing in step S2 includes data cleaning, missing value processing, and standardization.
3. The laser galvanometer automatic focusing method based on polynomial regression algorithm according to claim 1, Its characteristics are: The piecewise polynomial regression model in step S3 is further: Where D is the actual roundness value, P is the laser power percentage value from 10% to 80%, θ is the inclination of the workpiece, H is the distance from the galvanometer to the workpiece surface, ∈ is the deviation term, and β0, β1, β2, β3, β4, γ0, γ1, γ2, and γ3 are model coefficients.
4. The laser galvanometer automatic focusing method based on polynomial regression algorithm according to claim 1, Its characteristics are: The objective function after adding the L2 regularization term in step S3 is: in is the predicted value and minimize the observed value D i The sum of squared errors between λ||β|| 2 is the L2 regularization term, λ is the regularization parameter, and β is the coefficient vector.
5. The laser galvanometer automatic focusing method based on polynomial regression algorithm according to claim 1, characterized in that: The optimal height H in step S6 * The formula for obtaining is Among them, P current is the current power of the sample, θ target is the sample target tilt angle. The calculation method is to find an optimal H value, which is recorded as H * , so that P current ,θ target The function D of H reaches its minimum.
6. The laser galvanometer automatic focusing method based on polynomial regression algorithm according to claim 1, characterized in that: In step S4, the error sum of squares is calculated as follows: Where n represents the number of samples, D i is the i-th minimized observation value, is the i-th predicted value, What is calculated is the sum of squares of the errors between the observed value and the predicted value. This sum is minimized by changing the model parameters, that is, using the least squares method to calculate. It means to find the minimum value of the following expression under the functional relationship of β. Here β is the parameter in the model. This method is introduced to find the optimal fitting curve.
7. The laser galvanometer automatic focusing method based on polynomial regression algorithm according to claim 1, characterized in that: The step S7 further includes: setting a collection period, determining a suitable periodic collection time interval T according to the equipment operation characteristics and the frequency of interference factors, and starting time t n Execute, where n=1,2,3..., at the start time t of each cycle n , collect the actual roundness value D and the predicted value The actual D of the equipment is collected through sensors and other devices n ; At the same time, the existing regression model is used to predict the operating status at the same time, and the prediction is obtained Calculate the actual value D n and predicted value The deviation ∈ n , deviation∈ n It reflects the error of the current regression model prediction, and the calculation formula is: The obtained deviation ∈ n , combined with historical deviation data, the gradient descent method is used to update the coefficients of the regression model; to minimize the mean square error (N is the number of acquisition cycles) as the target, update the regression coefficient by gradient descent method, the learning rate is α, and the coefficient update formula is as follows: The updated regression model is used for subsequent prediction and control. The new model prediction will automatically consider the impact of factors such as equipment aging and ambient temperature, compensate for interference, and improve prediction accuracy and equipment control precision.
Citation Information
Patent Citations
Device and method for machining zero-taper group holes through laser numerical control machine tool
CN116652416A
OCT light path compensation method based on laser galvanometer welding and application
CN118917047A
Laser weeding method of weeding robot and laser weeding robot
CN119837105A
Method and laser processing system for laser welding
US20250058407A1
Method and device for introducing a cut in a workpiece
WO2021043970A1