8.6.3.2. Writing Programs Without Using Welding Process Curves
When not using the welding process curve (i.e., selecting welding process parameter number 0), instructions to set welding voltage and current must be added to the welding program to control the actual welding parameters. Click “Teach” -> “Program Teaching”, and create a new user program “testWeld.lua”.
Figure 8.6-29 Create “testWeld.lua” Program
In the opened welding instruction addition page, select the control type as “Controller I/O” (select based on the actual configured welding control method), select the welding process number as 0 (Process number 0 does not use the welding process curve, numbers 1-99 do), set the welding current control AO as “Ctrl-AO0”, welding current as 150A, click the “Add” button; set the welding voltage control AO as “Ctrl-AO1”, welding voltage as 21V, click the “Add” button; set the maximum wait time as 10000ms, click the “Arc Start” button and then the “Arc Close” button sequentially, and finally click “Apply”.
Figure 8.6-30 Welding Instruction Addition
Now the “testWeld.lua” program has added the welding arc start instruction and the welding arc close instruction. Since the arc start and close instructions selected welding process number 0, when the program executes the set welding voltage and current instructions, the robot will automatically output the corresponding control box analog signal based on the set welding voltage and current values and the “Welding voltage, current vs output analog correspondence” set in the welding machine configuration page.
Figure 8.6-31 Set Welding Voltage, Current, Arc Start, Arc Close Program
Add two linear motion instructions and adjust the instruction order so that the robot first moves to point “P1”, executes arc start, then moves to point “P2”, and executes arc close, achieving welding from point “P1” to point “P2”.
Figure 8.6-32 Robot Welding from Point P1 to P2
Running the above program will achieve welding along a straight line P1 ~ P2. Before running the program, please check: ① Whether the welding torch is correctly installed, whether the welding torch tool coordinate system has been calibrated, and applied as the current tool coordinate system; ② Whether the welding power supply, gas path, and wire feed path are working normally; ③ Whether the signal line connections between the robot and the welding machine are normal.
8.6.4. Welding Interruption and Recovery
Welding interruption may occur during robot welding under the following circumstances: ① The operator actively pauses welding to observe the actual welding condition or perform operations like cleaning the nozzle; ② Unexpected welding arc interruption; ③ The robot collides, causing welding to pause;
After a welding interruption occurs during robot welding, the operator can switch the robot to manual mode, drag the robot to a safe position, and address the cause of the interruption.
After the issue is resolved, the collaborative robot can automatically move from the current position back to the position where the welding interruption occurred, re-ignite the arc, and resume welding. The specific operation process is: ① Configure welding interruption recovery parameters; ② Execute the welding program, pause welding during the process to cause an interruption; ③ Switch the robot to manual mode, handle the relevant issues, then switch the robot back to automatic mode after completion; ④ Click the “Resume Welding” button, and the robot automatically resumes welding.
8.6.4.1. Welding Interruption Recovery Parameter Configuration
In the “Initial” -> “Peripherals” menu bar, click “Welding Machine” to enter the welding machine configuration interface. Find the “Detect Arc Interruption Parameter Configuration” section, turn on “Function Enable”, input “Confirmation Duration” as 20ms, click the “Configure” button. This means that if the arc success signal remains invalid for more than 20ms during welding, the robot will report a “Welding arc interruption” error.
Figure 8.6-33 Detect Arc Interruption Parameter Configuration
Find the “Welding Interruption Recovery Parameter Configuration” section, turn on “Function Enable”, input “Overlap Distance” as 5mm, “Speed” as 10%, “Motion Mode” as “PTP”, click the “Configure” button. The explanations for these three parameters are as follows:
Overlap Distance: To ensure the continuity between the resumed weld and the weld before the interruption, the arc restart point for welding recovery needs to have a certain overlap distance with the original weld.
Speed: After a welding interruption, the robot often needs to be moved to a safe position and the weld needs to be treated. After treatment is completed and welding recovery is executed, the robot will move from the current position to the welding restart point. This “Speed” indicates the speed at which the robot moves to the restart point.
Motion Mode: After a welding interruption, the robot often needs to be moved to a safe position and the weld needs to be treated. After treatment is completed and welding recovery is executed, the robot will move from the current position to the welding restart point. This “Motion Mode” indicates the motion mode used by the robot to move to the restart point, with “LIN” and “PTP” available for selection.
Figure 8.6-34 Welding Interruption Recovery Parameter Configuration
8.6.4.2. Welding Interruption Recovery Application
Take the “testWeld” program as an example. Switch the robot to automatic mode, click the start button, and the robot begins welding. During welding, click the pause button. At this point, welding is interrupted, and a welding interruption recovery prompt box pops up in the WebApp right corner. Click the “Resume Welding” button, and the robot automatically moves to the restart point and executes the subsequent welding tasks.
Figure 8.6-35 Execute Welding Program
Figure 8.6-36 Welding Recovery
Warning
The collaborative robot welding interruption recovery function can only be used for linear welds or circular arc welds. When using a while (1) loop for welding, nested multi-layer while loops are not supported, and conditional judgment statements containing local variables cannot be included. If using stitch welding function, please pay attention to adding the interface for feedback stitch welding information.
8.6.5. Attachment 1: Robot UDP Communication Protocol
Warning
CRC check method: Uses modbus 16 check but only takes the lower 8 bits for verification. The data areas for verification are D100-D176, D200-D273.
Arc Tracking: The actual current feedback converts the actual current obtained by the PLC from the welder into an analog value of 0-4095 and transmits it to the analog channel 0 of the UDP data protocol, i.e., D168.
Speed conversion logic: Robot issued speed (unit mm/s) V ÷ lead × 60 = V’; PLC converts the robot issued speed V’ × encoder resolution ÷ 60 = V” (unit pulse/s).
8.6.5.1. Robot Controller -> PLC
No. | Register Address | Data Type | Data Value | Variable Name |
1 | D199 | INT | 0x5A5A | Frame Header |
2 | D200 | INT | 1# Motor Control Word | |
3 | D201 | DINT | 1# Target Position Input | |
4 | D202 | DINT | 1# Target Position Input | |
5 | D203 | INT | 1# Homing Control Word | |
6 | D204 | DINT | 1# Homing High Speed Input | |
7 | D205 | DINT | 1# Homing High Speed Input | |
8 | D206 | DINT | 1# Homing Low Speed Input | |
9 | D207 | DINT | 1# Homing Low Speed Input | |
10 | D208 | DINT | 1# Position Offset (Reserved) | |
11 | D209 | DINT | 1# Position Offset (Reserved) | |
12 | D210 | DINT | 1# Speed Offset (Reserved) | |
13 | D211 | DINT | 1# Speed Offset (Reserved) | |
14 | D212 | DINT | 1# Torque Offset (Reserved) | |
15 | D213 | DINT | 1# Torque Offset (Reserved) | |
16 | D214 | INT | 2# Motor Control Word | |
17 | D215 | DINT | 2# Target Position Input | |
18 | D216 | DINT | 2# Target Position Input | |
19 | D217 | INT | 2# Homing Control Word | |
20 | D218 | DINT | 2# Homing High Speed Input | |
21 | D219 | DINT | 2# Homing High Speed Input | |
22 | D220 | DINT | 2# Homing Low Speed Input | |
23 | D221 | DINT | 2# Homing Low Speed Input | |
24 | D222 | DINT | 2# Position Offset (Reserved) | |
25 | D223 | DINT | 2# Position Offset (Reserved) | |
26 | D224 | DINT | 2# Speed Offset (Reserved) | |
27 | D225 | DINT | 2# Speed Offset (Reserved) | |
28 | D226 | DINT | 2# Torque Offset (Reserved) | |
29 | D227 | DINT | 2# Torque Offset (Reserved) | |
30 | D228 | INT | 3# Motor Control Word | |
31 | D229 | DINT | 3# Target Position Input | |
32 | D230 | DINT | 3# Target Position Input | |
33 | D231 | INT | 3# Homing Control Word | |
34 | D232 | DINT | 3# Homing High Speed Input | |
35 | D233 | DINT | 3# Homing High Speed Input | |
36 | D234 | DINT | 3# Homing Low Speed Input | |
37 | D235 | DINT | 3# Homing Low Speed Input | |
38 | D236 | DINT | 3# Position Offset (Reserved) | |
39 | D237 | DINT | 3# Position Offset (Reserved) | |
40 | D238 | DINT | 3# Speed Offset (Reserved) | |
41 | D239 | DINT | 3# Speed Offset (Reserved) | |
42 | D240 | DINT | 3# Torque Offset (Reserved) | |
43 | D241 | DINT | 3# Torque Offset (Reserved) | |
44 | D242 | INT | 4# Motor Control Word | |
45 | D243 | DINT | 4# Target Position Input | |
46 | D244 | DINT | 4# Target Position Input | |
47 | D245 | INT | 4# Homing Control Word | |
48 | D246 | DINT | 4# Homing High Speed Input | |
49 | D247 | DINT | 4# Homing High Speed Input | |
50 | D248 | DINT | 4# Homing Low Speed Input | |
51 | D249 | DINT | 4# Homing Low Speed Input | |
52 | D250 | DINT | 4# Position Offset (Reserved) | |
53 | D251 | DINT | 4# Position Offset (Reserved) | |
54 | D252 | DINT | 4# Speed Offset (Reserved) | |
55 | D253 | DINT | 4# Speed Offset (Reserved) | |
56 | D254 | INT | Reserved | |
57 | D255 | INT | Welding Mode Setting (0-DC Mono, 1-Pulse Mono, 2-JOB Mode, 3-Local Control Mode, 4-Separate Mode, 5-CC/CV, 6-TIG, 7-CMT Mode) | |
58 | D256 | INT | General Output DO(0-15) | |
59 | D257 | INT | General Output DO(16-31) | |
60 | D258 | INT | General Output DO(32-47) | |
61 | D259 | INT | General Output DO(48-63) | |
62 | D260 | INT | General Output DO(64-79) | |
63 | D261 | INT | General Output DO(80-95) | |
64 | D262 | INT | High-Speed Output DO(96-111) | |
65 | D263 | INT | High-Speed Output DO(112-127) | |
66 | D264 | INT | Analog Output AO0 | |
67 | D265 | INT | Analog Output AO1 | |
68 | D266 | INT | Analog Output AO2 | |
69 | D267 | INT | Analog Output AO3 | |
70 | D268 | REAL | Issued Welding Voltage | |
71 | D269 | REAL | Issued Welding Voltage | |
72 | D270 | REAL | Issued Welding Current | |
73 | D271 | REAL | Issued Welding Current | |
74 | D272 | REAL | Packet Loss Detection Cycle | |
75 | D273 | INT | Number of Lost Packets | |
76 | D274 | INT | Frame Count (0-255) | |
77 | D275 | INT | CRC Check Code |
8.6.5.2. PLC -> Robot Controller
No. | Register Address | Data Type | Data Value | Variable Name |
1 | D99 | INT | 0x5A5A | Frame Header |
2 | D100 | INT | 1# Motor Status Word | |
3 | D101 | DINT | 1# Current Position | |
4 | D102 | DINT | 1# Current Position | |
5 | D103 | INT | 1# Homing Status Word | |
6 | D104 | DINT | 1# Homing High Speed Feedback | |
7 | D105 | DINT | 1# Homing High Speed Feedback | |
8 | D106 | DINT | 1# Homing Low Speed Feedback | |
9 | D107 | DINT | 1# Homing Low Speed Feedback | |
10 | D108 | INT | 1# Fault Code | |
11 | D109 | DINT | 1# Following Deviation (Reserved) | |
12 | D110 | DINT | 1# Following Deviation (Reserved) | |
13 | D111 | DINT | 1# Speed Feedback (Reserved) | |
14 | D112 | DINT | 1# Speed Feedback (Reserved) | |
15 | D113 | DINT | 1# Real-time Torque (Reserved) | |
16 | D114 | DINT | 1# Real-time Torque (Reserved) | |
17 | D115 | INT | 2# Motor Status Word | |
18 | D116 | DINT | 2# Current Position | |
19 | D117 | DINT | 2# Current Position | |
20 | D118 | INT | 2# Homing Status Word | |
21 | D119 | DINT | 2# Homing High Speed Feedback | |
22 | D120 | DINT | 2# Homing High Speed Feedback | |
23 | D121 | DINT | 2# Homing Low Speed Feedback | |
24 | D122 | DINT | 2# Homing Low Speed Feedback | |
25 | D123 | INT | 2# Fault Code | |
26 | D124 | DINT | 2# Following Deviation (Reserved) | |
27 | D125 | DINT | 2# Following Deviation (Reserved) | |
28 | D126 | DINT | 2# Speed Feedback (Reserved) | |
29 | D127 | DINT | 2# Speed Feedback (Reserved) | |
30 | D128 | DINT | 2# Real-time Torque (Reserved) | |
31 | D129 | DINT | 2# Real-time Torque (Reserved) | |
32 | D130 | INT | 3# Motor Status Word | |
33 | D131 | DINT | 3# Current Position | |
34 | D132 | DINT | 3# Current Position | |
35 | D133 | INT | 3# Homing Status Word | |
36 | D134 | DINT | 3# Homing High Speed Feedback | |
37 | D135 | DINT | 3# Homing High Speed Feedback | |
38 | D136 | DINT | 3# Homing Low Speed Feedback | |
39 | D137 | DINT | 3# Homing Low Speed Feedback | |
40 | D138 | DINT | 3# Fault Code | |
41 | D139 | DINT | 3# Following Deviation (Reserved) | |
42 | D140 | DINT | 3# Following Deviation (Reserved) | |
43 | D141 | DINT | 3# Speed Feedback (Reserved) | |
44 | D142 | DINT | 3# Speed Feedback (Reserved) | |
45 | D143 | DINT | 3# Real-time Torque (Reserved) | |
46 | D144 | DINT | 3# Real-time Torque (Reserved) | |
47 | D145 | INT | 4# Motor Status Word | |
48 | D146 | DINT | 4# Current Position | |
49 | D147 | DINT | 4# Current Position | |
50 | D148 | INT | 4# Homing Status Word | |
51 | D149 | DINT | 4# Homing High Speed Feedback | |
52 | D150 | DINT | 4# Homing High Speed Feedback | |
53 | D151 | DINT | 4# Homing Low Speed Feedback | |
54 | D152 | DINT | 4# Homing Low Speed Feedback | |
55 | D153 | DINT | 4# Fault Code | |
56 | D154 | DINT | 4# Following Deviation (Reserved) | |
57 | D155 | DINT | 4# Following Deviation (Reserved) | |
58 | D156 | DINT | 4# Speed Feedback (Reserved) | |
59 | D157 | DINT | 4# Speed Feedback (Reserved) | |
60 | D158 | DINT | Real-time Torque (Reserved) | |
61 | D159 | DINT | Real-time Torque (Reserved) | |
62 | D160 | INT | General Input DI(0-15) | |
63 | D161 | INT | General Input DI(16-31) | |
64 | D162 | INT | General Input DI(32-47) | |
65 | D163 | INT | General Input DI(48-63) | |
66 | D164 | INT | General Input DI(64-79) | |
67 | D165 | INT | General Input DI(80-95) | |
68 | D166 | INT | High-Speed Input DI(96-111) | |
69 | D167 | INT | High-Speed Input DI(112-127) | |
70 | D168 | INT | Analog Input AI0 | |
71 | D169 | INT | Analog Input AI1 | |
72 | D170 | INT | Analog Input AI2 | |
73 | D171 | INT | Analog Input AI3 | |
74 | D172 | REAL | Actual Current Feedback | |
75 | D173 | REAL | Actual Current Feedback | |
76 | D174 | REAL | Actual Voltage Feedback | |
77 | D175 | REAL | Actual Voltage Feedback | |
78 | D176 | INT | Fault Code 0-No Fault, 1-Data Packet Loss | |
79 | D177 | INT | Frame Count | |
80 | D178 | INT | CRC Check Code |
8.6.6. Digital Communication Protocol (Modbus TCP)
Click “Initial” -> “Peripherals” -> “Welder” to enter the welder interface, then click the “Digital Communication Protocol (Modbus TCP)” card to enter the Welder Open Protocol interface.
8.6.6.1. Protocol Configuration
In the Open Protocol Configuration, click the “Upload” button to upload the completed Open Protocol LUA program file to the controller. Select an Open Protocol ID and Open Protocol Name, then click the “Configure” button (the selected Protocol ID must match the ID written in the Open Protocol file) to assign an ID to each open protocol.
Chart 8.6‑37 Controller Peripheral Open Protocol Upload and Configuration
In the configured protocol list, click the “Load” button. The running status indicator lights up, indicating that the open protocol has been loaded successfully.
Chart 8.6-38 Controller Peripheral Open Protocol Loading and Running Indication
8.6.6.2. Welder Open Protocol
The robot communicates with the welder via the controller peripheral open protocol using ModbusTCP. Write the corresponding communication protocol LUA file according to the welder slave register definitions. Configure communication parameters such as the welder IP address, port number, and register addresses for arc start control, wire feed control, etc., in this file. Upload this protocol to the robot controller and load it to enable communication between the robot and the welder.
8.6.6.2.1. Welder Open Protocol Example
local id = 1 --Protocol number, must match the protocol number configured in WebApp
local ctrlValues = {0, 0, 0, 0, 0, 0}
local realTimeState = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
ModbusTCPMasterClose(id)
ModbusTCPMasterCreate('192.168.58.45', 502, 1, id)
while(1) do
setArcStart, setWireForward, setWireReverse, setShieldingGas, setTouchEnable, setRobotError,setRobotEnableState,default1,default2, default3, default4, setCurrent, setVoltage, SetMode = WeldingGetCtrlState()
local ctrlWord = 0
ctrlWord = SetBitWithIndex(ctrlWord, 0, setArcStart)
ctrlWord = SetBitWithIndex(ctrlWord, 1, setWireForward)
ctrlWord = SetBitWithIndex(ctrlWord, 2, setWireReverse)
ctrlWord = SetBitWithIndex(ctrlWord, 3, setShieldingGas)
ctrlWord = SetBitWithIndex(ctrlWord, 4, setTouchEnable)
ctrlWord = SetBitWithIndex(ctrlWord, 7, setRobotError)
ctrlValues[1] = setRobotEnableState
ctrlValues[2] = ctrlWord
ctrlValues[3] = 0
ctrlValues[4] = setCurrent
ctrlValues[5] = setVoltage
ctrlValues[6] = 0
ModbusTCPMasterSetHoldRegs(id, 201, 6, ctrlValues, "U16")
localtmpCtrlMode={0,0,0,0}
tmpCtrlMode[1]=SetMode
ModbusTCPMasterSetHoldRegs(id,0x1000,1,tmpCtrlMode,"U16")
sleep_ms(10)
getWeldState, getCurrent, getVoltage,default1, default2, getWelderErrorCode = ModbusTCPMasterGetHoldRegs(id, 211, 6, "U16")
realTimeState[1] = GetBitWithIndex(getWeldState, 0) + GetBitWithIndex(getWeldState, 1) * 2 --welderType
realTimeState[2] = GetBitWithIndex(getWeldState, 5) --arc state(WCR)
realTimeState[3] = GetBitWithIndex(getWeldState, 4) --touch state
realTimeState[4] = GetBitWithIndex(getWeldState, 7) --welder error state
realTimeState[12] = getCurrent --current
realTimeState[13] = getVoltage --voltage
realTimeState[14] = getWelderErrorCode --welder error code
realTimeState[15] = getWeldState / 255 --heart jump
WeldingSetRealtimeState(realTimeState)
local stopFlag = GetOpenLUAStopFlag(id)
if(stopFlag ~= 0) then
ModbusTCPMasterClose(id)
break
end
sleep_ms(10)
end