Using the Subtask Node

Created by Rico Stodt, Modified on Tue, 16 Aug, 2022 at 1:17 PM by Rico Stodt

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.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article