Skip to content

Commit 43d59c3

Browse files
committed
add reset by default in base classes (fix #694)
1 parent 79cdc90 commit 43d59c3

File tree

5 files changed

+11
-2
lines changed

5 files changed

+11
-2
lines changed

include/behaviortree_cpp/action_node.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ class SyncActionNode : public ActionNodeBase
6060

6161
/// You don't need to override this
6262
virtual void halt() override final
63-
{}
63+
{
64+
resetStatus();
65+
}
6466
};
6567

6668
/**

include/behaviortree_cpp/condition_node.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ class ConditionNode : public LeafNode
2727

2828
//Do nothing
2929
virtual void halt() override final
30-
{}
30+
{
31+
resetStatus();
32+
}
3133

3234
virtual NodeType type() const override final
3335
{

src/action_node.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ void CoroActionNode::tickImpl()
129129
void CoroActionNode::halt()
130130
{
131131
destroyCoroutine();
132+
resetStatus(); // might be redundant
132133
}
133134

134135
void CoroActionNode::destroyCoroutine()
@@ -183,6 +184,7 @@ void StatefulActionNode::halt()
183184
{
184185
onHalted();
185186
}
187+
resetStatus(); // might be redundant
186188
}
187189

188190
NodeStatus BT::ThreadedAction::executeTick()
@@ -238,4 +240,5 @@ void ThreadedAction::halt()
238240
thread_handle_.wait();
239241
}
240242
thread_handle_ = {};
243+
resetStatus(); // might be redundant
241244
}

src/control_node.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ size_t ControlNode::childrenCount() const
3232
void ControlNode::halt()
3333
{
3434
resetChildren();
35+
resetStatus(); // might be redundant
3536
}
3637

3738
void ControlNode::resetChildren()

src/decorator_node.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ void DecoratorNode::setChild(TreeNode* child)
3232
void DecoratorNode::halt()
3333
{
3434
resetChild();
35+
resetStatus(); // might be redundant
3536
}
3637

3738
const TreeNode* DecoratorNode::child() const

0 commit comments

Comments
 (0)