Skip to content

Commit f16a4d2

Browse files
committed
fix issue #330
1 parent 4b21907 commit f16a4d2

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

include/behaviortree_cpp_v3/decorators/blackboard_precondition.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define DECORATOR_BLACKBOARD_PRECONDITION_NODE_H
1515

1616
#include "behaviortree_cpp_v3/decorator_node.h"
17+
#include <type_traits>
1718

1819
namespace BT
1920
{
@@ -71,10 +72,17 @@ NodeStatus BlackboardPreconditionNode<T>::tick()
7172
setStatus(NodeStatus::RUNNING);
7273

7374
if( getInput("value_A", value_A) &&
74-
getInput("value_B", value_B) &&
75-
value_B == value_A )
75+
getInput("value_B", value_B) )
7676
{
77-
return child_node_->executeTick();
77+
bool is_equal = (value_B == value_A);
78+
if ( std::is_same<double, T>::value || std::is_same<float, T>::value )
79+
{
80+
is_equal = std::abs(value_B - value_A) <= std::numeric_limits<float>::epsilon();
81+
}
82+
if(is_equal)
83+
{
84+
return child_node_->executeTick();
85+
}
7886
}
7987

8088
if( child()->status() == NodeStatus::RUNNING )

0 commit comments

Comments
 (0)