File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
include/behaviortree_cpp/decorators Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -67,12 +67,16 @@ int main()
67
67
PublisherZMQ publisher_zmq (tree.root_node );
68
68
#endif
69
69
70
- // Keep on ticking until you get either a SUCCESS or FAILURE state
71
- NodeStatus status = NodeStatus::RUNNING;
72
- while (status == NodeStatus::RUNNING)
70
+ // while (1)
73
71
{
74
- status = tree.root_node ->executeTick ();
75
- CrossDoor::SleepMS (1 ); // optional sleep to avoid "busy loops"
72
+ NodeStatus status = NodeStatus::RUNNING;
73
+ // Keep on ticking until you get either a SUCCESS or FAILURE state
74
+ while ( status == NodeStatus::RUNNING)
75
+ {
76
+ status = tree.root_node ->executeTick ();
77
+ CrossDoor::SleepMS (1 ); // optional sleep to avoid "busy loops"
78
+ }
79
+ CrossDoor::SleepMS (2000 );
76
80
}
77
81
return 0 ;
78
82
}
Original file line number Diff line number Diff line change @@ -24,6 +24,12 @@ class DecoratorSubtreeNode : public DecoratorNode
24
24
}
25
25
auto status = child_node_->executeTick ();
26
26
setStatus (status);
27
+
28
+ // reset child if completed
29
+ if ( status == NodeStatus::SUCCESS || status == NodeStatus::FAILURE)
30
+ {
31
+ child_node_->setStatus (NodeStatus::IDLE);
32
+ }
27
33
return status;
28
34
}
29
35
};
You can’t perform that action at this time.
0 commit comments