1
- # Sequences and Async Actions
1
+ # Sequences and AsyncActionNode
2
2
3
3
The next example shows the difference between a ` SequenceNode ` and a
4
- ` SequenceStarNode ` .
5
-
6
- Additionally, we introduce the __ Loggers__ which are mechanism to print,
7
- store and publish state transitions in the tree.
8
-
9
- ## Asynchronous Actions
4
+ ` ReactiveSequence ` .
10
5
11
6
An Asynchornous Action has it's own thread. This allows the user to
12
7
use blocking functions but to return the flow of execution
@@ -82,7 +77,7 @@ The user must also implement `convertFromString<Pose2D>(StringView)`,
82
77
as shown in the previous tutorial.
83
78
84
79
85
- ## Sequence VS SequenceStar
80
+ ## Sequence VS ReactiveSequence
86
81
87
82
The following example should use a simple ` SequenceNode ` .
88
83
@@ -139,35 +134,32 @@ Expected output:
139
134
[ MoveBase: STARTED ]. goal: x=1 y=2.0 theta=3.00
140
135
141
136
--- 2nd executeTick() ---
142
- [ Battery: OK ]
143
137
[ MoveBase: FINISHED ]
144
138
145
139
--- 3rd executeTick() ---
146
- [ Battery: OK ]
147
140
Robot says: "mission completed!"
148
141
```
149
142
150
-
151
143
You may noticed that when ` executeTick() ` was called, ` MoveBase ` returned
152
144
__ RUNNING__ the 1st and 2nd time, and eventually __ SUCCESS__ the 3rd time.
153
145
154
- On the other hand, the ` ConditionNode ` called ` BatteryOK ` was executed three times.
155
- If, at any point, ` BatteryOK ` returned __ FAILURE__ , the ` MoveBase ` actions
156
- would be _ interrupted_ (_ halted_ , to be specific).
146
+ ` BatteryOK ` is executed only once.
157
147
148
+ If we use ` ReactiveSequence ` instead, when the child ` MoveBase ` returns RUNNING,
149
+ the sequence is restarted and the condition ` BatteryOK ` is executed __ again__ .
158
150
159
- If we use ` SequenceStarNode ` instead, any succesful children (in particular
160
- ` BatteryOK ` ) will be executed only _ once _ .
151
+ If, at any point, ` BatteryOK ` returned __ FAILURE __ , the ` MoveBase ` actions
152
+ would be _ interrupted _ ( _ halted _ , to be specific) .
161
153
162
154
``` XML hl_lines="3"
163
155
<root >
164
156
<BehaviorTree >
165
- <SequenceStar >
157
+ <ReactiveSequence >
166
158
<BatteryOK />
167
159
<SaySomething message =" mission started..." />
168
160
<MoveBase goal =" 1;2;3" />
169
161
<SaySomething message =" mission completed!" />
170
- </SequenceStar >
162
+ </ReactiveSequence >
171
163
</BehaviorTree >
172
164
</root >
173
165
```
@@ -182,9 +174,11 @@ Expected output:
182
174
[ MoveBase: STARTED ]. goal: x=1 y=2.0 theta=3.00
183
175
184
176
--- 2nd executeTick() ---
177
+ [ Battery: OK ]
185
178
[ MoveBase: FINISHED ]
186
179
187
180
--- 3rd executeTick() ---
181
+ [ Battery: OK ]
188
182
Robot says: "mission completed!"
189
183
```
190
184
0 commit comments