Skip to content

Advanced Program Node

Advanced program node can realize functions such as loop, determination, call, multi-thread, etc., improve programming efficiency, reduce the probability of program errors, and make the program more flexible and convenient.

Thread

The [Thread] command is designed to create a multi-thread, that is, a program that can be parallel with the master program. The thread can be used to control other external devices that are not related to the robot arm.

注意

  1. Under Thread node, you can add nodes not related to motion, such as Set, Wait, Assignment, etc.
  2. Adding nodes related to motion under the Thread node, such as Move, Waypoint, etc., may cause robot operation conflicts and trigger other safety risks.
  3. It is recommended to avoid the use of multi-thread whenever possible. If multi-thread must be used, pay attention to the parallel logic and timing matching of the primary thread and secondary thread.

Settings

  • Infinite loop: When this option is checked, the program in the thread can run in an infinite loop until stop.

Subprogram

The [SubProgram] command is designed to create a subprogram, which is also known as subproject. It is often used in conjunction with the [Call] node.

Characteristics of subprogram:

  • The subprogram can be either a control program or a controlled program.

  • The data contained in the subprogram only represents the information present when the subprogram is activated within the master program.

  • The subprogram can be called and run at multiple positions within multiple programs through the [Call] node.

    注意

    When subprogram is called, you need to write a program in [Subprogram] node, or click to load the written program, and then use the [Call] node to call the subprogram.

Settings

  • : Rename the subprogram in master program.

  • : Load the program file.

  • Save as: You can save the subprogram as a separate file in the disk.

  • Clear: You can clear the open files within the subprogram.

  • Keep SubProgram Files Updated with this Program: When this option is checked, changes in the open subprogram will be automatically saved to the subprogram file.

    注意

    This option is only available in a subprogram that has been saved as a file.

Call

The [Call] command is designed to call the subprogram. When the program executes to this node, it jumps to the called subprogram.

Loop

The [Loop] command is designed to create a loop program block.

Settings

  • Loop always: When this option is checked, the nodes in the program block will run in an infinite loop.

  • Loop N times: If this option is checked, after setting of the "Loop count", where $$N$$ is the number of loops, the nodes in the program block will run in a loop for $$N$$ times. The program creates a special loop variable (loop_0 as shown in the figure) that can be used in the expression inside the loop. After entering the loop, the loop variable starts counting from $$0$$ to $$N -1$$, ending the loop.

  • Loop when expression is True: If this option is checked, after setting of the expression, when the program runs to the node, whether the expression is true will be determined: if the expression is true, the loop will be entered and the node in the program block will be executed; If the expression is determined to be false, this loop is skipped.

    • Check expression continuously: If this option is checked, the expression will be continuously checked during execution of the loop program block, and once the expression is determined to be false, the [Loop] program block will be skipped at any time.

Break

The [Break] command is designed to break the loop.

Set break mode

  • Break: Terminate the current loop iteration immediately, and the program runs the next program node of the Loop node.
  • Continue: Skip the remaining code within the current loop iteration and proceed to the next iteration. If the Loop node does not require variable or expression determination, the next loop will be entered immediately. If the Loop node requires variable or expression determination, determination will be made first. If it is true, the next loop will be entered; If it is false, the loop will be ended.

If/ElseIf/Else

The [If] command is designed to create a condition for determination of the program block.

The [ElseIf] command is designed to create a condition for determination of the program block under the "If" node.

The [Else] command is designed to create a program block under the If or ElseIf node.

1. Settings

If setting:

  • Click the expression $$ f(x) $$ in the If interface to edit the condition expression.

  • Check expression continuously: If this option is checked, the condition expression will be continuously checked during execution of the If program block, and once the expression is determined to be false, the If program block will be skipped at any time.

ElseIf setting:

  • Click the expression $$ f(x) $$ in the ElseIf interface to edit the condition expression.

  • Check expression continuously: If this option is checked, the condition expression will be continuously checked during execution of the ElseIf program block, and once the expression is determined to be false, the ElseIf program block will be skipped at any time.

2. Application

  • If: If the If condition is true, the If program block is executed.
  • If...Else...: if the If condition is true, the program inside this If node will be executed; Otherwise the program in the Else node will be executed.
  • If...Else...If...Else...: if the If condition is true, the program inside this If node will be executed; Otherwise whether the "ElseIf" condition is true will be determined. If the "ElseIf" condition is true, the program inside the "ElseIf" node will be executed, otherwise the program inside the "Else" node will be executed.
Example:

Set an initial variable variable_0. The program starts execution and runs to waypoint_0. Determine whether variable_0 is less than or equal to 2. If variable_0 is less than or equal to 2, execute MoveJ with the comment "left". If variable_0 is greater than 2, determine whether variable_0 is less than or equal to 5. If variable_0 is greater than 2 and less than or equal to 5, execute MoveJ with the comment "right". If variable_0 is greater than 5, execute MoveJ with the comment "Up".

Switch/Case/Default

The [Switch] command is designed to create multiple switches, and control the flow of the program according to the value of the variables. You can set whether to add a Default program block to the program tree. For "Synchronize", see the description of "Synchronize" in "4.3.6 Assignment".

The [Case] command is designed to create a Case program block under Switch.

Case node can be inserted under Switch node only.

Application

  • Switch...Case...Default...: Execute different Case program blocks by determining the conditions. You can enter the selection and determination condition expression in the "Switch" interface, and enter the matching value in the "Case" interface. When the program runs the "Branch" node, it first calculates the value of the expression of the "Branch" node, which is then compared with the values of the "Condition" under the "Branch": if the same value is matched in all the conditions, the "Condition" program block will be executed; If no matching "Condition" value is found, the "Default" program block under that "Branch" will be executed.
    • A "Branch" can include 0 to several "Condition" program blocks.
    • A "Branch" can include 0 to 1 "Default" program block, which can be added by checking the "Add default condition" in the "Branch".
Example:

Set an initial variable variable_0. Access the program and run it to waypoint_0. Determine whether variable_0 is equal to 0. If variable_0 is equal to 0, run MoveJ with the comment "Right"; If variable_0 is not equal to 0, determine whether variable_0 is equal to 1. If variable_0 is equal to 1, run MoveJ with the comment "Left". If variable_0 is neither equal to 0 nor equal to 1, run MoveJ with the comment "High".