Skip to content

Commit 6dcd5ff

Browse files
typos (#376)
1 parent 8f53b36 commit 6dcd5ff

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/asynchronous_nodes.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ In general, an Asynchronous Action (or TreeNode) is simply one that:
3333

3434
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.
3535

36-
In the example below, "ActionE" is asynchronous and the RUNNING; when
36+
In the example below, "ActionE" is asynchronous and RUNNING; when
3737
a node is RUNNING, usually its parent returns RUNNING too.
3838

3939
![tree in running state](images/RunningTree.svg)
4040

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
4242

4343
```c++
4444
// Example os Asynchronous node that use StatefulActionNode as base class
@@ -97,7 +97,7 @@ class SleepNode : public BT::StatefulActionNode
9797
9898
In the code above:
9999
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.
101101
This may return SUCCESS immediately if the sleep time is 0 or will return RUNNING otherwise.
102102
2. We should continue ticking the tree in a loop. This will invoke the method
103103
`onRunning()` that may return RUNNING again or, eventually, SUCCESS.
@@ -142,19 +142,19 @@ class BadSleepNode : public BT::ActionNodeBase
142142
## The problem with multi-threading
143143

144144
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.
146146

147147
That was a bad idea, for multiple reasons:
148148

149149
- Accessing the blackboard in a thread-safe way is harder (more about this later).
150150
- You probably don't need to.
151151
- 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.
152152

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
154154
base class. Let's have a look again at the SleepNode.
155155

156156
```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
158158
class BadSleepNode : public BT::AsyncActionNode
159159
{
160160
public:
@@ -169,8 +169,8 @@ class BadSleepNode : public BT::AsyncActionNode
169169

170170
NodeStatus tick() override
171171
{
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
174174
int msec = 0;
175175
getInput("msec", msec);
176176
std::this_thread::sleep_for( std::chrono::milliseconds(msec) );
@@ -207,7 +207,7 @@ class ThreadedSleepNode : public BT::AsyncActionNode
207207
getInput("msec", msec);
208208
209209
using namespace std::chrono;
210-
auto deadline = system_clock::now() + milliseconds(msec);
210+
const auto deadline = system_clock::now() + milliseconds(msec);
211211
212212
// periodically check isHaltRequested()
213213
// and sleep for a small amount of time only (1 millisecond)

0 commit comments

Comments
 (0)