Skip to main content
Skip table of contents

Overview of Sub/Call Sub

OPTIONAL NORMAL 5 MIN

Sub is an abbreviation of Subroutine. A subroutine refers to a process that minimizes the number of steps in a program by calling necessary parts when two or more duplicate parts are present.

  • Doosan Robotics robots provide a CallSub command to call Sub commands and the corresponding Sub paragraph.
  • The Sub command functions as defined in Python.


Note

  • Sub paragraph must be added in MainSub, the start of a Main paragraph, and EndMainSub, the end of a Main paragraph.
  • In addition to repetition, the Sub command is also used to simplify a Main paragraph. Utilizing a Sub command will allow intuitive identification of what task of a Main paragraph is being performed at the moment.
  • Utilizing a Sub command allows Sub paragraph unit testing.

The sample where a Sub command is used to execute grip and release motions of a robot gripper consists of the following.

  1. Lines of the Main paragraph execute the task program in sequential order starting from the first line.

  2. Move to Sub(A) called by Call Sub.
    • Sample
      • Program: Call the Grip subroutine.
      • Robot: No motion.

  3. Sub(A) is executed. All Sub paragraph lines are executed in sequential order, returns to the Main paragraph, and executes the next line.
    • Sample
      • Program: Execute the Grip subroutine lines in sequential order. Use the Set command to set Output [1] as ON and Output [2] as OFF.
      • Robot: The robot gripper executes Grip motion.

  4. Move to Sub(B) called by Call Sub.
    • Sample
      • Program: Call the Release subroutine.
      • Robot: No motion.

  5. Sub(B) is executed. All Sub paragraph lines are executed in sequential order, returns to the Main paragraph, and executes the next line.
    • Sample
      • Program: Execute the Grip subroutine lines in sequential order. Use the Set command to set Output [1] as OFF and Output [2] as ON.
      • Robot: The robot gripper executes Release motion.

Add Sub command

  1. In the Task Editor module, under the Flow Control section of the right-hand Command menu, add a Sub command.
  2. Enter the subroutine name.

Add CallSub command

  1. In the Task Editor module, under the Flow Control section of the right-hand Command menu, add a Call Sub command.
  2. Select the subroutine name registered with Sub command. 



Note

  • If the number of lines increases in the task program, it may become difficult to find subroutines. In such case, touch the Go to selected Subroutine in the Property of CallSub command to move the focus to the corresponding Sub command line.
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.