You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/asynchronous_nodes.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,12 +33,12 @@ In general, an Asynchronous Action (or TreeNode) is simply one that:
33
33
34
34
When your Tree ends up executing an Asynchronous action that returns running, that RUNNING state is usually propagated backbard and the entire Tree is itself in the RUNNING state.
35
35
36
-
In the example below, "ActionE" is asynchronous and the RUNNING; when
36
+
In the example below, "ActionE" is asynchronous and RUNNING; when
37
37
a node is RUNNING, usually its parent returns RUNNING too.
38
38
39
39

40
40
41
-
Let's consider a simple "SleepNode". A good template to get started is the StatefullAction
41
+
Let's consider a simple "SleepNode". A good template to get started is the StatefulAction
42
42
43
43
```c++
44
44
// Example os Asynchronous node that use StatefulActionNode as base class
@@ -97,7 +97,7 @@ class SleepNode : public BT::StatefulActionNode
97
97
98
98
In the code above:
99
99
100
-
1. When the SleedNode is ticked the first time, the `onStart()` method is executed.
100
+
1. When the SleepNode is ticked the first time, the `onStart()` method is executed.
101
101
This may return SUCCESS immediately if the sleep time is 0 or will return RUNNING otherwise.
102
102
2. We should continue ticking the tree in a loop. This will invoke the method
103
103
`onRunning()` that may return RUNNING again or, eventually, SUCCESS.
@@ -142,19 +142,19 @@ class BadSleepNode : public BT::ActionNodeBase
142
142
## The problem with multi-threading
143
143
144
144
In the early days of this library (version 1.x), spawning a new thread
145
-
looked as a good solution to build asynchronous Actions.
145
+
looked like a good solution to build asynchronous Actions.
146
146
147
147
That was a bad idea, for multiple reasons:
148
148
149
149
- Accessing the blackboard in a thread-safe way is harder (more about this later).
150
150
- You probably don't need to.
151
151
- People think that this will magically make the Action "asynchronous", but they forget that it is still **their responsibility** to stop that thread "somehow" when the `halt()`method is invoked.
152
152
153
-
For this reason, user a usually discouraged from using `BT::AsyncActionNode` as a
153
+
For this reason, users are usually discouraged from using `BT::AsyncActionNode` as a
154
154
base class. Let's have a look again at the SleepNode.
155
155
156
156
```c++
157
-
// This will spawn its own thread. But it still have problems when halted
157
+
// This will spawn its own thread. But it still has problems when halted
158
158
classBadSleepNode : publicBT::AsyncActionNode
159
159
{
160
160
public:
@@ -169,8 +169,8 @@ class BadSleepNode : public BT::AsyncActionNode
169
169
170
170
NodeStatus tick() override
171
171
{
172
-
// This code run in its own thread, therefore the Tree is still running.
173
-
// Think looks good but the thread can't be aborted
172
+
// This code runs in its own thread, therefore the Tree is still running.
173
+
// This seems good but the thread still can't be aborted
0 commit comments