Algorithm and system for handheld welding gun to adapt to focal length of gun barrel
By calculating the scale factor of the gun barrel after the handheld welding gun is replaced and using the linear proportional relationship and Taylor expansion function, the problems of welding precision and flexibility after the gun barrel is replaced are solved, and the welding precision and accuracy are maintained.
Patent Information
- Application Number
- CN202511221500.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-29
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-08-29
AI Technical Summary
Existing handheld welding guns require recalibration of the scale factor after replacing the gun barrel, resulting in low flexibility and increased time and energy costs, affecting welding precision and accuracy.
By calculating the scale factor and rotation angle of the first gun rod, the scale factor of the replaced gun rod is calculated using the linear proportional relationship, keeping the welding pendulum width unchanged, and using the Taylor expansion function to optimize the calculation efficiency.
It improves welding precision and accuracy, enhances the flexibility of handheld welding guns when scenes change, and reduces the time and energy cost of recalibrating scale factors.
Smart Images

Figure CN120744273A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of handheld welding gun laser welding, and in particular to an algorithm and system for adaptively adjusting the focal length of the gun barrel of a handheld welding gun. Background Art
[0002] When using a handheld laser welding torch, the torch often needs to be replaced when the application scenario changes. For example, when the weld seam is located deep inside the workpiece or in a very narrow space, a standard-length torch cannot reach the desired weld angle or reach the desired depth. In this case, a torch with a longer focal length is required to allow the laser focus to reach the deeper weld location while maintaining the torch body outside the workpiece. However, since the welding torch has a fixed scale factor, changes in the new torch's focal length will cause the weld's swing width to change, reducing welding precision and accuracy.
[0003] In the prior art, in order to avoid such problems, it is necessary to recalibrate the welding gun's scale factor after replacing the gun barrel, which is less flexible and increases energy and time costs. Summary of the Invention
[0004] In view of this, the present invention provides an algorithm for adaptively adjusting the focal length of the gun barrel of a handheld welding gun. Specifically, the technical solution of the present invention is as follows: S1: Obtaining a first actual pendulum width and a first set pendulum width of a first gun rod, and calculating a first scale factor, wherein the first actual pendulum width is the pendulum width when the first set pendulum width is the maximum; S2: Acquire a first focal length of the first gun barrel, and calculate a first rotation angle based on the first focal length and a first actual pendulum width; S3: Obtaining a second focal length of the second gun barrel, and calculating a second rotation angle based on the second focal length and the first actual swing width; S4: Calculating a second scale factor based on a linear proportional relationship between the first scale factor, the first rotation angle, and the second scale factor, the second rotation angle.
[0005] Furthermore, in S1, the first actual pendulum width and the first set pendulum width of the first gun rod are obtained, and the relevant expression for calculating the first scale factor is: ,in, is the first actual pendulum width, Set the pendulum width for the first time, is the motor fixed coefficient, is the first scale factor; Adjust the first scale factor , until the first setting pendulum width and the first actual pendulum width The values are the same, at this time .
[0006] According to a preferred embodiment, the first actual pendulum width is obtained When , n measurements are performed, the minimum and maximum values are removed, and the remaining data are averaged.
[0007] According to a preferred embodiment, if the first actual pendulum width finally calculated is If the value is smaller than the judgment threshold, it is corrected by a correction coefficient. The judgment threshold is related to the characteristics of the galvanometer motor and its position sensor of the handheld welding gun and is generally at the millimeter level.
[0008] Furthermore, in S2, the first focal length of the first gun barrel is obtained, and the relevant expression for calculating the first rotation angle based on the first focal length and the first actual pendulum width is: ,in represents the first rotation angle, Indicates half of the first actual pendulum width, Indicates the first focal length.
[0009] Furthermore, in S3, the second focal length of the second gun barrel is obtained, and based on the second focal length and the first actual swing width, the relevant expression for calculating the second rotation angle is: ,in represents the second rotation angle, represents half the target swing width of the second gun, and , Indicates the secondary focal length.
[0010] Furthermore, based on the linear proportional relationship between the first scale factor, the first rotation angle, the second scale factor, and the second rotation angle, the second scale factor is calculated as: The linear proportional relationship is ,in represents the second scale factor, then .
[0011] According to a preferred embodiment, the arc tangent function is calculated by a Taylor expansion function.
[0012] According to a preferred embodiment, when the maximum approximation error is allowed to be below 0.0015 rad, the Taylor expansion function adopts the following formula: ,in, express or .
[0013] Accordingly, the present invention also provides a system for adaptively adjusting the focal length of a handheld welding gun, which is used to execute any of the above algorithms and is built into the handheld welding gun.
[0014] The present invention calculates the first scale factor and first rotation angle of the first gun rod, sets the swing width of the second gun rod to the first actual swing width, and then calculates the second rotation angle. Finally, the second scale factor is calculated based on the linear proportional relationship between the first scale factor, the first rotation angle, the second scale factor, and the second rotation angle. This ensures that the maximum swing width of the welding gun after replacement is equal to the swing width before replacement, thereby ensuring welding precision and accuracy and improving the flexibility of the handheld welding gun in changing scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 This is a diagram of the algorithm steps for adaptively adjusting the focal length of the handheld welding gun in the present invention; Figure 2 It is a schematic diagram of the swing of the first gun rod and the second gun rod in the present invention. DETAILED DESCRIPTION
[0016] When using a handheld laser welding torch, the torch often needs to be replaced when the application scenario changes. For example, when the weld seam is located deep inside the workpiece or in a very narrow space, a standard-length torch cannot reach the desired weld angle or reach the desired depth. In this case, a torch with a longer focal length is required to allow the laser focus to reach the deeper weld location while maintaining the torch body outside the workpiece. However, since the welding torch has a fixed scale factor, changes in the new torch's focal length will cause the weld's swing width to change, reducing welding precision and accuracy.
[0017] In the prior art, in order to avoid such problems, it is necessary to recalibrate the welding gun's scale factor after replacing the gun barrel, which is less flexible and increases energy and time costs.
[0018] In view of this, the present invention provides an algorithm for adaptively adjusting the focal length of the gun barrel of a handheld welding gun. To further clarify the objectives, technical solutions, and advantages of the embodiments of this application, various embodiments of this application are described in detail below with reference to the accompanying drawings. However, those skilled in the art will appreciate that numerous technical details are provided in various embodiments of this application to facilitate a better understanding of the present application. However, even without these technical details and the various variations and modifications based on the following embodiments, the claimed technical solutions can still be implemented.
[0019] In the following description, for the purpose of illustrating the various disclosed embodiments, certain specific details are set forth in order to provide a thorough understanding of the various disclosed embodiments. However, those skilled in the relevant art will recognize that the embodiments may be practiced without one or more of these specific details. In other cases, well-known devices, structures, and techniques associated with this application may not be shown or described in detail to avoid unnecessarily obscuring the description of the embodiments.
[0020] Unless the context requires otherwise, throughout the specification and claims, the word "comprise" and variations such as "include" and "have" should be construed in an open, inclusive sense, that is, should be interpreted to mean "including, but not limited to."
[0021] The following will describe in detail the various embodiments of the present application in conjunction with the accompanying drawings to provide a clearer understanding of the purpose, features, and advantages of the present application. It should be understood that the embodiments shown in the accompanying drawings are not intended to limit the scope of the present application, but are only intended to illustrate the essential spirit of the technical solution of the present application.
[0022] Reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. Thus, the appearances of "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any manner in one or more embodiments.
[0023] Specifically, such as Figure 1 As shown, in one embodiment of the application, the present invention provides an algorithm for adaptively adjusting the focal length of the gun rod of a handheld welding gun, such as Figure 1 As shown, the following steps are included: S1: Obtaining a first actual pendulum width and a first set pendulum width of a first gun rod, and calculating a first scale factor, wherein the first actual pendulum width is the pendulum width when the first set pendulum width is the maximum; S2: Acquire a first focal length of the first gun barrel, and calculate a first rotation angle based on the first focal length and a first actual pendulum width; S3: Obtaining a second focal length of the second gun barrel, and calculating a second rotation angle based on the second focal length and the first actual swing width; S4: Calculating a second scale factor based on a linear proportional relationship between the first scale factor, the first rotation angle, and the second scale factor, the second rotation angle.
[0024] The present invention calculates the first scale factor and first rotation angle of the first gun barrel (i.e., the initial gun barrel), and sets the swing width of the second gun barrel (i.e., the replaced gun barrel) to the first actual swing width to determine the second rotation angle. Finally, the second scale factor is calculated based on the linear proportional relationship between the first scale factor, the first rotation angle, the second scale factor, and the second rotation angle. This ensures that the maximum swing width of the replaced welding gun is equal to the swing width before replacement, ensuring welding precision and accuracy and improving the flexibility of the handheld welding gun in changing situations.
[0025] Next, combine Figure 2 A more detailed description of the algorithm steps: The swing width of the handheld welding gun is mainly achieved by the galvanometer motor driving the rotor to rotate, thereby driving the reflector installed on the rotor to rotate. The reflector reflects the laser, and the rotor rotates symmetrically around the center point to achieve energy spot welding in a line. The swing width is related to the angle of rotation of the motor and the focal length of the gun barrel.
[0026] The swing of the first gun lever can be visualized as an isosceles triangle AGH. The height AM of the triangle AGH is the first focal length of the first gun lever, and GH is the first actual swing width, or the maximum achievable swing width. The scale factor is a property of the handheld welding gun and is positively correlated with the swing angle. The first scale factor represents the scale factor of the handheld welding gun when using the first gun lever, corresponding to the angle GAH.
[0027] After replacing the gun rod, the pendulum can be viewed as a new isosceles triangle ABC. The focal length of the second gun rod is greater than that of the first, i.e., the second focal length is greater than the first. Correspondingly, the height AD of triangle ABC is the second focal length of the second gun rod. If the first scale factor remains unchanged, i.e., the corresponding angle GAH remains unchanged, the pendulum width is BC, indicating that BC > GH. As can be understood, the change in pendulum width reduces operational precision and accuracy. Therefore, the present invention aims to ensure that the pendulum width after replacing the gun rod still maintains the same value as the first actual pendulum width GH.
[0028] Specifically, by drawing perpendicular lines through points G and H to BC, intersecting them at points E and O, respectively, we can see that length GH = EO. Therefore, knowing only the angle EAO is necessary to make the second gun swing width equal to the first actual swing width. Knowing the angle EAO, we can calculate the scale factor at this point, which is the scale factor for holding the welding gun when using the second gun, the second scale factor.
[0029] Furthermore, in S1, the first actual pendulum width and the first set pendulum width of the first gun rod are obtained, and the relevant expression for calculating the first scale factor is: ,in, is the first actual pendulum width, Set the pendulum width for the first time, is the motor fixed coefficient, is the first scale factor; Adjust the first scale factor , until the first setting pendulum width and the first actual pendulum width The values are the same, at this time .
[0030] In the above description, the first actual pendulum width is the maximum achievable pendulum width, which is obtained by maximizing the first set pendulum width.
[0031] Furthermore, the first actual pendulum width is obtained When performing n measurements, remove the minimum and maximum values, and average the remaining data. This avoids errors in single measurements and maximizes data stability.
[0032] When the swing width is small, such as when judging the threshold swing width, the motor position resolution error is large; the swing width needs to be corrected, and the correction coefficient is , so that the correction factor and the first actual pendulum width Multiplication. Correction factor The specific value of can be obtained based on experimental data to reduce the impact of resolution error.
[0033] Furthermore, in S2, the first focal length of the first gun barrel is obtained, and the relevant expression for calculating the first rotation angle based on the first focal length and the first actual pendulum width is: ,in represents the first rotation angle, Indicates half of the first actual pendulum width, that is, half of GH in the figure, GM. Indicates the first focal length AM.
[0034] Furthermore, in S3, the second focal length of the second gun barrel is obtained, and based on the second focal length and the first actual swing width, the relevant expression for calculating the second rotation angle is: ,in represents the second rotation angle, represents half the target swing width of the second gun, that is, half ED of EO, and , that is, ED=GM, Denotes the second focal length, i.e. AD. Therefore, the calculation of the second rotation angle is achieved so that the pendulum width does not change. In addition, the values of the focal lengths are all known.
[0035] In the above, for the sake of computational complexity, the first rotation angle and the second rotation angle In reality, it's half of their respective true rotation angles. That is, half of the angles GAH and EAO. Calculating these two angles directly using conventional inverse tangent functions consumes more computing resources and is less practical for single-chip systems with handheld welding guns. The present invention uses a Taylor expansion fitting method to improve computational efficiency.
[0036] Furthermore, the rotation angle of the motor and the scale factor are linearly related. That is, in S4, based on the linear proportional relationship between the first scale factor, the first rotation angle and the second scale factor, the second rotation angle, the second scale factor is calculated as: The linear proportional relationship is ,in represents the second scale factor, then . And because , then finally .
[0037] The trigonometric functions built into the microcontroller system of a handheld welding gun often require a significant amount of time to calculate. Considering practical applications, it is desirable to save runtime at the expense of acceptable accuracy. Specifically, the inverse tangent function is calculated using the Taylor expansion function. For example, when the maximum approximation error is allowed to be less than 0.0015 rad, the Taylor expansion function is expressed as follows: ,in, express or . In order to take into account the actual conditions as much as possible.
[0038] Correspondingly, the present invention also discloses a system for adaptively adjusting the focal length of the gun barrel of a handheld welding gun, which is used to execute the above algorithm and is built into a handheld welding gun, such as a single-chip microcomputer, to achieve automatic calculation and improve efficiency and flexibility.
[0039] The above is a detailed introduction to the algorithm and system for adaptive gun barrel focal length of a handheld welding gun provided in the embodiment of the present application. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
[0040] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0041] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in flash memory (FLASH), random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Claims
1. An algorithm for adaptively adjusting the focal length of a handheld welding gun, characterized in that: The following steps are involved: S1: Obtaining a first actual pendulum width and a first set pendulum width of a first gun rod, and calculating a first scale factor, wherein the first actual pendulum width is the pendulum width when the first set pendulum width is the maximum; S2: Acquire a first focal length of the first gun barrel, and calculate a first rotation angle based on the first focal length and a first actual pendulum width; S3: Obtaining a second focal length of the second gun barrel, and calculating a second rotation angle based on the second focal length and the first actual swing width; S4: Calculating a second scale factor based on a linear proportional relationship between the first scale factor, the first rotation angle, and the second scale factor, the second rotation angle.
2. The algorithm for adaptive gun shaft focal length of a handheld welding gun according to claim 1, characterized in that: In S1, the first actual pendulum width and the first set pendulum width of the first gun rod are obtained, and the relevant expression for calculating the first scale factor is: ,in, is the first actual pendulum width, Set the pendulum width for the first time, is the motor fixed coefficient, is the first scale factor; Adjust the first scale factor , until the first setting pendulum width and the first actual pendulum width The values are the same, at this time .
3. The algorithm for adaptive gun shaft focal length of a handheld welding gun according to claim 2, characterized in that: Get the first actual pendulum width When , n measurements are performed, the minimum and maximum values are removed, and the remaining data are averaged.
4. The algorithm for adaptively adjusting the focal length of the handheld welding gun according to claim 3, characterized in that: If the first actual pendulum width finally calculated If the value is smaller than the judgment threshold, correction is performed using the correction coefficient.
5. The algorithm for adaptively adjusting the focal length of the handheld welding gun according to claim 4, characterized in that: In S2, the first focal length of the first gun bar is obtained, and the first rotation angle is calculated based on the first focal length and the first actual pendulum width. The relevant expression is: ,in represents the first rotation angle, Indicates half of the first actual pendulum width, Indicates the first focal length.
6. The algorithm for adaptively adjusting the focal length of the handheld welding gun according to claim 5, characterized in that: In S3, the second focal length of the second gun rod is obtained, and based on the second focal length and the first actual pendulum width, the relevant expression for calculating the second rotation angle is: ,in represents the second rotation angle, represents half the target swing width of the second gun, and , Indicates the secondary focal length.
7. The algorithm for adaptively adjusting the focal length of the handheld welding gun according to claim 6, characterized in that: In S4, based on the linear proportional relationship between the first scale factor, the first rotation angle, the second scale factor, and the second rotation angle, the second scale factor is calculated as: The linear proportional relationship is ,in represents the second scale factor, then .
8. The algorithm for adaptively adjusting the focal length of the handheld welding gun according to claim 7, characterized in that: Computes the inverse tangent function using the Taylor expansion function.
9. The algorithm for adaptively adjusting the focal length of the handheld welding gun according to claim 8, characterized in that: When the maximum approximation error is allowed to be below 0.0015 rad, the Taylor expansion function adopts the following formula: ,in, express or .
10. A system for adaptively adjusting the focal length of a handheld welding gun, characterized in that: Used to execute the algorithm described in any one of claims 1 to 9, and built into a handheld welding gun.
Citation Information
Patent Citations
Welding system and welding method for all-position automatic welding of small-diameter pipeline
CN113385786A
Method and system for determining laser welding focal length
CN117961268A
Pipeline welding gun swing amplitude prediction method and device based on deep learning
CN119962708A
Welding equipment for precise metal plate production
CN219724937U
A welding torch that automatically adjusts the focus in manual laser welding operations
WO2025144200A1