14.6.2. Finding Intersection Coordinates Using Three-Point and Four-Point Seam Finding
When it is inconvenient to directly teach the position of a fillet weld, the collaborative robot can calculate the intersection point of the two plate planes by manually teaching or finding the positions on both sides of the fillet weld, thereby generating the location of the fillet weld.
For right-angle fillet welds, the three-point seam finding method can be used to calculate the intersection coordinates; for non-right-angle fillet welds, the four-point seam finding method is used.
Both command and Lua script methods are provided to obtain the intersection coordinates for seam finding motion, and a reference posture can be configured, allowing the robot carrying the welding torch to move to the intersection point with the posture of the reference teach point.
14.6.2.1. Command-based Intersection Calculation
14.6.2.1.1. Three-Point Intersection Calculation
Step1: Collect three plane contact points and save them as teach points; configure a reference teach point.

Figure 14.6‑7 Select Three Seam Finding Points
The collected contact points include three points, where two points lie on the same plane and the other point lies on the perpendicular plane.
Note
If no posture reference point is selected, the generated intersection point’s posture is consistent with point P3 by default. If a posture reference point is selected, it matches the posture of the reference teach point.
Step2: On the Teach Page, click “Applications” -> “Tool App” -> “Intersection Generation”, and findthe Three-Point and Four-Point Intersection Calculation function module.

Figure 14.6‑8 Select Seam Finding Points for Intersection Calculation
Step3: Select “Three-Point Seam Finding” from the dropdown, sequentially select the three collected contact points, click Calculate, check if the displayed intersection point in the 3D model is correct, name the intersection point, and save it.

Figure 14.6‑9 Calculate Intersection Coordinates and Save
Step4: Save the teach point, and teach motion can be performed.

Figure 14.6‑10 Save Intersection Coordinates as a Teach Point
14.6.2.1.2. Four-Point Intersection Calculation
Step1: Collect four plane contact points and save them as teach points; configure a reference teach point.

Figure 14.6‑11 Select Four Seam Finding Points
The collected contact points include four points, where the first two points lie on the same plane and the last two points lie on the perpendicular plane.
Note
If no posture reference point is selected, the generated intersection point’s posture is consistent with point P4 by default. If a posture reference point is selected, it matches the posture of the reference teach point.
Step2: On the Teach Page, click “Initial Setup”, “Peripherals”, “Tracking”, “Sensors” in sequence, and find the Three-Point and Four-Point Intersection Calculation function module.

Figure 14.6‑12 Select Seam Finding Points and Reference Point for Intersection Calculation
Step3: Select “Four-Point Seam Finding” from the dropdown, sequentially select the four collected contact points, click Calculate, check if the displayed intersection point in the 3D model is correct, name the intersection point, and save it.

Figure 14.6‑13 Calculate Intersection Coordinates and Save
Step4: Save the teach point, and teach motion can be performed.

Figure 14.6‑14 Save Intersection Coordinates as a Teach Point
14.6.2.2. Lua Script for Intersection Seam Finding Motion
14.6.2.2.1. Three-Point Intersection Calculation
Step1: Collect three plane contact points and save them as teach points; configure a reference teach point.

Figure 14.6‑15 Select Three Seam Finding Points
The collected contact points include three points, where two points lie on the same plane and the other point lies on the perpendicular plane.
Note
If no posture reference point is selected, the generated intersection point’s posture is consistent with point P3 by default. If a posture reference point is selected, it matches the posture of the reference teach point.
Step2: Write the three-point intersection seam finding motion Lua program. Click “Teach Program” -> “Program Programming” -> “New Button” in sequence, and create a new user program “test3point.lua”.

Figure 14.6‑16 New Three-Point Intersection Seam Finding Motion Program
Step3: Generate the three-point intersection seam finding motion program. Click “Teach Program” -> “Program Programming” -> “Welding Instructions” -> “Laser Tracking” in sequence, scroll down to the Seam Finding Intersection Motion section, select the “Three-Point Seam Finding” method, use the dropdowns to sequentially select the collected contact points “Point 1”, “Point 2”, “Point 3”, and the posture reference point, select the required “Motion Mode” and “Debug Speed”, then click the “Add” and “Apply” buttons to generate the corresponding three-point intersection seam finding motion program.

Figure 14.6‑17 Three-Point Intersection Seam Finding Motion
Step4: In Auto mode, click the Run button to automatically perform the three-point intersection calculation. The robot will drag the welding torch and move to the intersection position using the reference posture.
14.6.2.2.2. Four-Point Intersection Calculation
Step1: Collect four plane contact points and save them as teach points; configure a reference teach point.

Figure 14.6‑18 Select Four Seam Finding Points
The collected contact points include four points, where the first two points lie on one plane and the last two points lie on another plane.
Note
If no posture reference point is selected, the generated intersection point’s posture is consistent with point P4 by default. If a posture reference point is selected, it matches the posture of the reference teach point.
Step2: Write the four-point intersection seam finding motion Lua program. Click “Teach Program” -> “Program Programming” -> “New Button” in sequence, and create a new user program “test4point.lua”.

Figure 14.6‑19 New Four-Point Intersection Seam Finding Motion Program
Step3: Generate the four-point intersection seam finding motion program. Click “Teach Program” -> “Program Programming” -> “Welding Instructions” -> “Laser Tracking” -> scroll down to the Seam Finding Intersection Motion section, select the “Four-Point Seam Finding” method, use the dropdowns to sequentially select the collected contact points “Point 1”, “Point 2”, “Point 3”, “Point 4”, and the posture reference point, select the required “Motion Mode” and “Debug Speed”, then click the “Add” and “Apply” buttons to generate the corresponding four-point intersection seam finding motion program.

Figure 14.6‑20 Four-Point Intersection Seam Finding Motion
Step4: In Auto mode, click the Run button to automatically perform the four-point intersection calculation. The robot will drag the welding torch and move to the intersection position using the reference posture.
14.7. Peripheral Protocol
Under the “Applications” -> “Tool App” menu bar, click “Peripheral Protocol” to enter the peripheral protocol configuration function interface.
This page is for configuring peripheral protocols. Users can configure the protocol based on the currently used peripheral device.

Figure 14.7‑1 Peripheral Protocol Configuration
Lua interfaces for reading and writing registers based on Modbus-RTU communication have been added in program teaching. The input register address is 0x1000 with 50 registers, totaling 100 bytes of data content; the holding register address is 0x2000 with 50 registers, totaling 100 bytes of data content.
ModbusRegRead(fun_code, reg_add, reg_num): Read Registers;
fun_code: Function code, 0x03 - Holding Register, 0x04 - Input Register
reg_add: Register Address
reg_num: Number of Registers
ModbusRegWrite(fun_code, reg_add, reg_num, reg_value): Write Registers;
fun_code: Function code, 0x06 - Single Register, 0x10 - Multiple Registers
reg_add: Register Address
reg_num: Number of Registers
reg_value: Byte Array
ModbusRegGetData(reg_num): Get Register Data;
reg_num: Number of Registers
Return value description:
reg_value: Array variable
Example program screenshot:

Figure 14.7‑2 Modbus-RTU Communication Lua Program Example
14.8. G-code to Robot Trajectory Planning Function
14.8.1. Function Overview
The G-code to Robot Trajectory Planning function uses CAD software to convert paths (lines, arcs, full circles, splines) into G-code files with the “.gcode” extension. The G-code for spline paths consists of many small line segments. Importing the generated G-code file on the Web端 converts it and generates a LUA file.
G-code to Robot Trajectory Planning function description:
The Web can only import G-code files with the “.gcode” extension. Upon successful conversion, a LUA file with the same name as the G-code file is generated. If a LUA file with the same name already exists before conversion, the conversion will fail.
Currently, it can convert rapid move G0, linear interpolation G1, clockwise arc interpolation G2, and counterclockwise arc interpolation G3 commands in G-code. G0 corresponds to the MoveJ instruction, G1 corresponds to MoveL, arcs (G2/G3) correspond to MoveC, and full circles (G2/G3) correspond to the Circle instruction.
Currently, only G-code for arcs and circles in the XY plane can be converted.
The spindle speed S set in G-code instructions corresponds to the speed in the MoveJ instruction. The unit of spindle speed is revolutions per minute (RPM), corresponding to millimeters per minute (mm/min) for move speed. The feedrate F corresponds to the speed in MoveL, MoveC, and Circle. The unit of feedrate is millimeters per minute (mm/min), consistent with the move speed unit. The speed settings in G-code must not exceed the robot’s maximum moving speed.
When executing the converted LUA file, the robot needs to have the speed percentage in the upper right corner of the Web interface changed to 100.
14.8.2. Operation Process
The calculation of the robot’s posture along the working path is shown in the figure below.

Figure 14.8-1 Robot Posture Calculation Schematic
Where P-xyz is the posture of the recorded reference posture teach point, and O-xy is the coordinate system of the CAD drawing. The robot’s posture at the starting point A is the reference posture. Based on the angle between the Z-axis of the reference posture and the CAD drawing plane, and the angle between the projection of the Z-axis on the CAD drawing plane and the tangent at the path’s starting point, the robot’s posture at intermediate point B and endpoint C of the path is calculated.
The functional operation process is as follows:
Step 1: Use CAD software with CAM functionality to convert the machining path into a G-code file, and use a G-code simulator, such as NC Viewer, to verify the correctness of the tool path.
Step 2: Before converting G-code to robot trajectory, first calibrate the tool coordinate system and the workpiece coordinate system. Note that the workpiece coordinate system needs to coincide with the machine coordinate system in the CAD software.


Figure 14.8-2 Tool and Workpiece Coordinate System Calibration Interface
Step 3: Under the calibrated tool coordinate system and workpiece coordinate system, record a reference posture teach point. The robot’s posture along the working path will be calculated using the posture of this reference point.
Step 4: Click “Applications”, “Tool App”, “G-code Conversion” button in sequence to enter the G-code file to robot motion LUA file interface.

Figure 14.8-3 G-code Conversion Interface
Step 5: Click the “Select File” button to find the G-code file that needs conversion. Note that the file extension of the G-code file must be “.gcode”. Select the reference posture point recorded in Step 2. Upon successful selection, the tool coordinate system and workpiece coordinate system of the currently selected teach point will be displayed below. Finally, click the “Convert” button. Upon successful conversion, a “G-code Conversion Successful” message will appear. Additionally, if a LUA file with the same name as the G-code file already exists, clicking the “Convert” button will prompt that the filename already exists.

Figure 14.8-4 G-code Conversion Success Interface

Figure 14.8-5 G-code Conversion Failure Interface
Step 6: Click “Teach Programming” -> “Program Programming” button, open the LUA file generated after G-code conversion, switch the robot to Auto mode, and click the Start button. The robot will then replicate the path from the G-code file.

Figure 14.8-6 Open the Converted LUA File