@@ -46,7 +46,7 @@ a node is RUNNING, usually its parent returns RUNNING too.
4646Let's consider a simple "SleepNode". A good template to get started is the StatefulAction
4747
4848``` c++
49- // Example os Asynchronous node that use StatefulActionNode as base class
49+ // Example of Asynchronous node that use StatefulActionNode as base class
5050class SleepNode : public BT :: StatefulActionNode
5151{
5252 public:
@@ -188,7 +188,7 @@ class BadSleepNode : public BT::AsyncActionNode
188188};
189189```
190190
191- A " correct" (but over-engineered) version of it would be:
191+ A correct version would be:
192192
193193```c++
194194// I will create my own thread here, for no good reason
@@ -222,8 +222,8 @@ class ThreadedSleepNode : public BT::AsyncActionNode
222222 return NodeStatus::SUCCESS;
223223 }
224224
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.
227227};
228228```
229229
@@ -276,9 +276,9 @@ class ActionClientNode : public BT::StatefulActionNode
276276 NodeStatus onRunning() override
277277 {
278278 // more psuedo-code
279- auto request_state = getCurrentStateFromServer();
279+ auto current_state = getCurrentStateFromServer();
280280
281- if( request_state == DONE )
281+ if( current_state == DONE )
282282 {
283283 // retrieve the result
284284 auto result = getResult();
@@ -290,13 +290,13 @@ class ActionClientNode : public BT::StatefulActionNode
290290 return NodeStatus::FAILURE;
291291 }
292292 }
293- else if( request_state == ABORTED ) {
293+ else if( current_state == ABORTED ) {
294294 // fail if the action was aborted by some other client
295295 // or by the server itself
296296 return NodeStatus::FAILURE;
297297 }
298298 else {
299- // probably (request_state == EXECUTING) ?
299+ // probably (current_state == EXECUTING) ?
300300 return NodeStatus::RUNNING;
301301 }
302302 }
0 commit comments