test_helper.hpp
Go to the documentation of this file.
1 #ifndef TEST_HELPER_HPP
2 #define TEST_HELPER_HPP
3 
5 
6 inline BT::NodeStatus TestTick(int* tick_counter)
7 {
8  (*tick_counter)++;
10 }
11 
12 template <size_t N> inline
13  void RegisterTestTick(BT::BehaviorTreeFactory& factory, const std::string& name_prefix,
14  std::array<int, N>& tick_counters)
15 {
16  for(size_t i=0; i<tick_counters.size(); i++)
17  {
18  tick_counters[i] = false;
19  char str[100];
20  sprintf(str, "%s%c", name_prefix.c_str(), char('A'+i ) );
21  int* counter_ptr = &(tick_counters[i]);
22  factory.registerSimpleAction(str, std::bind(&TestTick, counter_ptr));
23  }
24 }
25 
26 
27 #endif // TEST_HELPER_HPP
TestTick
BT::NodeStatus TestTick(int *tick_counter)
Definition: test_helper.hpp:6
RegisterTestTick
void RegisterTestTick(BT::BehaviorTreeFactory &factory, const std::string &name_prefix, std::array< int, N > &tick_counters)
Definition: test_helper.hpp:13
bt_factory.h
BT::BehaviorTreeFactory
The BehaviorTreeFactory is used to create instances of a TreeNode at run-time.
Definition: bt_factory.h:251
BT::NodeStatus::SUCCESS
@ SUCCESS
BT::NodeStatus
NodeStatus
Definition: basic_types.h:35
BT::BehaviorTreeFactory::registerSimpleAction
void registerSimpleAction(const std::string &ID, const SimpleActionNode::TickFunctor &tick_functor, PortsList ports={})
registerSimpleAction help you register nodes of type SimpleActionNode.
Definition: bt_factory.cpp:117


behaviortree_cpp_v3
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Wed Jun 26 2024 02:51:19