9. Coding
9.1. Introduction
Click the command on the left to add a program node to the program tree. When the program is running, the currently executed program node is highlighted in green.
In manual mode, click the first icon on the right side of the node to make the robot execute the instruction alone, and the second icon is to edit the content of the node.

Figure 9.1-1 Program tree interface
Click “⇄” to switch modes, and the teaching program text can be changed to the editing state.

Figure 9.1-2 Teaching program editing status
The icons to the right of the program name are described as follows:
Note
name: Expand/Zoom
effect: Expand/zoom the program tree interface
Note
name: Add teaching points
effect: Add a local teaching point to the current program
Note
name: Rename
effect: Rename the current program
9.2. Tool bar
Modify the program tree using the toolbar at the bottom of the program tree.
Note
name: Open
effect: Open user program file
Note
name: New build
effect: Select a template to create a new program file
Note
name: Import
effect: Import the file into the user program folder
Note
name: Export
effect: Export user program files to a local point.
Note
name: Save
effect: Save file edits
Note
name: Save as
effect: Rename the file and store it in the user program or template program folder.
Note
name: Copy
effect: Duplicates a node and allows it to be used for other operations (eg: paste it elsewhere in the program tree).
Note
name: Paste
effect: Allows you to paste previously cut or copied nodes.
Note
name: To cut
effect: Cuts a node and allows it to be used for other operations (eg: paste it elsewhere in the program tree).
Note
name: Delete
effect: Deletes a node from the program tree.
Note
name: Move up
effect: Move the node up.
Note
name: Move down
effect: Move the node down.
Note
name: Toggle edit mode
effect:The program tree mode and lua editing mode switch each other.
The icons on the top right are described as follows:
Note
name: Programming add/edit
effect: Add/edit the contents of the current program command
Note
name: Robot Model
effect: Return to the robot 3D model interface
Note
name: NewDofile subroutine
effect: When there is a NewDofile instruction in the current program command, click to enter and select the subroutine name to view the subroutine content.
Note
name: Modbus TCP Settings
effect: Configure Modbus TCP communication parameters
Note
name: Current program backup
effect: Record the changes made to the current program
Note
name: Local teaching point
effect: Applies only to the teaching points of the current program
9.3. Program command
The left side is mainly for adding program commands. Click the icon above each keyword to enter the detailed interface of adding program commands on the right. There are two main operations for adding program commands to files:
Open the relevant command and click the Apply button to add the command to the program.
click the “Add” button first, at this time the command is not saved in the program file, and you need to click “Apply” again to save the command in the file.
The second method often occurs when multiple commands of the same type are issued. We add an add button and display the content of the added command to this type of command. Click the Add button to add a command, and the added command displays all the added commands. , click “Apply” to save the added command to the opened file on the right.
9.4. Logic Command Interface

Figure 9.4 Logic Command Interface
9.4.1. While command
Select the loop scenario of the While command, the scenario is as follows:
Always loop
Limited number of cycles: Enter the number of loops and variable name
Loop while expression is true: Click the input box to pop up the expression editor and select the corresponding expression according to the usage scenario

Figure 9.4-1-1 While command interface

Figure 9.4-1-2 While command - Always loop

Figure 9.4-1-3 While command - Limited number of cycles

Figure 9.4-1-4 While command - Expression Editor

Figure 9.4-1-5 While command - Loop while expression is true
For ease of operation, you can enter any do content and edit other instructions in the program to insert them instead.
9.4.2. if…else command
Click the “if…else” button to enter the if…else command editing interface.
This command contains the following buttons:
Add else if: When there is no “else” expression, click this button to add an “else if” expression
Delete else if: When an “else if” expression exists, click this button to delete the “else if” expression.
Add else: Click this button to add an “else” expression
Delete else: Click this button to delete the “else” expression
After clicking the corresponding button to add, click the input box to pop up the expression editor and select the corresponding expression according to the usage scenario. After adding, click “Add” and “Apply”.
This instruction requires a certain programming foundation. If you need help, please contact us.

Figure 9.4-2 if…else command interface
9.4.3. Goto command
Click the “Goto” button to enter the Goto command editing interface.
The Goto instruction is a jump instruction, enter the statement in the input box on the right, and click “Add” and “Apply” after editing. (This instruction requires a certain programming foundation, if you need help, please contact us)

Figure 9.4-3 Goto command interface
9.4.4. Wait command
Click the “Wait” icon to enter the Wait command editing interface.
This instruction is a delay instruction, which is divided into three parts: “WaitMs”, “WaitDI” and “WaitAI”.
“WaitTime” command delay waiting time unit is milliseconds, input the number of milliseconds to wait, click “Add”, “Apply”.

Figure 9.4-4 WaitTime command interface
“WaitDI” command, that is, single DI waiting, select the IO port number to be waited for, wait state, wait maximum time and wait timeout processing method, and click “Add” and “Apply”.

Figure 9.4-5 WaitDI command interface
“WaitMultiDI” command, that is, multi-DI waiting, first select the multi-DI establishment conditions, then check the DI port and status that need to wait, and finally set the maximum waiting time and waiting timeout processing method, click “Add” and “Apply”.

Figure 9.4-6 WaitMultiDI command interface
“WaitAI” command, select the analog quantity to be waited for, the value, the maximum waiting time and the waiting timeout processing method, and click “Add” and “Apply”.

Figure 9.4-7 WaitAI command interface
9.4.5. Pause command
Click the “Pause” icon to enter the Pause command editing interface.
This instruction is a pause instruction. Insert this instruction into the program. When the program executes this instruction, the robot will be in a pause state. If you want to continue running, click the “Pause/Resume” button in the control area.

Figure 9.4-8 Pause command interface
9.4.6. Dofile command
Click the “Dofile” icon to enter the Dofile command editing interface.
The Dofile command calls the internal program of the controller. When using the Dofile command, the called subroutine needs to be saved, and the main program does not need to be saved again if it has not changed. The Dofile command supports two-level calls, and two parameter settings need to be paid attention to. One is the level of the call, and the other is the ID number of the call. In principle, the same ID number cannot appear in the same program.

Figure 9.4-9 Dofile command interface
9.4.7. Var command
Click the “Var” icon to enter the Var command editing interface.
This command is a variable system command, which is divided into two parts: Lua variable definition, variable query and Sys variable renaming, getting value, and setting value. Lua variable definition can declare a variable and assign an initial value, and cooperate with while, if-else and other commands Use the Lua variable query command to query the value of the input variable name in real time and display it in the status bar. The number of Sys variables is fixed, and you can rename them, get variable values, and set variable values. The values stored in this variable will not be cleared when the system is turned off.

Figure 9.4-10 Var command interface
Important
Variable names must start with letters or underscores, not numbers or other special characters.
9.5. Motion command interface

Figure 9.5 Motion command interface
9.5.1. PTP command
Click the “PTP” icon to enter the PTP command editing interface.
You can choose the point to be reached, and the smooth transition time setting can realize that the movement from this point to the next point is continuous. Whether to set the offset, you can choose to offset based on the base coordinate system and based on the tool coordinates, and pop up x, y, z, rx, ry, rz offset settings, PTP specific path is the optimal path automatically planned by the motion controller, click “Add” and “Apply” to save this command.

Figure 9.5-1 PTP command interface
9.5.1.1. Point-to-Point Relative Motion
The robot moves a relative distance from its current position. On the PTP command addition page, select the point name as “CurrentPos”. Choose the offset coordinate system as either the base coordinate system or the tool coordinate system according to the situation, and input the offset value. This means the robot will perform a certain offset motion along the set coordinate system based on its current position. (“CurrentPos” is a system point and does not require teaching.)

Figure 9.5-1-1 PTP Relative Motion Command
Click the “Add” and “Apply” buttons to add a robot PTP relative motion command to the Lua program. Switch the robot to automatic mode and click the start button. In the example program, the robot will move 100mm along the X+ direction of the base coordinate system from its current position.

Figure 9.5-1-2 PTP Relative Motion Command Added
9.5.2. Lin command
Click the “Lin” icon to enter the Lin command editing interface.
The function of this command is similar to the “PTP” command, but the path of the point reached by this command is a straight line.

Figure 9.5-2 Lin command interface
9.5.2.1. Linear Relative Motion
The robot moves a relative distance along a straight line from its current position. On the LIN command addition page, select the point name as “CurrentPos”. Choose the offset coordinate system as either the base coordinate system or the tool coordinate system according to the situation, and input the offset value. This means the robot will perform a certain offset motion along the set coordinate system based on its current position. (“CurrentPos” is a system point and does not require teaching.)

Figure 9.5-2-1 LIN Relative Motion Command
Click the “Add” and “Apply” buttons to add a robot linear relative motion command to the Lua program. Switch the robot to automatic mode and click the start button. In the example program, the robot will move 100mm along the X+ direction of the base coordinate system from its current position.

Figure 9.5-2-2 LIN Relative Motion Command Added
Robot linear relative motion supports functions such as smoothing, physical speed, and welding wire search.
Important
When the selection point name is “seamPos”, the straight line command is applied in the welding scene using the laser sensor. Due to the accumulated operating error during welding, “whether to offset” and “offset amount” are added.
Whether to offset: No, base coordinate system offset, tool coordinate system offset, laser original data offset;
Offset: Δx, Δy, Δz, Δrx, Δry, Δrz, range: -300~300;

Figure 9.5-2-3 Lin command interface(Welding scene)
The LIN command allows selecting the motion speed mode as “Percentage” or “Physical Speed”:
Percentage: Input the debugging speed percentage. The robot moves at a percentage of its maximum speed. The actual robot motion speed is calculated as: V = Robot Maximum Speed × Global Speed Percentage × Debugging Speed Percentage. Hover the mouse over the small eye icon to the right of the “Debugging Speed” input box to display the actual physical speed (unit: mm/s) of the robot in both manual and automatic modes under the current debugging speed setting.

Figure 9.5-2-4 Input Percentage to Display Actual Physical Speed Value
Physical Speed: The input speed is the actual operating speed of the robot, unit mm/s; the input acceleration is usually set to twice the speed. (The maximum physical speed of the LIN command is limited by the global speed percentage. If the robot’s maximum operating speed is 1000mm/s and the global speed is 50%, then the maximum physical speed for the LIN command is 1000 × 50% = 500mm/s).

Figure 9.5-2-5 Input Actual Physical Speed
9.5.2.2. LIN command joint overspeed processing function
When using the Cartesian space linear motion command LIN, the constrained condition is the linear velocity, but the actual operation is affected by the workspace, and the angular velocity of the joint may have exceeded the limit when the linear velocity requirement is met. This function implements an optional handling strategy to deal with joint overspeed during LIN movements.
Step1: Click the Linear Motion Command button;

Figure 9.5-3-1 Click the Linear Motion Command button
Step2: Select the linear motion command target waypoint;

Figure 9.5-3-2 Select the linear motion target waypoint
Step3: Turn on the joint overspeed protection switch;

Figure 9.5-3-3 Turn on the joint overspeed protection switch button
Step4: Select the joint overspeed treatment strategy (first two options is not for joint overspeed treatment);

Figure 9.5-3-4 Joint overspeed treatment strategies
Step5: Set the processing option and processing parameters, then click the Add button to add the Lua command;
Under the adaptive speed reduction strategy, the deceleration threshold is the percentage of the linear velocity reduction value relative to the set linear velocity, and when the deceleration value exceeds the set threshold, the robot will report an error and stop.

Figure 9.5-3-5 Joint overspeed treatment strategy selection and setting
Step6: The added Lua command is shown in the figure;

Figure 9.5-3-6 lua command
Joint overspeed protection begins:JointOverSpeedProtectStart(a,b);
a: strategy type number(same as the order of drop-down box)
b: threshold(0~100)
Joint overspeed protection ends:JointOverSpeedProtectEnd();
Note
For the “singularity crossing” motion protection, please refer to the description of the singularity crossing function in automatic mode.
9.5.2.3. Angular velocity adjustable function
This function can be used when encountering a workpiece that requires corner welding during the welding process, or when a specific linear line is planned (a quick transition is required when the attitude change is large and the position change is small, but the linear speed cannot be accelerated).
Step1:Set the tool coordinate system to calibrate the tool size and attitude of the welding gun.
Note
The values on the interface are examples only, and the actual tool status shall prevail.

Figure 9.5-3-7 Sets the tool coordinate system
Step2:Click on “Program”, select “Coding”, and select ” LIN” in the “Motion Command” category.

Figure 9.5-3-8 Straight line command setting interface
Step3:Set the starting point of each straight line of wrapping angle welding as the transition point, turn on the “The transition point angular velocity is adjustable” button, and set the maximum acceleration percentage (the default maximum angular velocity of 100% is 360°/s).

Figure 9.5-3-9 Transition point angular velocity adjustment parameter configuration interface
Step4:Click the “Add” button to generate a LIN command with the adjustment of the transition attitude angular velocity.

Figure 9.5-3-10 Add a transition point linear motion command
Step5:The robot completes the attitude transition at the starting point, normally executes the linear command movement to the end point of the section, closes the “The transition point angular velocity is adjustable” button, and adds a termination waypoint.

Figure 9.5-3-11 Inserts the end point of the line
Step6:Click the “Apply” button to generate the corresponding LUA command.

Figure 9.5-3-12 Generate a straight LUA instruction with transition points
A complete set of corner wrapping welds usually has more than one transition point, and in the case of corner wrapping shown in Figure 7, there are two attitude transition points with small position change and large attitude change during the welding process.
Point 1 is the starting point of the first section of welding, and point 2 is the end point of the first section of welding;
Point 3 is the starting point of the second section of welding, and point 4 is the end point of the second section of welding;
Point 5 is the starting point of the third section of welding, and point 6 is the end point of the third section of welding.
The attitude transition occurs from the end point of the previous section of welding to the starting point of the next section of welding, so it is necessary to add the attitude angular velocity adjustment instruction at the starting point of the next section of welding, so that the maximum linear velocity remains unchanged during the transition of the wrapping angle attitude, and the maximum angular velocity is increased, so that the process of wrapping angle welding process runs.

Figure 9.5-3-13 Example of a wrapping welding process
9.5.3. Arc command
Click the “Arc” icon to enter the Arc command editing interface.
The “Arc” command is an arc motion, which includes three points. The first point is the starting point of the arc, the second point is the middle transition point of the arc, and the third point is the end point.
Both the transition point and the end point can be set to offset, and you can choose to base coordinate system offset Shift and offset based on tool coordinates, and pop up x, y, z, rx, ry, rz offset settings, and the end point can set a smooth transition radius to achieve continuous motion effect.
Important
For circular motion, you need to add PTP or Lin command to move to the starting point first.

Figure 9.5-4 Arc command interface
The ARC command allows you to select the motion speed mode as either “Percentage” or “Physical Speed”:
Percentage: Input a debugging speed percentage. The robot moves at a percentage of its maximum speed. The actual robot movement speed is calculated as: V = Robot Maximum Speed × Global Speed Percentage × Debugging Speed Percentage. Hover the mouse over the small eye icon to the right of the “Debugging Speed” input box to display the actual physical speed (in mm/s) of the robot in both manual and automatic modes under the current debugging speed settings.

Figure 9.5-4-1 Display Actual Physical Speed Value When Inputting Percentage
Physical Speed: The input speed is the actual operating speed of the robot, in mm/s. The input acceleration is typically set to twice the speed. (The maximum physical speed of the LIN command is limited by the global speed percentage. If the robot’s maximum operating speed is 1000 mm/s and the global speed is 50%, then the maximum physical speed for the LIN command is 1000 × 50% = 500 mm/s).

Figure 9.5-4-2 Input Actual Physical Speed
9.5.4. Circle command
Click the “Circle” icon to enter the Circle command editing interface.
The cooperative robot can carry out the circle trajectory movement by adding the circle command. Before adding the circle command, it is necessary to teach three path points on the circle trajectory. Suppose that the three path points on the circle trajectory are “P1”, “P2” and “P3” respectively, where “P1” is the starting point of the circle trajectory, “P2” and “P3” are the middle point 1 and 2 of the circle trajectory.Move the robot to the above three points and add the names of the teaching points as “P1”, “P2” and “P3” respectively.
Important
For full circle trajectory motion, you need to add PTP or Lin command to move to the starting point first.

Figure 9.5-5 Circle trajectory
Figure 9.5-6 Teaching “P1”, “P2” and “P3”
9.5.4.1. Circle command addition
Step1: Create a new user program “testCircle.lua” and click the “Circle” button to open the page of adding circle commands.



Figure 9.5-7 Add the circle command button
Step2: In the full circle instruction adding page, select the starting point motion mode and the starting point as “P1”.

Figure 9.5-8 Starting point motion mode and starting point “P1”
Step3: On the Add Circle Command page, select “Circle Intermediate Point 1” as point “P2”, and “Circle Intermediate Point 2” as point “P3”.

Figure 9.33-9 Selecting Arc Intermediate Points and Endpoint
Step4: Select the speed mode and input the speed value.
The Circle command allows you to select the motion speed mode as either “Percentage” or “Physical Speed”:
Percentage: Input a debugging speed percentage. The robot moves at a percentage of its maximum speed. The actual robot movement speed is calculated as: V = Robot Maximum Speed × Global Speed Percentage × Debugging Speed Percentage. Hover the mouse over the small eye icon to the right of the “Debugging Speed” input box to display the actual physical speed (in mm/s) of the robot in both manual and automatic modes under the current debugging speed settings.

Figure 9.33-10 Display Actual Physical Speed Value When Inputting Percentage
Physical Speed: The input speed is the actual operating speed of the robot, in mm/s. The input acceleration is typically set to twice the speed. (The maximum physical speed of the LIN command is limited by the global speed percentage. If the robot’s maximum operating speed is 1000 mm/s and the global speed is 50%, then the maximum physical speed for the LIN command is 1000 × 50% = 500 mm/s).

Figure 9.33-11 Input Actual Physical Speed
Step5: Click the “Add” button and then the “Apply” button in sequence. At this point, the circle motion command has been added to “testCircle.lua”.

Figure 9.33-12 Addition of Circle Motion Command
Step5: At this point, the circle motion command has been added to “testCircle.lua”.
Switch the robot to automatic mode, start the program on the premise of ensuring safety, and the robot will move according to the circle trajectory shown in Figure 1.
9.5.4.2. Circle trajectory offset
The circular motion of the cooperative robot supports the offset of the positions of the middle point 1 and the middle point 2 of the circular trajectory, and the offset types include the following two types:
The middle points of the two trajectories of the circle have the same offset: the middle point 1 (P2) and the middle point 2 (P3) of the circle are offset by the same offset ∆(dx, dy, dz, drx, dry, drz).
The middle points of the two trajectories of the circle have different offsets: the middle point 1 (P2) and the middle point 2 (P3) of the circle adopt two different offsets ∆1 (dx1, dy1, dz1, drx1, dry1, drz1) and ∆2 (dx2, dy2, dz2, drx2, dry2, drz2) respectively.
The following demonstrates the usage of “same offset” and “different offset” respectively.
Same offset
Open the circle command addition page, select “Same Offset” for Offset Type, and also select the starting point motion mode and starting point as “P1”, and the middle point 1 of the full circle as “P2”.

Figure 9.5-12 Same offset of the circle
Select P3 for the middle point 2 of the circle, and select Base Coordinate Offset for Offset.
Note
Note: you can select Tool Coordinate Offset according to the actual work situation.
Enter the offset dx as 10mm, and then click the Add button and the Apply button at the bottom of the page.

Figure 9.5-13 Setting Offset
At this time, a full circle starting point is “P1”, and the two intermediate points “P2” and “P3” are offset by 10mm along the X-axis direction of the base coordinate system. The full circle instruction has been added to the “testCircle.lua” program.

Figure 9.5-14 Same Offset Program for Circle
Switch the robot to the automatic mode, and start the program under the condition of ensuring safety. The actual motion trajectory of the robot passes through the circles of “P1”, “P2” and “P3”, where “P2” is the point where the original “P2” is offset by 10mm in the X direction, and “P3” is the point where the original “P3” is offset by 10mm in the X direction.

Figure 9.5-15 Track with the same offset X10mm
Different offset
Open the circle command adding page, select “Different Offsets” for Offset Type, and also select the starting point motion mode and starting point as “P1”, and the middle point 1 of the full circle as “P2”, and select “Base coordinate offset” for “Offset”.
Note
Note: you can select “Tool coordinate offset” according to the actual work situation.
Enter the offset dy as 10mm.

Figure 9.5-16 Different offsets
Select P3 for the middle point 2 of the circle, and select Base Coordinate Offset for Offset
Note
Note: you can select Tool Coordinate Offset according to the actual work situation.
Enter the offset dx as 10mm, and then click the Add button and the Apply button at the bottom of the page.

Figure 9.5-17 Offset of middle point 2 is set with different offsets
At this time, an command that the middle point “P2” of the circle is shifted by 10mm along the Y direction of the base coordinate system and “P3” is shifted by 10mm along the X axis direction of the base coordinate system has been added to the “testCircle.lua” program; Of course, a linear motion command needs to be added before the circle motion command to make the robot move to the starting point of the circle.

Figure 9.5-18 Program for Two Different Offset Points of Circle
Switch the robot to the automatic mode, and start the program under the condition of ensuring safety. The actual motion trajectory of the robot passes through the circles of “P1”, “P2” and “P3”, where “P2” is the point where the original “P2” is offset by 10mm in the Y direction, and “P3” is the point where the original P3 is offset by 10mm in the X direction.

Figure 9.5-19 Two trajectory points of the circle are offset from the trajectory respectively
9.5.5. Spiral command
Click the “Spiral” icon to enter the Spiral command editing interface.
The “Spiral” command is a spiral motion, which includes three points, which form a circle. On the third point setting page, there are several parameters including the number of spiral turns, attitude correction angle, radius increment and rotation axis direction increment. Setting, the number of helix circles is the number of motion circles of the helix, the attitude correction angle is the attitude at the end of the helix and the attitude of the first point of the helix, the radius increment is the increment of the radius of each circle, and the direction of the rotation axis is increased. The amount is the increment in the direction of the screw axis. set up Whether to offset, the offset takes effect on the trajectory of the entire helix.

Figure 9.5-20 Spiral command interface
9.5.6. N-Spiral command
Click the “N-Spiral” icon to enter the N-Spiral command editing interface.
The “N-Spiral” command is an optimized version of the spiral motion. This command only needs one point plus the configuration of various parameters to realize the spiral motion. The robot takes the current position as the starting point, and the user sets the debugging speed, whether to offset, the number of spiral turns, the spiral inclination, the initial radius, the radius increment, the rotation axis direction increment and the rotation direction. The number of spiral turns is the helix. The number of motion circles, the helix inclination is the angle between the Z axis of the tool and the horizontal direction, the attitude correction angle is the attitude at the end of the helix and the attitude of the first point of the helix, the initial radius is the radius of the first circle, and the radius increment That is, the increment of the radius of each circle, the increment in the direction of the rotation axis is the increment in the direction of the screw axis, and the direction of rotation is clockwise and counterclockwise.

Figure 9.5-21 N-Spiral command interface
9.5.6.1. Uniform Speed Per Helix Circle Setting Function
9.5.6.1.1. Overview
When using the helical motion command, the operating speed of the helical motion can be set, ensuring the speed of each circle maintains the set operating speed.
9.5.6.1.2. Operation Process
Step1: Select the teaching point that executes the helical motion. This manual uses “P0” as the name of the teaching point.
Step2: Click the “Teach Program” -> “Program Programming” button, select the “New Helix” command. In the “Speed Mode”, select “Physical Speed”, and set the speed value and acceleration value. This speed value is the actual operating speed of the helix. Set parameters such as “Number of Helix Circles”, “Helix Inclination Angle”, “Initial Radius”, “Radius Increment”, “Rotation Axis Direction Increment”, and “Rotation Direction” according to actual needs, as shown in Figure 2-1.

Figure 9.5-21-1 New Helix Parameter Settings
Step3: Add the motion command, generate the Lua program and run it to achieve the helical motion function at the set speed, as shown in Figure 2-2.

Figure 9.5-21-2 Typical Program for Running Helix at Set Speed
9.5.7. H-Spiral command
Click the “H-Spiral” icon to enter the H-Spiral command editing interface.
The “H-Spiral” command is a horizontal space spiral motion. This command is set after the single-segment motion (straight line) command.
Spiral radius: 0~100mmHelix angular speed: 0~2rev/sDirection of rotation: spiral clockwise/counterclockwiseHelix inclination angle: 0~40°

Figure 9.5-22 H-Spiral command interface
9.5.8. Spline command
Click the “Spline” icon to enter the Spline command editing interface.
The command is divided into three parts: the start of the spline group, the spline segment and the end of the spline group. The start of the spline group is the start mark of the spline movement. The spline segment includes SPL, SLIN and SCIRC segments. Click the corresponding icon to enter the command Add interface, the end of spline group is the end sign of spline movement.

Figure 9.5-23 Spline command interface
9.5.9. N-Spline command
Click the “N-Spline” icon to enter the N-Spline command editing interface.
This instruction is an optimization instruction for the Spline instruction algorithm, and will replace the existing Spline instruction in the future.
This instruction is divided into three parts: the start of the multi-point trajectory, the segment of the multi-point trajectory and the end of the multi-point trajectory. The start mark, the multi-point track segment is to set each track point.
Click the icon to enter the point adding interface, the end of the multi-point track is the end mark of the multi-point track movement, here you can set the control mode and debugging speed.
Control mode: arc transition point/given path point
Global average connection time: integer, greater than 10, default value is 2000

Figure 9.5-24 N-Spline command interface
9.5.10. Weave command
Click the “Weave” icon to enter the Weave command editing interface. The “Weave” command consists of two parts.
Select the weaving number with configured parameters, click “Start Weaving” and “Stop Weaving” and apply to add related commands to the program.

Figure 9.5-25 Weave command interface
Click “Configuration and Test” to select the weaving type according to the usage scenario and configure the weaving parameters. After the configuration is completed, the weaving trajectory can be tested by pressing the start weaving test and stop weaving test buttons. The current swing types are:
Triangular wave swing (LIN/ARC)
Vertical L-shaped triangular wave swing (LIN/ARC)
Circular Oscillation - Clockwise (LIN)
Circular Oscillation - Counterclockwise (LIN)
Sine wave swing (LIN/ARC)
Vertical L-shaped sine wave swing (LIN/ARC)
Vertical welding triangle swing

Figure 9.5-26 Weave configuration and testing command interface
9.5.10.1. Slope serration weave function
This function allows the end of the robot tool to generate slope serration weave trajectory in Cartesian space. The weave is superimposed on the linear trajectory, and the azimuth parameter (unit deg) defines the azimuth angle of the swing welding on the specified welding plane;
When the value is positive, the left endpoint is skewed in the forward direction, and when it is negative, the right endpoint is skewed in the forward direction; If it is 90deg or -90deg, it can weave in the forward direction.

Figure 9.5-26-1 Swing azimuth effect
Step1:Edit to set up basic linear motion.

Figure 9.5-26-2 Example of a basic linear motion LUA program
Step2:Add weave command in motion command block.

Figure 9.5-26-3 Add weave command
Step3:Click the “Configure” button, select “Triangular wave swing” or “Sine wave swing” from the drop-down box, imput desired azimuth angle in “Swing direction azimuth” box and click “Apply”.

Figure 9.5-26-4 Weave parameter configuration
Step4:Click the “Start Swing” button to add the swing command above the linear motion; Click the “Stop Swing” button to add the swing command below the linear motion.


Figure 9.5-26-5 Add the lua program after the swing command
Step5:Click “Start Running”buttom, and the end trajectory of the robot is shown in the figure.

Figure 9.5-26-6 Zigzag weave (left) slope serration weave (right)
9.5.11. TPD command
Click the “TPD” button to enter the TPD command editing interface.
In this command, the user first needs to have a recorded track.
About track recording: Before preparing to record the track, first save the starting point of the track. When the robot is in the dragging mode, input the file name, select the period (assuming the value is x, that is, record a point every x milliseconds, it is recommended to record a point every 4 milliseconds), the point starts recording, and the user can drag the robot to specify Movement, after the recording is completed, click to stop recording, and the previous movement track of the robot can be saved. When a movement cannot be fully recorded, a A reminder that the number of recording points exceeds the limit is displayed, and the user needs to record the exercise in several times.
When programming, first use the PTP instruction to reach the starting point of the corresponding trajectory, then select the trajectory in the TPD trajectory reproduction instruction, select whether it is smooth, set the debugging speed, and click “Add” and “Apply” in sequence to insert the program. The trajectory loading command is mainly used to pre-read the trajectory file and extract it into a trajectory command, which is better applied to the conveyor belt tracking scene.
Note
For the detailed operation of TPD, please refer to the teaching programming (TPD) function operation instruction module.
Figure 9.5-27 TPD command interface
9.5.12. Offset command
Click the “Offset” icon to enter the Offset command editing interface.
This command is an overall offset command. Input each offset, add the opening command and closing command to the program, and the motion command between the start and close will be offset based on the base coordinates (or workpiece coordinates).
Figure 9.5-28 Offset command interface
9.5.13. Servo Command
Click the “Servo” icon to enter the servoMotion command editing interface. Servo motion includes servo motion in Cartesian space and servo motion in joint space.
Figure 9.5-29-1 Servo Motion Command Interface
9.5.13.1. Servo Motion in Cartesian Space
ServoCart servo control (Cartesian space motion) command. This command can control robot motion through absolute pose control or offset control based on the current pose.
Figure 9.5-29-2 ServoCart Command Interface
Example of absolute pose control program:
Figure 9.5-29-3 ServoCart Absolute Motion
In this example, x, y, z, rx, ry, rz (Cartesian position) are the acquired current robot position. Additionally, users can control robot motion by reading trajectory data files, sending trajectory data via socket communication, etc.
Example of control program based on offset from current pose (base coordinate offset):
Figure 9.5-29-4 ServoCart Relative Motion
9.5.13.2. Servo Motion in Joint Space
ServoJ servo control (joint space motion) command. This command can control robot motion through absolute robot joint positions.
Click “Teaching Program”, “Program Programming”, “Servo Motion” in sequence. On the servoMotion command page, select “Joint Space Motion”.
Figure 9.5-29-5 ServoJ Command Editing
The parameters in the command are explained as follows:
Joint Position: The target joint position for ServoJ motion. The motion from the current position to the target position needs to be completed within the set command cycle. If the deviation between the target position and the current position command is too large, the robot may report errors such as joint overspeed.
Extended Axis Position: The target extended axis position for ServoJ motion.
Acceleration: Acceleration percentage for ServoJ motion (currently not available).
Speed: Speed percentage for ServoJ motion (currently not available; the actual robot operating speed currently depends on the position difference between two ServoJ commands and the command cycle).
Command Cycle: Execution time interval between two ServoJ commands.
Input the corresponding target position, speed, acceleration, and command cycle. Click the “Add” and “Apply” buttons to add a ServoJ command to the LUA program.
Figure 9.5-29-6 ServoJ Command Added to Lua Program
In practice, it is often necessary to continuously send multiple ServoJ commands according to the set command cycle. The target joint positions of these ServoJ commands form a continuous robot motion curve, enabling flexible robot motion control. The sending cycle of the commands must match the set command cycle.
ServoJ motion control can be implemented in the LUA program through loops or by adding multiple commands consecutively.
Figure 9.5-29-7 Example of Continuous ServoJ Motion
Figure 9.5-29-8 Example of Continuous ServoJ Motion 1
9.5.13.3. Extended Axis Debugging Instructions
9.5.13.3.1. Overview
The GetInverseKinExaxis instruction interface for the inverse kinematics of extended axis target positions and the ServoCart instruction interface with extended axis positions support various scenarios where extended axes and robots are used simultaneously.
9.5.13.3.2. Operation Process
Step1: The parameters and return value of the inverse kinematics GetInverseKinExaxis instruction interface are shown in the tables below.
Table 9.5-1 GetInverseKinExaxis Parameters
No. | Data Type | Variable Name | Detailed Description |
1 | uint8_t | posMode | 0: Absolute pose, 1: Relative pose - Base coordinate system, 2: Relative pose - Tool coordinate system |
2 | float | desePos[6] | Robot Cartesian position |
3 | float | exaxis[4] | Extended axis position |
4 | int | toolNum | Tool number [0-14] |
5 | int | workPieceNum | Workpiece number [0-14] |
Table 9.5-2 GetInverseKinExaxis Return Value
No. | Data Type | Variable Name | Detailed Description |
1 | float | jointPos[6] | Joint position |
Step2: The calling format of the inverse kinematics GetInverseKinExaxis instruction in a Lua program is shown in the figure below. By simply inputting the parameters listed in the table, the corresponding joint values can be obtained. For calls in the SDK, refer to the corresponding SDK documentation.
Figure 9.5-29-9 GetInverseKinExaxis Call in Lua
Step3: The ServoCart instruction interface with extended axis positions is shown in the table below, with no return value.
Table 9.5-3 ServoCart Parameters
No. | Data Type | Variable Name | Detailed Description |
1 | uint8_t | posMode | 0: Absolute pose, 1: Relative pose - Base coordinate system, 2: Relative pose - Tool coordinate system |
2 | float | desePos[6] | Robot Cartesian position |
3 | float | gain[6] | Pose proportionality coefficient, used in relative pose cases |
4 | float | exaxis[4] | Extended axis position |
5 | float | acc | Acceleration proportion, 0~100, default 0 |
6 | float | vel | Velocity proportion, 0~100, default 0 |
7 | float | interval | Instruction period [s] |
8 | float | filterTime | Filter time [s], temporarily unavailable |
9 | float | posGain | Proportional amplifier for target position, temporarily unavailable |
Step4: The calling format of the ServoCart instruction with extended axis positions in a Lua program is shown in the figure below. By simply inputting the parameters listed in the table, the robot can execute ServoCart motion with extended axis positions. For calls in the SDK, refer to the corresponding SDK documentation.
Figure 9.5-29-10 ServoCart Call in Lua