00001 #ifndef ACTIONTEST_H 00002 #define ACTIONTEST_H 00003 00004 #include "behaviortree_cpp/action_node.h" 00005 00006 namespace BT 00007 { 00008 class SyncActionTest : public SyncActionNode 00009 { 00010 public: 00011 SyncActionTest(const std::string& name); 00012 00013 BT::NodeStatus tick() override; 00014 00015 void setBoolean(bool boolean_value); 00016 00017 int tickCount() const 00018 { 00019 return tick_count_; 00020 } 00021 00022 void resetTicks() 00023 { 00024 tick_count_ = 0; 00025 } 00026 00027 private: 00028 bool boolean_value_; 00029 int tick_count_; 00030 }; 00031 00032 class AsyncActionTest : public AsyncActionNode 00033 { 00034 public: 00035 AsyncActionTest(const std::string& name); 00036 00037 ~AsyncActionTest(); 00038 00039 // The method that is going to be executed by the thread 00040 BT::NodeStatus tick() override; 00041 00042 void setTime(int time); 00043 00044 // The method used to interrupt the execution of the node 00045 virtual void halt() override; 00046 00047 void setBoolean(bool boolean_value); 00048 00049 int tickCount() const 00050 { 00051 return tick_count_; 00052 } 00053 00054 void resetTicks() 00055 { 00056 tick_count_ = 0; 00057 } 00058 00059 private: 00060 int time_; 00061 bool boolean_value_; 00062 int tick_count_; 00063 std::atomic_bool stop_loop_; 00064 }; 00065 } 00066 00067 #endif