@@ -46,7 +46,7 @@ a node is RUNNING, usually its parent returns RUNNING too.
46
46
Let's consider a simple "SleepNode". A good template to get started is the StatefulAction
47
47
48
48
``` c++
49
- // Example os Asynchronous node that use StatefulActionNode as base class
49
+ // Example of Asynchronous node that use StatefulActionNode as base class
50
50
class SleepNode : public BT :: StatefulActionNode
51
51
{
52
52
public:
@@ -188,7 +188,7 @@ class BadSleepNode : public BT::AsyncActionNode
188
188
};
189
189
```
190
190
191
- A " correct" (but over-engineered) version of it would be:
191
+ A correct version would be:
192
192
193
193
```c++
194
194
// I will create my own thread here, for no good reason
@@ -222,8 +222,8 @@ class ThreadedSleepNode : public BT::AsyncActionNode
222
222
return NodeStatus::SUCCESS;
223
223
}
224
224
225
- // The halt() method can not kill the spawned thread :()
226
- // void halt();
225
+ // The halt() method will set isHaltRequested() to true
226
+ // and stop the while loop in the spawned thread.
227
227
};
228
228
```
229
229
@@ -276,9 +276,9 @@ class ActionClientNode : public BT::StatefulActionNode
276
276
NodeStatus onRunning() override
277
277
{
278
278
// more psuedo-code
279
- auto request_state = getCurrentStateFromServer();
279
+ auto current_state = getCurrentStateFromServer();
280
280
281
- if( request_state == DONE )
281
+ if( current_state == DONE )
282
282
{
283
283
// retrieve the result
284
284
auto result = getResult();
@@ -290,13 +290,13 @@ class ActionClientNode : public BT::StatefulActionNode
290
290
return NodeStatus::FAILURE;
291
291
}
292
292
}
293
- else if( request_state == ABORTED ) {
293
+ else if( current_state == ABORTED ) {
294
294
// fail if the action was aborted by some other client
295
295
// or by the server itself
296
296
return NodeStatus::FAILURE;
297
297
}
298
298
else {
299
- // probably (request_state == EXECUTING) ?
299
+ // probably (current_state == EXECUTING) ?
300
300
return NodeStatus::RUNNING;
301
301
}
302
302
}
0 commit comments