A method and device for automatic inspection, early warning and correction of a welding robot welding gun posture

By constructing a mathematical model and modular program for welding gun posture deviation within the welding robot teach pendant, the automatic acquisition, calculation, judgment, and correction of welding gun posture are realized, overcoming the shortcomings of manual inspection and achieving efficient and low-cost welding quality control.

CN122353151APending Publication Date: 2026-07-10ZHENGMEIJI ZHIDING HYDRAULIC CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHENGMEIJI ZHIDING HYDRAULIC CO LTD
Filing Date
2026-05-08
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

Current welding robot torch posture detection relies on manual visual observation, lacks quantitative standards, cannot accurately identify minute angular deviations, leading to frequent welding defects. Furthermore, there is no real-time early warning mechanism, resulting in high rework costs, poor compatibility with external equipment, and underutilization of the robot's native program resources.

Method used

A mathematical model of welding gun posture deviation is constructed inside the welding robot teach pendant. The program is written using the built-in programming environment of the teach pendant to realize closed-loop control of automatic acquisition, calculation, judgment, early warning and correction of welding gun posture. Through the mapping relationship between Euler angle parameters and welding gun posture, data is transmitted and corrected using numerical registers to form a modular program architecture.

Benefits of technology

It achieves real-time closed-loop control of welding gun posture, accurately identifies deviations and automatically corrects them, reduces modification and rework costs, improves the consistency and pass rate of welding quality, and has strong adaptability, making it suitable for welding robots from multiple brands.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122353151A_ABST
    Figure CN122353151A_ABST
Patent Text Reader

Abstract

This invention provides an automatic inspection, early warning, and correction method for welding gun posture of a welding robot, which runs on a welding robot teach pendant and includes the following steps: Based on the theory of rigid body three-dimensional space rotation coordinate transformation, establish the mapping relationship between Euler angle parameters and welding gun posture, and construct a mathematical model of gun posture deviation; Using the TP programming environment built into the teach pendant, write TP program code for the acquisition program, gun posture calculation program, gun posture judgment program, gun posture correction program, and gun posture early warning module respectively; Write the TP main program, in which the gun posture calculation program, the gun posture judgment program, and the gun posture correction program are called sequentially; Run the acquisition program, call the robot's built-in position register PR[n], automatically acquire the WPR angle parameters of the welding point, and store the W value, P value, and R value into the specified value registers R[151], R[152], and R[153] respectively; Run the TP main program to complete the calculation, judgment, and correction of the welding gun posture.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent control technology for industrial welding robots, specifically to a method and device for automatic inspection, early warning and correction of welding gun posture of welding robots. Background Technology

[0002] In industrial automated welding production, the welding torch posture of the welding robot is a core process indicator that affects the weld formation quality and penetration effect. The angle deviation of the welding torch directly determines the probability of welding defects.

[0003] In automated welding production lines, the welding teach pendant (TP) has become the core human-machine interface for operators to monitor, adjust, and confirm the posture of robots and welding torches. However, the industry currently predominantly uses the traditional model where the teach pendant only displays the path, while posture calculation is handled by an external host computer. This has resulted in the powerful program development resources of the teach pendant itself (such as TP and CAREL programs) being underutilized for a long time. Operators are forced to resort to manual visual inspection to verify the compliance of the torch posture.

[0004] This combination of traditional methods and manual inspection has led to the following technical pain points: First, there is a lack of quantitative inspection standards. Manual judgment based solely on experience cannot accurately identify minute angular deviations, and a welding torch angle deviation of ≥5° can cause molten pool shift, resulting in defects such as incomplete fusion, undercut, and off-center welding. Second, there is no real-time early warning mechanism. Defects can only be detected after welding is completed, resulting in high rework costs and low efficiency. Third, the compatibility of external inspection equipment is poor, and additional hardware and software investment increases production costs, while also resulting in insufficient compatibility with the robot control system. Fourth, the robot's native program development resources are not effectively utilized, and the development environment for the teach pendant, which could be used for real-time attitude determination, remains idle for a long time.

[0005] The control cycle of the welding process is typically less than ten milliseconds. Any attitude deviation that is not detected, alarmed, and corrected in time within the same control cycle can lead to incomplete welding, spatter, or even scrapping of the entire workpiece. Furthermore, the workshop environment is characterized by strong electromagnetic interference and unstable networks. Placing critical trigonometric function calculations and decision-making logic on an external PC or server not only introduces additional communication latency and reliability risks, but also requires redeploying the external software every time a firmware upgrade or on-site debugging is performed, thus increasing maintenance costs. Simultaneously, operators interact with the teach pendant's LCD and keyboard, expecting to view attitude values, compliance status, and necessary correction commands in real time on the same screen. However, traditional PC pop-up windows cannot be directly mapped to the TP interface.

[0006] In summary, only by fully utilizing the robot's native program development resources and completing the entire closed-loop control process—from posture reading to calculation, judgment, alarm, and automatic correction—within the teach pendant can the inherent defects of manual inspection be fundamentally solved, and the stringent requirements of processes for real-time performance and reliability be met.

[0007] In order to solve the above problems, people have been seeking an ideal technological solution. Summary of the Invention

[0008] Therefore, it is necessary to provide a method and device for automatic inspection, early warning and correction of welding gun posture of welding robots to address the above-mentioned technical problems.

[0009] To achieve the above objectives, the first aspect of the present invention provides an automatic inspection, early warning, and correction method for welding gun posture of a welding robot, which operates on a welding robot teach pendant and includes the following steps: Based on the theory of rigid body three-dimensional space rotation coordinate transformation, the mapping relationship between Euler angle parameters and welding gun posture is established, and a mathematical model of gun posture deviation is constructed. Using the built-in TP programming environment of the teach pendant, write TP program code for the acquisition program, the gun position calculation program, the gun position judgment program, the gun position correction program, and the gun position warning module respectively. Write the TP main program, which sequentially calls the gun posture calculation program, the gun posture judgment program, and the gun posture correction program. The acquisition program is run, the robot’s built-in position register PR[n] is called, the WPR angle parameters of the welding point are automatically acquired, and the W value, P value and R value are stored in the specified value registers R

[151] , R

[152] and R

[153] respectively; Run the TP main program and perform the following operations: The gun posture calculation program is invoked to read the WPR parameters in the numerical registers R

[151] , R

[152] , and R

[153] , and the actual gun posture angle is calculated according to the mathematical model. The gun posture judgment program is invoked to compare the actual gun posture angle with the preset standard gun posture threshold and calculate the gun posture deviation value; based on the comparison result, the value register R

[170] is assigned a binary value and the gun posture deviation value is stored in the value registers R

[171] and R

[172] respectively; The value is taken from the numerical register R

[170] . If R

[170] =0, it is determined that the gun posture is qualified and the operation is skipped to the next welding point. If R

[170] =1, it is determined that the gun posture deviation exceeds the standard, triggering the PAUSE pause instruction and calling the gun posture correction program. Based on the mathematical model of the gun posture deviation, the gun posture deviation value is calculated by inverse solution to obtain the corrected welding gun WPR angle parameter. The corrected W value, P value and R value are stored in the numerical registers R

[181] , R

[182] and R

[183] ​​respectively, and the WPR angle parameter of the welding point is updated synchronously to complete the automatic correction of the gun posture.

[0010] Understandably, after the correction is completed, the gun position calculation program and gun position judgment program can be called back for re-examination, forming a closed-loop function chain of automatic gun position acquisition, calculation, judgment, early warning and correction that does not require external hardware or software and runs inside the teach pendant.

[0011] The advantages of the above technical solution are: First, it achieves purely endogenous closed-loop control. All functional modules run in the form of TP programs within the teach pendant, without the need for any external hardware devices or offline programming software. This completely avoids external communication delays and the introduction of additional fault points, while significantly reducing the threshold for modification and hardware investment costs. It is especially suitable for the rapid upgrade of existing welding robots.

[0012] Secondly, a complete intelligent control chain for the welding position has been constructed. From the automatic acquisition of WPR parameters at the welding point, to the actual welding position angle calculation based on the rigid body space rotation coordinate transformation theory, to the deviation threshold judgment, over-limit warning, and automatic correction based on inverse solution calculation, a closed loop of the entire process of acquisition, calculation, judgment, warning and correction has been formed to ensure that each welding point is welded in the best posture.

[0013] Third, a modular program architecture and standardized data interface were implemented. The acquisition program, gun posture calculation program, gun posture judgment program and gun posture correction program were written and debugged independently. Data was transmitted through numerical registers R

[151] ~R

[153] , R

[170] ~R

[172] and R

[181] ~R

[183] . The interface was clear and the coupling was low, which facilitated subsequent maintenance, function expansion and porting to other welding robot systems that support similar register architecture.

[0014] Fourth, it eliminates the reliance on operator experience in the welding process, transforming the traditional gun posture control process that relies on manual judgment and adjustment into an automated and standardized procedure execution. This effectively avoids welding quality fluctuations caused by differences in personnel skills, significantly improves welding consistency and product qualification rate, and provides accurate data support for quality traceability through a real-time early warning mechanism.

[0015] To achieve the above objectives, a second aspect of the present invention provides an automatic inspection, early warning, and correction device for welding gun posture of a welding robot, comprising: The CAREL gun posture calculation module consists of TP program code written using the TP programming environment built into the teach pendant. It is used to read the WPR parameters in the numerical registers R

[151] , R

[152] , and R

[153] and calculate the actual gun posture angle according to the mathematical model. The CAREL gun posture judgment module is composed of TP program code written using the TP programming environment built into the teach pendant. It is used to compare the actual gun posture angle with the preset standard gun posture threshold and calculate the gun posture deviation value; based on the comparison result, the numerical register R

[170] is assigned a binary value, and the gun posture deviation value is stored in the numerical registers R

[171] and R

[172] respectively. The CAREL gun posture correction module consists of TP program code written using the TP programming environment built into the teach pendant. It is used to perform inverse calculation of the gun posture deviation value based on the gun posture deviation mathematical model, obtain the corrected welding gun WPR angle parameters, store the corrected W value, P value and R value into the numerical registers R

[181] , R

[182] and R

[183] ​​respectively, and update the WPR angle parameters of the welding point synchronously to complete the automatic correction of the gun posture. The parameter acquisition module consists of TP program code written using the TP programming environment built into the teach pendant. It is used to call the robot's built-in position register PR[n] to automatically acquire the WPR angle parameters of the welding point and store the W value, P value, and R value into the specified value registers R

[151] , R

[152] , and R

[153] , respectively. The main control module, consisting of the written TP main program, performs the following operations when run: The gun posture calculation program is invoked to read the WPR parameters in the numerical registers R

[151] , R

[152] , and R

[153] , and the actual gun posture angle is calculated according to the mathematical model. The gun posture judgment program is invoked to compare the actual gun posture angle with the preset standard gun posture threshold and calculate the gun posture deviation value; based on the comparison result, the value register R

[170] is assigned a binary value and the gun posture deviation value is stored in the value registers R

[171] and R

[172] respectively; In addition, the value is taken from the numerical register R

[170] . If R

[170] =0, it is determined that the gun posture is qualified and jumps to the next welding point to continue the operation; if R

[170] =1, it is determined that the gun posture deviation exceeds the standard, triggers the PAUSE pause instruction, and calls the gun posture correction program to complete the automatic correction of the gun posture.

[0016] To achieve the above objectives, a third aspect of the present invention provides a welding teaching pendant, which incorporates an automatic inspection, early warning and correction device for the welding gun posture of a welding robot.

[0017] The beneficial effects of this invention are as follows: 1. This invention completely solves the core pain point of traditional welding gun posture inspection, establishes a standardized inspection system for welding gun posture, can accurately identify gun posture deviation, eliminate welding defects such as incomplete fusion, undercut, and off-center welding caused by gun posture deviation from the source, and significantly improve the pass rate of welding quality.

[0018] 2. This method is based on the secondary development of the welding robot's native program. It does not require any external hardware or third-party software. It fully reuses the robot's own registers, program environment and other resources. There is no additional production cost investment. It has strong adaptability and low modification cost. It can be quickly implemented in existing production lines and has extremely high engineering practicality.

[0019] 3. Real-time closed-loop control, deviation warning and correction of welding gun posture are realized. The judgment and warning of gun posture deviation are completed simultaneously during the welding operation. Once the deviation exceeds the standard, the operation is immediately stopped and the specific deviation value is displayed in a pop-up window. The operator can make accurate corrections, avoiding the problem of rework after the welding is completed in the traditional way, and greatly reducing rework costs.

[0020] 4. High calculation accuracy and wide adaptability: The gun posture calculation accuracy of this invention is high, meeting the requirements of high-precision welding process; the standard gun posture threshold and deviation range can be customized and adjusted, adapting to various weld forms such as fillet welds and V-groove welds, and compatible with welding conditions such as flat welding and vertical welding. It can be widely used in the welding operations of steel structural components such as hydraulic support top beams, shield beams, and bases.

[0021] 5. Flexible program architecture: The CAREL gun posture calculation module, CAREL gun posture judgment module, pop-up program, and CAREL gun posture correction module of this invention are independently developed program units, which are integrated with the TP main program through instruction calls. This makes it easy to update the mathematical model and adjust the parameter thresholds according to the welding process optimization needs in the later stage without reconstructing the entire program, and has good maintainability and iterability.

[0022] 6. The technical solution of this invention has a demonstrative effect on the field of industrial welding robots and can be extended to the gun posture control scenario of multi-brand welding robots, promoting the intelligent and precise upgrading of welding processes and providing new technical ideas for industrial automated welding quality control. Attached Figure Description

[0023] Figure 1 This is a flowchart illustrating the automatic inspection, early warning, and correction method for welding gun posture of the welding robot according to the present invention. Detailed Implementation

[0024] The implementation vehicle of the method described in this invention is a FANUC welding robot, equipped with a FANUC original teach pendant; the robot has a built-in native TP program editing environment and CAREL program development environment, and is equipped with a position register PR[n] and a value register R[n], without the need for any external hardware devices or third-party software.

[0025] The technical solution of the present invention will be further described in detail below through specific embodiments. Example 1

[0026] like Figure 1 As shown, this embodiment provides an automatic inspection, early warning, and correction method for welding gun posture of a welding robot, which runs on a welding robot teach pendant and includes the following steps: Based on the theory of rigid body three-dimensional space rotation coordinate transformation, the mapping relationship between Euler angle parameters and welding gun posture is established, and a mathematical model of gun posture deviation is constructed. Using the built-in TP programming environment of the teach pendant, write TP program code for the acquisition program, the gun position calculation program, the gun position judgment program, the gun position correction program, and the gun position warning module respectively. Write the TP main program, which sequentially calls the gun posture calculation program, the gun posture judgment program, and the gun posture correction program. The acquisition program is run, the robot’s built-in position register PR[n] is called, the WPR angle parameters of the welding point are automatically acquired, and the W value, P value and R value are stored in the specified value registers R

[151] , R

[152] and R

[153] respectively; Run the TP main program and perform the following operations: The gun posture calculation program is invoked to read the WPR parameters in the numerical registers R

[151] , R

[152] , and R

[153] , and the actual gun posture angle is calculated according to the mathematical model. The gun posture judgment program is invoked to compare the actual gun posture angle with the preset standard gun posture threshold and calculate the gun posture deviation value; based on the comparison result, the value register R

[170] is assigned a binary value and the gun posture deviation value is stored in the value registers R

[171] and R

[172] respectively; In one embodiment, the preset standard gun posture threshold is the standard forward and backward tilt angle and the standard left and right tilt angle of the welding gun; In one embodiment, the step of calculating the gun posture deviation value is as follows: the difference between the calculated welding point gun posture and the preset standard gun posture threshold is calculated, and the difference is stored in the value registers R

[171] and R

[172] respectively. In one embodiment, the numerical register R

[170] is binary assigned based on the comparison result, including: when the calculated welding point gun posture is within the allowable deviation range of the preset standard gun posture threshold, it is determined that the gun posture conforms to the preset standard gun posture, and R

[170] is assigned the value 0; when the calculated welding point gun posture exceeds the allowable deviation range of the preset standard gun posture threshold, it is determined that the gun posture does not conform to the preset standard gun posture, and R

[170] is assigned the value 1. The value is taken from the numerical register R

[170] . If R

[170] =0, it is determined that the gun posture is qualified and the operation is skipped to the next welding point. If R

[170] =1, it is determined that the gun posture deviation exceeds the standard, triggering the PAUSE pause instruction and calling the gun posture correction program. Based on the mathematical model of the gun posture deviation, the gun posture deviation value is calculated by inverse solution to obtain the corrected welding gun WPR angle parameter. The corrected W value, P value and R value are stored in the numerical registers R

[181] , R

[182] and R

[183] ​​respectively, and the WPR angle parameter of the welding point is updated synchronously to complete the automatic correction of the gun posture.

[0027] The advantages of the above technical solution are: First, it achieves purely endogenous closed-loop control. All functional modules run in the form of TP programs within the teach pendant, without the need for any external hardware devices or offline programming software. This completely avoids external communication delays and the introduction of additional fault points, while significantly reducing the threshold for modification and hardware investment costs. It is especially suitable for the rapid upgrade of existing welding robots.

[0028] Secondly, a complete intelligent control chain for the welding position has been constructed. From the automatic acquisition of WPR parameters at the welding point, to the actual welding position angle calculation based on the rigid body space rotation coordinate transformation theory, to the deviation threshold judgment, over-limit warning, and automatic correction based on inverse solution calculation, a closed loop of the entire process of acquisition, calculation, judgment, warning and correction has been formed to ensure that each welding point is welded in the best posture.

[0029] Third, a modular program architecture and standardized data interface were implemented. The acquisition program, gun posture calculation program, gun posture judgment program and gun posture correction program were written and debugged independently. Data was transmitted through numerical registers R

[151] ~R

[153] , R

[170] ~R

[172] and R

[181] ~R

[183] . The interface was clear and the coupling was low, which facilitated subsequent maintenance, function expansion and porting to other welding robot systems that support similar register architecture.

[0030] Fourth, it eliminates the reliance on operator experience in the welding process, transforming the traditional gun posture control process that relies on manual judgment and adjustment into an automated and standardized procedure execution. This effectively avoids welding quality fluctuations caused by differences in personnel skills, significantly improves welding consistency and product qualification rate, and provides accurate data support for quality traceability through a real-time early warning mechanism.

[0031] Furthermore, using the TP programming environment built into the teach pendant, TP program code for the acquisition program, gun position calculation program, gun position judgment program, gun position correction program, and gun position warning module was written, and pop-up window program was also written. When the TP main program is run, if the gun posture deviation is determined to be excessive, the PAUSE pause instruction is triggered, and a pop-up program is called to display the gun posture deviation values ​​stored in the value registers R

[171] and R

[172] .

[0032] In practice, the CAREL gun posture calculation module, the CAREL gun posture judgment module, the pop-up program, and the CAREL gun posture correction module are invoked in the TP program via the CALL command.

[0033] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps. Example 2

[0034] This embodiment provides a specific implementation of Embodiment 1.

[0035] The specific implementation steps are as follows: Step 0: Based on the theory of rigid body three-dimensional space rotation coordinate transformation, establish the mapping relationship between Euler angle parameters and welding gun posture, and construct a mathematical model of gun posture deviation.

[0036] Step 1: Implementation and execution of the parameter acquisition program; The TP main program was written in the teaching pendant of the welding robot, and the acquisition program was written for the welding point P[1] to complete the automatic acquisition of the welding gun WPR angle parameters: LP[1]300mm / secFINE; -- Welding point 1; PR[1]=P[1]; -- The position information (w, p, r, x, y, z) of point 1 is stored in the position register PR[1]; R

[151] =PR[1,4]; -- The w value of point 1 is stored in the value register R

[151] through PR[1]; R

[152] =PR[1,5]; -- The p value of point 1 is stored in the value register R

[152] through PR[1]; R

[153] =PR[1,6]; -- The r value of point 1 is stored in the value register R

[153] through PR[1].

[0037] After the above command is executed, the welding torch WPR angle parameter of the current welding point is accurately collected and stored in the specified value register, providing a data source for subsequent torch posture calculation.

[0038] It is understandable that in this step, welding point P[1] can be replaced with any welding point number, and PR[1] can be replaced with any unoccupied position register. There is no fixed restriction on the register number; it is only necessary to ensure that the same welding point is not reused.

[0039] Step 2: Implementation and execution of the rifle stance calculation program Continue writing in the TP main program: CALLQZ1_REGISTER; -- Calls the CAREL gun position calculation module; When this module runs, it will automatically read R

[151] , R

[152] , and R

[153] to complete the gun posture quantization calculation.

[0040] After the calculation is completed, the module writes the forward and backward tilt angle of the welding gun along the weld direction into R

[154] , and writes the left and right tilt angle of the welding gun perpendicular to the weld direction into R

[155] .

[0041] Step 3: Implementation and execution of the gun stance determination program Continue writing in the TP main program: CALLPD1_REGISTER; Calls the CAREL gun position determination module; This example uses fillet weld welding as an example. The preset standard gun posture is: left and right tilt angle 45°, front and back tilt angle 0°, and the allowable deviation range is the absolute value of the difference < 5°.

[0042] When the module runs, it first reads the actual gun posture values ​​of R

[154] and R

[155] , calculates the difference with the standard gun posture threshold, obtains the deviation value, and writes it into R

[171] and R

[172] .

[0043] Then the judgment logic is executed: if the actual gun posture angle is within the allowable deviation range, 0 is assigned to R

[170] to determine that the gun posture is compliant; if the actual gun posture angle is not within the allowable deviation range, 1 is assigned to R

[170] to determine that the gun posture is out of tolerance.

[0044] In this example, both the standard gun position and the allowable error of the gun position can be flexibly adjusted in the CAREL gun position judgment module. The positive and negative attributes of the deviation value can intuitively reflect the direction of the gun position deviation.

[0045] Step 4: Implementation and Execution of Intelligent Early Warning Program In the TP main program, conditional statements and pop-up program segments are added to complete the real-time warning of gun position deviation. The core instruction segment is as follows: If IFR

[170] =0, JMPLBL[2]; -- If R

[170] =0, jump to LBL[2]. PAUSE; -- If R

[170] ≠0, running this line will trigger the robot pause command. CALLTC1_REGISTER; -- Invokes a pop-up warning. LBL[2]; When the welding gun posture deviation exceeds the standard, the welding robot will immediately stop the welding operation, and the teach pendant will pop up an early warning window, which displays the specific deviation values ​​of R

[171] and R

[172] . The operator can correct the welding gun posture according to the value.

[0046] After the correction is completed, restart the program on the teach pendant, and the robot can continue welding. When the gun posture is compliant, the program will not issue any warnings and will directly jump to the next welding point to ensure the continuity of the welding operation.

[0047] In step 4, CALLTC1_REGISTER is a pop-up program.

[0048] Step 5: Implementation and execution of the gun posture correction program The gun posture correction program is then written into the TP main program to correct any deviations in gun posture. The TP commands are as follows: CALLXZ1_REGISTER; -- Call the gun posture correction module PR[1,4]=R

[181] ; -- The correct gun position w value is assigned to the position register PR[1]. PR[1,5]=R

[182] ; -- Assign the correct gun position p value to the position register PR[1]. PR[1,6]=R

[183] ; -- The correct gun position r value is assigned to the position register PR[1]. LPR[1]300mm / secFINE; --Run correction point PR[1].

[0049] Furthermore, in this embodiment, the register numbers are uniformly set: the position register is PR[1], the W value is stored in R

[151] , the P value is stored in R

[152] , the R value is stored in R

[153] , the welding torch front and rear tilt angle is stored in R

[154] , the welding torch left and right tilt angle is stored in R

[155] , the torch posture compliance judgment bit is R

[170] , the front and rear tilt angle deviation value is stored in R

[171] , and the left and right tilt angle deviation value is stored in R

[172] .

[0050] In this embodiment, the CAREL gun position calculation module is named QZ1_REGISTER, the CAREL gun position judgment module is named PD1_REGISTER, the pop-up program is named TC1_REGISTER, and the CAREL gun position correction module is named XZ_REGISTER. The corresponding programs of these modules strictly follow the three major elements inside the teach pendant: KAREL language commands, numerical registers, and other related functions.

[0051] In the attitude calculation module (QZ1_REGISTER), the program first uses GET_REG to read the three angles WPR of the welding torch from the numerical registers R

[151] ~R

[153] . Because each angle is stored in integer and fractional parts, the code merges the two data segments into a complete degree value by z+x (or the same method), and then directly calls KAREL's trigonometric functions (COS, SIN). These functions automatically convert degrees to radians, so there is no need for manual conversion.

[0052] The program then uses -sin(W) and cos(W)·sin(P) to form a tan-form ratio, and obtains the intermediate angle (equivalent to atan) through the combination of sign factor and ACOS / SQRT. Then, the roll angle of the R register is added to obtain the final attitude angle. By taking the root of the denominator and the modulus of -sin(W), and then multiplying it by the cosine and sine of the angle respectively and using ASIN, the front-to-back tilt angle a and the left-to-right tilt angle b of the welding gun can be obtained. Finally, these two real numbers are written back to R

[154] and R

[155] .

[0053] The attitude determination module (PD1_REGISTER) then reads the calculation results from R

[154] and R

[155] , merges them into a complete degree value, and compares it with the process standard (45°±5° left and right, 0°±5° front and back). If both ranges are met, 0 is written to R

[170] to indicate that the attitude is compliant; otherwise, 1 is written and the left-right deviation (a-45) and front-back deviation (b-0) are written to R

[171] and R

[172] respectively. This step is completed entirely within the teach pendant, which avoids external communication and ensures the immediacy of the determination.

[0054] The pop-up warning module (TC1_REGISTER) uses KAREL's WRITE command to directly output the deviation value to the TP's LCD, and displays the left and right and front and back error messages respectively through the line break character CR. The operator can immediately see the error message on the teach pendant screen without switching to other devices.

[0055] The attitude correction module (XZ1_register) reads the current actual tilt angle and the original WPR data after detecting the deviation. It first constructs a 3×3 direction cosine matrix based on Euler angles, and then multiplies it with the rotation matrix of the target tilt angle to obtain a composite matrix. The matrix is ​​decomposed into new WPR correction values ​​through functions such as ATAN2 and ASIN, and written into R

[181] ~R

[183] ​​for direct use by the subsequent path control program to achieve closed-loop automatic correction.

[0056] It's important to note that the entire solution runs seamlessly within the soldering teach pendant because it's entirely based on native KAREL language instructions (register access, trigonometric functions, conditional branches, character output), all supported by the teach pendant's built-in interpreter engine. The numerical registers themselves serve as the global data channel provided by the teach pendant; all subroutines read and write data via GET_REG / SET_REAL_REG, achieving cross-task and cross-program data sharing without requiring any external file system or network communication. The pop-up display uses KAREL's WRITE instruction, the only way on the TP to directly output characters to the LCD. Combined with special control characters (such as CHR(137) and CHR(128)), screen clearing and formatting adjustments can be achieved, ensuring the human-machine interface perfectly matches the operating habits of field operators.

[0057] In summary, this solution, through a unified data representation format (degree values ​​combining integers and decimals), register-driven end-to-end sharing, and KAREL's native trigonometric / matrix operations and TP UI output, achieves a complete closed loop of real-time attitude calculation, compliance judgment, pop-up alarms, and automatic correction without relying on any third-party software or hardware. This precisely addresses the core technical requirements of today's welding teach pendants for high reliability, low latency, and field adaptability. Example 3

[0058] Based on the same inventive concept, this application also provides an automatic inspection, early warning, and correction device for welding robot welding gun posture, including: The CAREL gun posture calculation module consists of TP program code written using the TP programming environment built into the teach pendant. It is used to read the WPR parameters in the numerical registers R

[151] , R

[152] , and R

[153] and calculate the actual gun posture angle according to the mathematical model. The CAREL gun posture judgment module is composed of TP program code written using the TP programming environment built into the teach pendant. It is used to compare the actual gun posture angle with the preset standard gun posture threshold and calculate the gun posture deviation value; based on the comparison result, the numerical register R

[170] is assigned a binary value, and the gun posture deviation value is stored in the numerical registers R

[171] and R

[172] respectively. The CAREL gun posture correction module consists of TP program code written using the TP programming environment built into the teach pendant. It is used to perform inverse calculation of the gun posture deviation value based on the gun posture deviation mathematical model, obtain the corrected welding gun WPR angle parameters, store the corrected W value, P value and R value into the numerical registers R

[181] , R

[182] and R

[183] ​​respectively, and update the WPR angle parameters of the welding point synchronously to complete the automatic correction of the gun posture. The parameter acquisition module consists of TP program code written using the TP programming environment built into the teach pendant. It is used to call the robot's built-in position register PR[n] to automatically acquire the WPR angle parameters of the welding point and store the W value, P value, and R value into the specified value registers R

[151] , R

[152] , and R

[153] , respectively. The main control module, consisting of the written TP main program, performs the following operations when run: The gun posture calculation program is invoked to read the WPR parameters in the numerical registers R

[151] , R

[152] , and R

[153] , and the actual gun posture angle is calculated according to the mathematical model. The gun posture judgment program is invoked to compare the actual gun posture angle with the preset standard gun posture threshold and calculate the gun posture deviation value; based on the comparison result, the value register R

[170] is assigned a binary value and the gun posture deviation value is stored in the value registers R

[171] and R

[172] respectively; In addition, the value is taken from the numerical register R

[170] . If R

[170] =0, it is determined that the gun posture is qualified and jumps to the next welding point to continue the operation; if R

[170] =1, it is determined that the gun posture deviation exceeds the standard, triggers the PAUSE pause instruction, and calls the gun posture correction program to complete the automatic correction of the gun posture. Example 4

[0059] Based on the above embodiments, this embodiment provides a welding teaching pendant, which has a built-in automatic inspection, early warning and correction device for the welding gun posture of a welding robot.

[0060] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them; although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications can still be made to the specific implementation of the present invention or equivalent substitutions can be made to some technical features without departing from the spirit of the technical solutions of the present invention, and all such modifications and substitutions should be covered within the scope of the technical solutions claimed in the present invention.

Claims

1. A method for automatic inspection, early warning, and correction of welding gun posture in a welding robot, operating on a welding robot teach pendant, characterized in that, Includes the following steps: Based on the theory of rigid body three-dimensional space rotation coordinate transformation, the mapping relationship between Euler angle parameters and welding gun posture is established, and a mathematical model of gun posture deviation is constructed. Using the built-in TP programming environment of the teach pendant, write TP program code for the acquisition program, the gun position calculation program, the gun position judgment program, the gun position correction program, and the gun position warning module respectively. Write the TP main program, which sequentially calls the gun posture calculation program, the gun posture judgment program, and the gun posture correction program. The acquisition program is run, the robot’s built-in position register PR[n] is called, the WPR angle parameters of the welding point are automatically acquired, and the W value, P value and R value are stored in the specified value registers R[151], R[152] and R[153] respectively; Run the TP main program and perform the following operations: The gun posture calculation program is invoked to read the WPR parameters in the numerical registers R[151], R[152], and R[153], and the actual gun posture angle is calculated according to the mathematical model. The gun posture judgment program is invoked to compare the actual gun posture angle with the preset standard gun posture threshold and calculate the gun posture deviation value; based on the comparison result, the value register R[170] is assigned a binary value and the gun posture deviation value is stored in the value registers R[171] and R[172] respectively; The value is taken from the numerical register R[170]. If R[170]=0, it is determined that the gun posture is qualified and the operation is skipped to the next welding point. If R[170]=1, it is determined that the gun posture deviation exceeds the standard, triggering the PAUSE pause instruction and calling the gun posture correction program. Based on the mathematical model of the gun posture deviation, the gun posture deviation value is calculated by inverse solution to obtain the corrected welding gun WPR angle parameter. The corrected W value, P value and R value are stored in the numerical registers R[181], R[182] and R[183] ​​respectively, and the WPR angle parameter of the welding point is updated synchronously to complete the automatic correction of the gun posture.

2. The automatic inspection, early warning, and correction method for welding gun posture of a welding robot according to claim 1, characterized in that: The preset standard gun posture thresholds are the standard forward and backward tilt angle and the standard left and right tilt angle of the welding gun.

3. The automatic inspection, early warning, and correction method for welding gun posture of a welding robot according to claim 2, characterized in that, Based on the comparison results, the numerical register R[170] is assigned a binary value, including: when the calculated welding point gun posture is within the allowable deviation range of the preset standard gun posture threshold, it is determined that the gun posture conforms to the preset standard gun posture, and R[170] is assigned a value of 0; when the calculated welding point gun posture exceeds the allowable deviation range of the preset standard gun posture threshold, it is determined that the gun posture does not conform to the preset standard gun posture, and R[170] is assigned a value of 1.

4. The method for automatic inspection, early warning, and correction of welding gun posture of a welding robot according to claim 2, characterized in that, The steps for calculating the gun posture deviation value are as follows: The difference between the calculated welding point gun posture and the preset standard gun posture threshold is calculated, and the difference is stored in the numerical registers R[171] and R[172] respectively.

5. The method for automatic inspection, early warning and correction of welding gun posture of a welding robot according to claim 2, characterized in that, Using the built-in TP programming environment of the teach pendant, TP program code for the acquisition program, gun position calculation program, gun position judgment program, gun position correction program, and gun position warning module was written, and pop-up window program was also written. When the TP main program is run, if the gun posture deviation is determined to be excessive, the PAUSE pause instruction is triggered, and a pop-up program is called to display the gun posture deviation values ​​stored in the value registers R[171] and R[172].

6. The automatic inspection, early warning, and correction method for welding gun posture of a welding robot according to claim 5, characterized in that, The CAREL gun posture calculation module, the CAREL gun posture judgment module, the pop-up program, and the CAREL gun posture correction module are invoked in the TP program via the CALL command.

7. An automatic inspection, early warning, and correction device for welding gun posture of a welding robot, characterized in that, include: The CAREL gun posture calculation module consists of TP program code written using the TP programming environment built into the teach pendant. It is used to read the WPR parameters in the numerical registers R[151], R[152], and R[153] and calculate the actual gun posture angle according to the mathematical model. The CAREL gun posture judgment module is composed of TP program code written using the TP programming environment built into the teach pendant. It is used to compare the actual gun posture angle with the preset standard gun posture threshold and calculate the gun posture deviation value; based on the comparison result, the numerical register R[170] is assigned a binary value, and the gun posture deviation value is stored in the numerical registers R[171] and R[172] respectively. The CAREL gun posture correction module consists of TP program code written using the TP programming environment built into the teach pendant. It is used to perform inverse calculation of the gun posture deviation value based on the gun posture deviation mathematical model, obtain the corrected welding gun WPR angle parameters, store the corrected W value, P value and R value into the numerical registers R[181], R[182] and R[183] ​​respectively, and update the WPR angle parameters of the welding point synchronously to complete the automatic correction of the gun posture. The parameter acquisition module consists of TP program code written using the TP programming environment built into the teach pendant. It is used to call the robot's built-in position register PR[n] to automatically acquire the WPR angle parameters of the welding point and store the W value, P value, and R value into the specified value registers R[151], R[152], and R[153], respectively. The main control module, consisting of the written TP main program, performs the following operations when run: The gun posture calculation program is invoked to read the WPR parameters in the numerical registers R[151], R[152], and R[153], and the actual gun posture angle is calculated according to the mathematical model. The gun posture judgment program is invoked to compare the actual gun posture angle with the preset standard gun posture threshold and calculate the gun posture deviation value; based on the comparison result, the value register R[170] is assigned a binary value and the gun posture deviation value is stored in the value registers R[171] and R[172] respectively; In addition, the value is taken from the numerical register R[170]. If R[170]=0, it is determined that the gun posture is qualified and jumps to the next welding point to continue the operation; if R[170]=1, it is determined that the gun posture deviation exceeds the standard, triggers the PAUSE pause instruction, and calls the gun posture correction program to complete the automatic correction of the gun posture.

8. A welding teach pendant, characterized in that: It has a built-in automatic inspection, early warning and correction device for the welding gun posture of the welding robot.

9. A welding teaching pendant according to claim 8, characterized in that: The welding robot in question is a FANUC welding robot.