Skip to content

Commit

Permalink
(roseus_bt) Use SubTreePlus instead of SubTree
Browse files Browse the repository at this point in the history
  • Loading branch information
Affonso-Gui committed Nov 25, 2022
1 parent a608bed commit a1bde75
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions roseus_bt/include/roseus_bt/xml_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ void XMLParser::check_xml_file(std::string filename) {
name != "RemoteCondition" &&
name != "Subscriber" &&
name != "RemoteSubscriber" &&
name != "SubTreePlus" &&
name != "SubTree") {
throw XMLError::UnknownNode(node);
}
Expand Down
2 changes: 1 addition & 1 deletion roseus_bt/sample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ rosrun groot Groot

The fifth example https://github.com/Affonso-Gui/jsk_roseus/blob/roseus_bt/roseus_bt/sample/models/t05_subtrees.xml wraps up the previous task in a subtree and adds another example task.

Nested trees can be defined with multiple `<BehaviorTree/>` tags and referenced with the `<SubTree/>` tag.
Nested trees can be defined with multiple `<BehaviorTree/>` tags and referenced with the `<SubTree/>` or `<SubTreePlus/>` tag. The `<SubTreePlus/>` allows for passing both port mappings and/or static values to the subtree, and should be generally preferred over the `<SubTree/>` notation.

Each subtree inherits a separate blackboard and accepts remaps in the `inner_name="outer_name"` syntax.

Expand Down
8 changes: 4 additions & 4 deletions roseus_bt/sample/models/t05_subtrees.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<Action ID="InitWithBroom" name="Initialize Task"/>
<Action ID="setCoords" name="setBottleCoords" coords="${bottle_coords}"/>
<Sequence>
<SubTree ID="PourTask" coords="bottle_coords"/>
<SubTree ID="SweepTask"/>
<SubTreePlus ID="PourTask" coords="bottle_coords"/>
<SubTreePlus ID="SweepTask"/>
</Sequence>
</SequenceStar>
</BehaviorTree>
Expand Down Expand Up @@ -37,8 +37,8 @@
</BehaviorTree>
<!-- ////////// -->
<TreeNodesModel>
<SubTree ID="PourTask"/>
<SubTree ID="SweepTask"/>
<SubTreePlus ID="PourTask"/>
<SubTreePlus ID="SweepTask"/>

<Action ID="InitWithBroom" server_name="/t05_subtrees/init"/>
<Action ID="MoveTo" server_name="/t05_subtrees/moveto">
Expand Down
10 changes: 5 additions & 5 deletions roseus_bt/sample/models/t06_reactive.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<Sequence>
<ReactiveFallback>
<Condition ID="CheckTrue" value="${needs_drink}" name="NeedsDrink"/>
<SubTree ID="SweepTask"/>
<SubTreePlus ID="SweepTask"/>
</ReactiveFallback>
<SubTree ID="PourTask" coords="bottle_coords"/>
<SubTreePlus ID="PourTask" coords="bottle_coords"/>
</Sequence>
</SequenceStar>
</BehaviorTree>
Expand Down Expand Up @@ -39,10 +39,10 @@
</BehaviorTree>
<!-- ////////// -->
<TreeNodesModel>
<SubTree ID="PourTask">
<SubTreePlus ID="PourTask">
<input_port default="bottle_coords" name="coords" type=""/>
</SubTree>
<SubTree ID="SweepTask"/>
</SubTreePlus>
<SubTreePlus ID="SweepTask"/>

<Action ID="InitWithBroom" server_name="/t06_reactive/init"/>
<Action ID="MoveTo" server_name="/t06_reactive/moveto">
Expand Down
8 changes: 4 additions & 4 deletions roseus_bt/sample/models/t07_xacro.xml.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<Action ID="InitWithBroom" name="Initialize Task"/>
<Action ID="setCoords" name="setBottleCoords" coords="$${bottle_coords}"/>
<Sequence>
<SubTree ID="PourTask" coords="bottle_coords"/>
<SubTree ID="SweepTask"/>
<SubTreePlus ID="PourTask" coords="bottle_coords"/>
<SubTreePlus ID="SweepTask"/>
</Sequence>
</SequenceStar>
</BehaviorTree>
Expand All @@ -25,8 +25,8 @@
<xacro:sweep_task.generate_bt ID="SweepTask"/>
<!-- ////////// -->
<TreeNodesModel>
<SubTree ID="PourTask"/>
<SubTree ID="SweepTask"/>
<SubTreePlus ID="PourTask"/>
<SubTreePlus ID="SweepTask"/>

<Action ID="InitWithBroom" server_name="${namespace}/init"/>
<Action ID="setCoords" server_name="${namespace}/setcoords">
Expand Down

0 comments on commit a1bde75

Please sign in to comment.