13 #include <gtest/gtest.h> 30 : root(
"root_parallel", 4)
31 , action_1(
"action_1")
32 , condition_1(
"condition_1")
33 , action_2(
"action_2")
34 , condition_2(
"condition_2")
64 , parallel_1(
"par1", 3)
65 , parallel_2(
"par2", 1)
66 , action_1(
"action_1")
67 , condition_1(
"condition_1")
68 , action_2(
"action_2")
69 , condition_2(
"condition_2")
70 , action_3(
"action_3")
71 , condition_3(
"condition_3")
102 ASSERT_EQ(NodeStatus::RUNNING, state);
110 std::this_thread::sleep_for(std::chrono::milliseconds(500));
117 ASSERT_EQ(NodeStatus::SUCCESS, state);
129 ASSERT_EQ(NodeStatus::SUCCESS, state);
137 ASSERT_EQ(NodeStatus::IDLE, condition_3.status());
140 ASSERT_EQ(NodeStatus::IDLE, action_3.status());
141 ASSERT_EQ(NodeStatus::RUNNING, parallel_1.status());
142 ASSERT_EQ(NodeStatus::IDLE, parallel_2.status());
143 ASSERT_EQ(NodeStatus::RUNNING, state);
148 condition_3.setBoolean(
false);
153 ASSERT_EQ(NodeStatus::IDLE, condition_3.status());
156 ASSERT_EQ(NodeStatus::RUNNING, action_3.status());
157 ASSERT_EQ(NodeStatus::RUNNING, parallel_1.status());
158 ASSERT_EQ(NodeStatus::RUNNING, parallel_2.status());
159 ASSERT_EQ(NodeStatus::RUNNING, state);
165 action_3.setTime(10);
167 condition_3.setBoolean(
false);
169 std::this_thread::sleep_for(std::chrono::milliseconds(500));
173 ASSERT_EQ(NodeStatus::IDLE, condition_3.status());
174 ASSERT_EQ(NodeStatus::SUCCESS,
176 ASSERT_EQ(NodeStatus::RUNNING,
177 parallel_1.status());
182 ASSERT_EQ(NodeStatus::IDLE, parallel_1.status());
184 ASSERT_EQ(NodeStatus::RUNNING, action_3.status());
185 ASSERT_EQ(NodeStatus::RUNNING, parallel_2.status());
186 ASSERT_EQ(NodeStatus::RUNNING, state);
189 std::this_thread::sleep_for(std::chrono::milliseconds(1500));
192 ASSERT_EQ(NodeStatus::IDLE, parallel_2.status());
194 ASSERT_EQ(NodeStatus::IDLE, parallel_1.status());
195 ASSERT_EQ(NodeStatus::IDLE, action_3.status());
196 ASSERT_EQ(NodeStatus::IDLE, parallel_2.status());
197 ASSERT_EQ(NodeStatus::SUCCESS, state);
BT::ParallelNode parallel_2
BT::ConditionTestNode condition_2
BT::AsyncActionTest action_1
void haltAllActions(TreeNode *root_node)
BT::AsyncActionTest action_2
BT::AsyncActionTest action_3
void setThresholdM(unsigned int threshold_M)
BT::ParallelNode parallel_1
void addChild(TreeNode *child)
BT::AsyncActionTest action_1
NodeStatus status() const
TEST_F(SimpleParallelTest, ConditionsTrue)
virtual BT::NodeStatus executeTick()
The method that will be executed to invoke tick(); and setStatus();.
BT::ConditionTestNode condition_2
BT::ConditionTestNode condition_1
BT::ConditionTestNode condition_1
BT::AsyncActionTest action_2
BT::ConditionTestNode condition_3