Revision as of 12:55, 28 September 2021 by Sdkuser (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation , search

Node Description

Subtask 5 1.png

Subtask Node

The Subtask node allows for better organization and handling of big task. This method allows to create a flexible and complex structure as a combination of multiple subtasks using simple steps. The new structure of the behavior tree must include exactly one task (referred here as “main task”), and optionally one or more subtasks. To enable data passing between a subtask and its parent task, the subtask uses parameters which can be created using the subtask’s User Variables Panel. There are two kinds of parameters: In and Out. “In” type parameters are used to pass data into the subtask, while “Out” type parameters are used to pass data from the subtask to its parent task. This way the parent task can control the subtask and get back a result from it.


Node Type

Primitive - Cannot have children.


Node Editor

Subtask step 1.png Subtask step 2.png


  • OPEN
Open the selected subtask’s tab
  • +ADD
Select task to use as a subtask for this node by creating a new task or by loading an existing task.
  • ID
Not editable
  • Name
Auto generated and user editable.
  • Subtask Symbol (Or “+” Symbol):
Select task to use as a subtask for this node by creating a new task or by loading an existing task.
  • PARAMETERS – IN:
Link user variable or other shared data to subtask’s “In” type parameter.
  • RETURNS – OUT:
Link user variable or other shared data to be subtask’s “Out” type
  • Comments:
User editable - add comments about this node.


Example Task

This task lets the user define three different “pick” sessions and three different “place” sessions. The user can select the desired combination of them during run time. Please note: subtask feature is not necessary for this example, it could be done without it too. But it has a lot of benefit in making the behavior tree clear and understandable.


  1. Create a new task and save it with “MAIN” name.
  2. Add a Subtask Node as a child of the “Task” Node.
  3. Open the Subtask Node Editor.
  4. Click “+add” button.
  5. Click “+new” in the popup menu.
  6. Choose “Basic task”
  7. Name it “SUB PICK”, and click “OK”.
  8. A popup message should appear: ”Save Current Task? Do you first want to save changes made to your current task, Subtask Example MAIN?” Please select “save” option.
  9. In SUB PICK’s tab: delete “Loop” Node by selecting it and press “delete” keyboard button. In the popup message choose “delete node”.
  10. open User Variables Panel.
  11. click “+” button.
  12. Fill these settings and click “save”.
    Subtask step 4.jpg
  13. Add “Do If” Node.
  14. Add a condition to it: Selector == 1
    Subtask step 5.jpg
  15. Add “Do If” Node as a sibling (under) of the first one.
  16. Add a condition: Selector == 2.
  17. Add “Do If” Node as a sibling (under) of the others.
  18. Add a condition: Selector == 3.
  19. Open Tooling Gallery.
  20. Click “+” button (attach tool to current task) for the tool you want to use.
  21. Add a template “PICK” as a child of the first Do IF Node.
  22. Fill the required parameters in the Template Node.
  23. Add poses to the required Move To Nodes of the template. This is how the branch should be:
    Subtask step 6.jpg
  24. Repeat steps 21-23 for the other Do If Nodes. This is how the behavior tree should look like:
    Subtask step 7.jpg
  25. Change to Main task tab.
  26. A popup message should appear: ”Save Current Task? Do you first want to save changes made to your current task, Subtask Example MAIN?” Please select “save” option.
  27. In “Main” task tab: add another Subtask Node as a child of “Task” Node.
  28. Repeat steps 3-26, with this exception: replace every “PICK” with a “PLACE”.
  29. In “Main” task tab: open User Variables Panel.
  30. click “+” button.
  31. Define “Pick Selector” value of type integer.
  32. click “+” button again.
  33. Define “Place Selector” value of type integer.
  34. Open the first Subtask Node that holds “SUB PICK” Subtask. In the Selector parameter list select “Pick Selector”.
  35. Open the second Subtask Node that holds “SUB PLACE” Subtask. In the Selector parameter list select “Place Selector”.
  36. Run the task.
  37. Use the User Variables Panel to select which pick and place sessions should be performed. Type a value between 1 to 3 for “Pick Selector” and another one for “Place Selector” to watch the responsiveness.

NOTE

  • The subtask node can be extremely useful in these cases:
    • A big task with a clear behavior tree.
    • A task with a branch (set of nodes) that’s being used multiple times in the behavior tree.
    • A complex task that’s edited by different people in parallel.
    • Creating a task as a function that benefits many other tasks (a pick a place method, data processing, etc.).
  • Selecting a subtask is very flexible:
    • Any task saved on the robot can be used as a subtask.
    • The same subtask can be replicated to many subtask nodes. These nodes can be used in many other main tasks.
    • It is possible to add one or more subtasks as children of another subtask.