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()
6767 PublisherZMQ publisher_zmq (tree.root_node );
6868#endif
6969
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)
7371 {
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 );
7680 }
7781 return 0 ;
7882}
Original file line number Diff line number Diff line change @@ -24,6 +24,12 @@ class DecoratorSubtreeNode : public DecoratorNode
2424 }
2525 auto status = child_node_->executeTick ();
2626 setStatus (status);
27+
28+ // reset child if completed
29+ if ( status == NodeStatus::SUCCESS || status == NodeStatus::FAILURE)
30+ {
31+ child_node_->setStatus (NodeStatus::IDLE);
32+ }
2733 return status;
2834 }
2935};
You can’t perform that action at this time.
0 commit comments