Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 22c6350

Browse files
committed
fix issue BehaviorTree#47
1 parent 77d2aa7 commit 22c6350

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

include/behaviortree_cpp/decorators/blackboard_precondition.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,18 @@ NodeStatus BlackboardPreconditionNode<T>::tick()
7070
bool same = ( getParam("expected", expected_value) &&
7171
blackboard()->get(key, current_value) &&
7272
current_value == expected_value ) ;
73+
if(same)
74+
{
75+
return child_node_->executeTick();
76+
}
77+
else{
78+
if( child()->status() == NodeStatus::RUNNING)
79+
{
80+
haltChild();
81+
}
82+
return NodeStatus::FAILURE;
83+
}
7384

74-
return same ? child_node_->executeTick() :
75-
NodeStatus::FAILURE;
7685
}
7786

7887
}

0 commit comments

Comments
 (0)