File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
include/behaviortree_cpp_v3/decorators Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 14
14
#define DECORATOR_BLACKBOARD_PRECONDITION_NODE_H
15
15
16
16
#include " behaviortree_cpp_v3/decorator_node.h"
17
+ #include < type_traits>
17
18
18
19
namespace BT
19
20
{
@@ -71,10 +72,17 @@ NodeStatus BlackboardPreconditionNode<T>::tick()
71
72
setStatus (NodeStatus::RUNNING);
72
73
73
74
if ( getInput (" value_A" , value_A) &&
74
- getInput (" value_B" , value_B) &&
75
- value_B == value_A )
75
+ getInput (" value_B" , value_B) )
76
76
{
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
+ }
78
86
}
79
87
80
88
if ( child ()->status () == NodeStatus::RUNNING )
You can’t perform that action at this time.
0 commit comments