gtest_subtree.cpp
Go to the documentation of this file.
1 #include <gtest/gtest.h>
3 #include "../sample_nodes/dummy_nodes.h"
4 #include "../sample_nodes/movebase_node.h"
5 #include "test_helper.hpp"
6 
7 using namespace BT;
8 
9 TEST(SubTree, SiblingPorts_Issue_72)
10 {
11  static const char* xml_text = R"(
12 
13 <root BTCPP_format="4" main_tree_to_execute="MainTree" >
14 
15  <BehaviorTree ID="MainTree">
16  <Sequence>
17  <Script code = " myParam = 'hello' " />
18  <SubTree ID="mySubtree" param="{myParam}" />
19  <Script code = " myParam = 'world' " />
20  <SubTree ID="mySubtree" param="{myParam}" />
21  </Sequence>
22  </BehaviorTree>
23 
24  <BehaviorTree ID="mySubtree">
25  <SaySomething message="{param}" />
26  </BehaviorTree>
27 </root> )";
28 
29  BehaviorTreeFactory factory;
30  factory.registerNodeType<DummyNodes::SaySomething>("SaySomething");
31 
32  Tree tree = factory.createTreeFromText(xml_text);
33 
34  for(auto& subtree : tree.subtrees)
35  {
36  subtree->blackboard->debugMessage();
37  std::cout << "-----" << std::endl;
38  }
39 
40  auto status = tree.tickWhileRunning();
41  ASSERT_EQ(status, NodeStatus::SUCCESS);
42  ASSERT_EQ(tree.subtrees.size(), 3);
43 }
44 
46 {
47 public:
48  CopyPorts(const std::string& name, const BT::NodeConfig& config)
49  : BT::SyncActionNode(name, config)
50  {}
51 
52  BT::NodeStatus tick() override
53  {
54  auto msg = getInput<std::string>("in");
55  if(!msg)
56  {
57  throw BT::RuntimeError("missing required input [message]: ", msg.error());
58  }
59  setOutput("out", msg.value());
61  }
62 
64  {
65  return { BT::InputPort<std::string>("in"), BT::OutputPort<std::string>("out") };
66  }
67 };
68 
69 TEST(SubTree, GoodRemapping)
70 {
71  static const char* xml_text = R"(
72 
73 <root BTCPP_format="4" main_tree_to_execute="MainTree">
74 
75  <BehaviorTree ID="MainTree">
76  <Sequence>
77  <Script code = " thoughts = 'hello' " />
78  <SubTree ID="CopySubtree" in_arg="{thoughts}" out_arg="{greetings}"/>
79  <SaySomething message="{greetings}" />
80  </Sequence>
81  </BehaviorTree>
82 
83  <BehaviorTree ID="CopySubtree">
84  <CopyPorts in="{in_arg}" out="{out_arg}"/>
85  </BehaviorTree>
86 </root> )";
87 
88  BehaviorTreeFactory factory;
89  factory.registerNodeType<DummyNodes::SaySomething>("SaySomething");
90  factory.registerNodeType<CopyPorts>("CopyPorts");
91 
92  Tree tree = factory.createTreeFromText(xml_text);
93 
94  auto status = tree.tickWhileRunning();
95  ASSERT_EQ(status, NodeStatus::SUCCESS);
96 }
97 
98 TEST(SubTree, BadRemapping)
99 {
100  BehaviorTreeFactory factory;
101  factory.registerNodeType<DummyNodes::SaySomething>("SaySomething");
102  factory.registerNodeType<CopyPorts>("CopyPorts");
103 
104  static const char* xml_text_bad_in = R"(
105 <root BTCPP_format="4" >
106 
107  <BehaviorTree ID="MainTree">
108  <Sequence>
109  <Script code = " thoughts='hello' " />
110  <SubTree ID="CopySubtree" out_arg="{greetings}"/>
111  <SaySomething message="{greetings}" />
112  </Sequence>
113  </BehaviorTree>
114 
115  <BehaviorTree ID="CopySubtree">
116  <CopyPorts in="{in_arg}" out="{out_arg}"/>
117  </BehaviorTree>
118 </root> )";
119 
120  factory.registerBehaviorTreeFromText(xml_text_bad_in);
121  Tree tree_bad_in = factory.createTree("MainTree");
122  EXPECT_ANY_THROW(tree_bad_in.tickWhileRunning());
123 
124  static const char* xml_text_bad_out = R"(
125 <root BTCPP_format="4" >
126 
127  <BehaviorTree ID="MainTree">
128  <Sequence>
129  <Script code = " thoughts='hello' " />
130  <SubTree ID="CopySubtree" in_arg="{thoughts}"/>
131  <SaySomething message="{greetings}" />
132  </Sequence>
133  </BehaviorTree>
134 
135  <BehaviorTree ID="CopySubtree">
136  <CopyPorts in="{in_arg}" out="{out_arg}"/>
137  </BehaviorTree>
138 </root> )";
139 
140  factory.registerBehaviorTreeFromText(xml_text_bad_out);
141  Tree tree_bad_out = factory.createTree("MainTree");
142  EXPECT_ANY_THROW(tree_bad_out.tickWhileRunning());
143 }
144 
145 TEST(SubTree, SubtreePlusA)
146 {
147  static const char* xml_text = R"(
148 
149 <root BTCPP_format="4" >
150 
151  <BehaviorTree ID="MainTree">
152  <Sequence>
153  <Script code = "myParam = 'Hello' " />
154  <SubTree ID="mySubtree" param="{myParam}" />
155  <SubTree ID="mySubtree" param="World" />
156  <Script code = "param = 'Auto remapped' " />
157  <SubTree ID="mySubtree" _autoremap="1" />
158  </Sequence>
159  </BehaviorTree>
160 
161  <BehaviorTree ID="mySubtree">
162  <SaySomething message="{param}" />
163  </BehaviorTree>
164 </root> )";
165 
166  BehaviorTreeFactory factory;
167  factory.registerNodeType<DummyNodes::SaySomething>("SaySomething");
168 
170  Tree tree = factory.createTree("MainTree");
171 
172  auto status = tree.tickWhileRunning();
173  ASSERT_EQ(status, NodeStatus::SUCCESS);
174 }
175 
176 TEST(SubTree, SubtreePlusB)
177 {
178  static const char* xml_text = R"(
179 
180 <root BTCPP_format="4" >
181 
182  <BehaviorTree ID="MainTree">
183  <Sequence>
184  <Script code = "myParam = 'Hello World'; param3='Auto remapped' " />
185  <SubTree ID="mySubtree" _autoremap="1" param1="{myParam}" param2="Straight Talking" />
186  </Sequence>
187  </BehaviorTree>
188 
189  <BehaviorTree ID="mySubtree">
190  <Sequence>
191  <SaySomething message="{param1}" />
192  <SaySomething message="{param2}" />
193  <SaySomething message="{param3}" />
194  </Sequence>
195  </BehaviorTree>
196 </root> )";
197 
198  BehaviorTreeFactory factory;
199  factory.registerNodeType<DummyNodes::SaySomething>("SaySomething");
200 
202  Tree tree = factory.createTree("MainTree");
203 
204  auto status = tree.tickWhileRunning();
205  ASSERT_EQ(status, NodeStatus::SUCCESS);
206 }
207 
209 {
210 public:
211  ReadInConstructor(const std::string& name, const BT::NodeConfig& config)
212  : BT::SyncActionNode(name, config)
213  {
214  auto msg = getInput<std::string>("message");
215  if(!msg)
216  {
217  throw BT::RuntimeError("missing required input [message]: ", msg.error());
218  }
219  }
220 
221  BT::NodeStatus tick() override
222  {
224  }
226  {
227  return { BT::InputPort<std::string>("message") };
228  }
229 };
230 
231 TEST(SubTree, SubtreePlusD)
232 {
233  BT::NodeConfig config;
235  static const char* xml_text = R"(
236 
237 <root BTCPP_format="4" >
238 
239  <BehaviorTree ID="MainTree">
240  <Sequence>
241  <SubTree ID="mySubtree" _autoremap="1"/>
242  </Sequence>
243  </BehaviorTree>
244  <BehaviorTree ID="mySubtree">
245  <ReadInConstructor message="{message}" />
246  </BehaviorTree>
247 </root> )";
248 
249  BT::BehaviorTreeFactory factory;
250  factory.registerNodeType<ReadInConstructor>("ReadInConstructor");
251  config.blackboard->set("message", "hello");
252 
254  Tree tree = factory.createTree("MainTree", config.blackboard);
255 
256  auto status = tree.tickWhileRunning();
257  ASSERT_EQ(status, BT::NodeStatus::SUCCESS);
258 }
259 
260 // TODO: only explicit remapping work, autoremapping fails
261 TEST(SubTree, ScriptRemap)
262 {
263  static const char* xml_text = R"(
264 
265 <root BTCPP_format="4" >
266 
267  <BehaviorTree ID="MainTree">
268  <Sequence>
269  <Script code = "value:=0" />
270  <SubTree ID="mySubtree" value="{value}" />
271  </Sequence>
272  </BehaviorTree>
273 
274  <BehaviorTree ID="mySubtree">
275  <Script code = "value:=1" />
276  </BehaviorTree>
277 </root> )";
278 
279  BT::BehaviorTreeFactory factory;
281 
282  Tree tree = factory.createTree("MainTree");
283  tree.tickOnce();
284 
285  ASSERT_EQ(tree.subtrees[1]->blackboard->get<int>("value"), 1);
286  ASSERT_EQ(tree.subtrees[0]->blackboard->get<int>("value"), 1);
287 }
288 
290 {
291 public:
292  // Any TreeNode with ports must have a constructor with this signature
293  ModifyPose(const std::string& name, const BT::NodeConfig& config)
294  : SyncActionNode(name, config)
295  {}
296 
298  {
299  return { BT::BidirectionalPort<Pose2D>("pose") };
300  }
301 
302  BT::NodeStatus tick() override
303  {
304  Pose2D pose;
305  getInput("pose", pose);
306  pose.theta *= 2;
307  setOutput("pose", pose);
308  return NodeStatus::SUCCESS;
309  }
310 };
311 
312 TEST(SubTree, StringConversions_Issue530)
313 {
314  const char* xml_text = R"(
315 <root BTCPP_format="4" >
316  <BehaviorTree ID="MainTree">
317  <Sequence>
318  <Script code=" pose:='1;2;3' "/>
319  <ModifyPose pose="{pose}"/>
320  <Script code=" pose:='1;2;3' "/>
321  </Sequence>
322  </BehaviorTree>
323 </root>
324 )";
325 
326  BT::BehaviorTreeFactory factory;
327  factory.registerNodeType<ModifyPose>("ModifyPose");
329  Tree tree = factory.createTree("MainTree");
330  tree.tickOnce();
331 }
332 
334 {
335 public:
336  NaughtyNav2Node(const std::string& name, const BT::NodeConfiguration& config)
337  : BT::SyncActionNode(name, config)
338  {
339  std::cout << "CTOR:" << config.blackboard->get<std::string>("ros_node") << std::endl;
340  }
341 
342  BT::NodeStatus tick() override
343  {
344  std::cout << "tick:" << config().blackboard->get<std::string>("ros_node")
345  << std::endl;
347  }
349  {
350  return {};
351  }
352 };
353 
354 TEST(SubTree, SubtreeNav2_Issue563)
355 {
356  static const char* xml_text = R"(
357 <root BTCPP_format="4" >
358 
359  <BehaviorTree ID="Tree1">
360  <Sequence>
361  <SetBlackboard output_key="the_message" value="hello world"/>
362  <SubTree ID="Tree2" _autoremap="true"/>
363  <SaySomething message="{reply}" />
364  </Sequence>
365  </BehaviorTree>
366 
367  <BehaviorTree ID="Tree2">
368  <SubTree ID="Tree3" _autoremap="true"/>
369  </BehaviorTree>
370 
371  <BehaviorTree ID="Tree3">
372  <SubTree ID="Talker" _autoremap="true"/>
373  </BehaviorTree>
374 
375  <BehaviorTree ID="Talker">
376  <Sequence>
377  <SaySomething message="{the_message}" />
378  <Script code=" reply:='done' "/>
379  <NaughtyNav2Node/>
380  </Sequence>
381  </BehaviorTree>
382 
383 </root>)";
384 
385  BehaviorTreeFactory factory;
386  factory.registerNodeType<DummyNodes::SaySomething>("SaySomething");
387  factory.registerNodeType<NaughtyNav2Node>("NaughtyNav2Node");
388 
390 
391  auto blackboard = BT::Blackboard::create();
392  blackboard->set<std::string>("ros_node", "nav2_shouldnt_do_this");
393 
394  Tree tree = factory.createTree("Tree1", blackboard);
395 
396  auto ret = tree.tickOnce();
397  ASSERT_EQ(ret, NodeStatus::SUCCESS);
398 }
399 
400 TEST(SubTree, SubtreeNav2_Issue724)
401 {
402  static const char* xml_text = R"(
403 <root BTCPP_format="4" >
404 
405  <BehaviorTree ID="Tree1">
406  <Sequence>
407  <SubTree ID="Tree2" ros_node="{ros_node}"/>
408  </Sequence>
409  </BehaviorTree>
410 
411  <BehaviorTree ID="Tree2">
412  <SubTree ID="Tree3" ros_node="{ros_node}"/>
413  </BehaviorTree>
414 
415  <BehaviorTree ID="Tree3">
416  <SubTree ID="Talker" ros_node="{ros_node}"/>
417  </BehaviorTree>
418 
419  <BehaviorTree ID="Talker">
420  <Sequence>
421  <NaughtyNav2Node/>
422  </Sequence>
423  </BehaviorTree>
424 
425 </root>)";
426 
427  BehaviorTreeFactory factory;
428  factory.registerNodeType<NaughtyNav2Node>("NaughtyNav2Node");
429 
431 
432  auto blackboard = BT::Blackboard::create();
433  blackboard->set<std::string>("ros_node", "nav2_shouldnt_do_this");
434 
435  Tree tree = factory.createTree("Tree1", blackboard);
436 
437  auto ret = tree.tickOnce();
438  ASSERT_EQ(ret, NodeStatus::SUCCESS);
439 }
440 
441 TEST(SubTree, SubtreeIssue592)
442 {
443  static const char* xml_text = R"(
444 <root BTCPP_format="4" >
445 
446  <BehaviorTree ID="Outer_Tree">
447  <Sequence>
448  <Script code="variable := 'test'"/>
449  <Script code="var := 'test'"/>
450  <SubTree ID="Inner_Tree" _autoremap="false" variable="{var}" />
451  <SubTree ID="Inner_Tree" _autoremap="true"/>
452  </Sequence>
453  </BehaviorTree>
454 
455  <BehaviorTree ID="Inner_Tree">
456  <Sequence>
457  <TestA _skipIf="variable != 'test'"/>
458  </Sequence>
459  </BehaviorTree>
460 
461 </root>)";
462 
463  BehaviorTreeFactory factory;
464  std::array<int, 1> counters;
465  RegisterTestTick(factory, "Test", counters);
466 
468  Tree tree = factory.createTree("Outer_Tree");
469 
470  auto ret = tree.tickWhileRunning();
471  ASSERT_EQ(ret, NodeStatus::SUCCESS);
472  ASSERT_EQ(counters[0], 2);
473 }
474 
475 TEST(SubTree, Issue623_String_to_Pose2d)
476 {
477  // clang-format off
478 
479  static const char* xml_text = R"(
480 <root main_tree_to_execute="Test" BTCPP_format="4">
481 
482  <BehaviorTree ID="Test">
483  <ReactiveSequence name="MainSequence">
484  <SubTree name="Visit2" ID="Visit2" tl1="1;2;3"/>
485  </ReactiveSequence>
486  </BehaviorTree>
487 
488  <BehaviorTree ID="Visit2">
489  <Sequence name="Visit2MainSequence">
490  <Action name="MoveBase" ID="MoveBase" goal="{tl1}"/>
491  </Sequence>
492  </BehaviorTree>
493 </root>
494  )";
495 
496  // clang-format on
497 
498  BehaviorTreeFactory factory;
499  factory.registerNodeType<MoveBaseAction>("MoveBase");
500  auto tree = factory.createTreeFromText(xml_text);
501  tree.tickWhileRunning();
502 }
503 
505 {
506 public:
507  Assert(const std::string& name, const BT::NodeConfiguration& config)
508  : BT::SyncActionNode(name, config)
509  {}
510 
512  {
513  return { BT::InputPort<bool>("condition") };
514  }
515 
516 private:
517  virtual BT::NodeStatus tick() override
518  {
519  if(getInput<bool>("condition").value())
521  else
523  }
524 };
525 
526 TEST(SubTree, Issue653_SetBlackboard)
527 {
528  // clang-format off
529 
530  static const char* xml_text = R"(
531 <root main_tree_to_execute = "MainTree" BTCPP_format="4">
532  <BehaviorTree ID="MainTree">
533  <Sequence>
534  <SubTree ID="Init" test="{test}" />
535  <Assert condition="{test}" />
536  </Sequence>
537  </BehaviorTree>
538 
539  <BehaviorTree ID="Init">
540  <SetBlackboard output_key="test" value="true"/>
541  </BehaviorTree>
542 </root>
543  )";
544 
545  // clang-format on
546 
547  BehaviorTreeFactory factory;
548  factory.registerNodeType<Assert>("Assert");
549  auto tree = factory.createTreeFromText(xml_text);
550  tree.tickWhileRunning();
551 }
552 
553 TEST(SubTree, SubtreeModels)
554 {
555  // clang-format off
556 
557  static const char* xml_text = R"(
558 <root main_tree_to_execute = "MainTree" BTCPP_format="4">
559  <TreeNodesModel>
560  <SubTree ID="MySub">
561  <input_port name="in_value" default="42"/>
562  <input_port name="in_name"/>
563  <output_port name="out_result" default="{output}"/>
564  <output_port name="out_state"/>
565  </SubTree>
566  </TreeNodesModel>
567 
568  <BehaviorTree ID="MainTree">
569  <Sequence>
570  <Script code="my_name:= 'john' "/>
571  <SubTree ID="MySub" in_name="{my_name}" out_state="{my_state}"/>
572  <ScriptCondition code=" output==69 && my_state=='ACTIVE' " />
573  </Sequence>
574  </BehaviorTree>
575 
576  <BehaviorTree ID="MySub">
577  <Sequence>
578  <ScriptCondition code="in_name=='john' && in_value==42" />
579  <Script code="out_result:=69; out_state:='ACTIVE'" />
580  </Sequence>
581  </BehaviorTree>
582 </root>
583  )";
584 
585  // clang-format on
586 
587  BehaviorTreeFactory factory;
588  auto tree = factory.createTreeFromText(xml_text);
589  tree.tickWhileRunning();
590 }
591 
593 {
594 public:
595  PrintToConsole(const std::string& name, const BT::NodeConfiguration& config,
596  std::vector<std::string>* console)
597  : BT::SyncActionNode(name, config), console_(console)
598  {}
599 
601  {
602  return { BT::InputPort<std::string>("message") };
603  }
604 
605 private:
606  virtual BT::NodeStatus tick() override
607  {
608  if(auto res = getInput<std::string>("message"))
609  {
610  console_->push_back(res.value());
612  }
613  else
615  }
616  std::vector<std::string>* console_;
617 };
618 
619 TEST(SubTree, RemappingIssue696)
620 {
621  // clang-format off
622 
623  static const char* xml_text = R"(
624  <root BTCPP_format="4">
625  <BehaviorTree ID="Subtree1">\n"
626  <Sequence>
627  <PrintToConsole message="{msg1}"/>
628  <PrintToConsole message="{msg2}"/>
629  </Sequence>
630  </BehaviorTree>
631 
632  <BehaviorTree ID="Subtree2">
633  <Sequence>
634  <SubTree ID="Subtree1" msg1="foo1" _autoremap="true"/>
635  <SubTree ID="Subtree1" msg1="foo2" _autoremap="true"/>
636  </Sequence>
637  </BehaviorTree>
638 
639  <BehaviorTree ID="MainTree">
640  <SubTree ID="Subtree2" msg2="bar"/>
641  </BehaviorTree>
642  </root>
643  )";
644 
645  // clang-format on
646 
647  BehaviorTreeFactory factory;
648  std::vector<std::string> console;
649  factory.registerNodeType<PrintToConsole>("PrintToConsole", &console);
650 
652  auto tree = factory.createTree("MainTree");
653  tree.tickWhileRunning();
654 
655  ASSERT_EQ(console.size(), 4);
656  ASSERT_EQ(console[0], "foo1");
657  ASSERT_EQ(console[1], "bar");
658  ASSERT_EQ(console[2], "foo2");
659  ASSERT_EQ(console[3], "bar");
660 }
661 
662 TEST(SubTree, PrivateAutoRemapping)
663 {
664  // clang-format off
665 
666  static const char* xml_text = R"(
667  <root BTCPP_format="4">
668  <BehaviorTree ID="Subtree">\n"
669  <Sequence>
670  <SetBlackboard output_key="public_value" value="hello"/>
671  <SetBlackboard output_key="_private_value" value="world"/>
672  </Sequence>
673  </BehaviorTree>
674 
675  <BehaviorTree ID="MainTree">
676  <Sequence>
677  <SubTree ID="Subtree" _autoremap="true"/>
678  <PrintToConsole message="{public_value}"/>
679  <PrintToConsole message="{_private_value}"/>
680  </Sequence>
681  </BehaviorTree>
682  </root>
683  )";
684 
685  // clang-format on
686  BehaviorTreeFactory factory;
687  std::vector<std::string> console;
688  factory.registerNodeType<PrintToConsole>("PrintToConsole", &console);
689 
691  auto tree = factory.createTree("MainTree");
692  const auto res = tree.tickWhileRunning();
693 
694  // should fail because _private_value is not autoremapped
695  ASSERT_EQ(res, BT::NodeStatus::FAILURE);
696  ASSERT_EQ(console.size(), 1);
697  ASSERT_EQ(console[0], "hello");
698 }
699 
700 TEST(SubTree, SubtreeNameNotRegistered)
701 {
702  // clang-format off
703 
704  static const char* xml_text = R"(
705  <root BTCPP_format="4">
706  <BehaviorTree ID="PrintToConsole">\n"
707  <Sequence>
708  <PrintToConsole message="world"/>
709  </Sequence>
710  </BehaviorTree>
711 
712  <BehaviorTree ID="MainTree">
713  <Sequence>
714  <PrintToConsole message="hello"/>
715  <SubTree ID="PrintToConsole"/>
716  </Sequence>
717  </BehaviorTree>
718  </root>
719  )";
720 
721  // clang-format on
722  BehaviorTreeFactory factory;
723  std::vector<std::string> console;
724  factory.registerNodeType<PrintToConsole>("PrintToConsole", &console);
725 
726  ASSERT_ANY_THROW(auto tree = factory.createTreeFromText(xml_text));
727  ASSERT_ANY_THROW(factory.registerBehaviorTreeFromText(xml_text));
728 }
Assert::providedPorts
static BT::PortsList providedPorts()
Definition: gtest_subtree.cpp:511
BT
Definition: ex01_wrap_legacy.cpp:29
Pose2D
Definition: t18_waypoints.cpp:13
BT::BehaviorTreeFactory::createTree
Tree createTree(const std::string &tree_name, Blackboard::Ptr blackboard=Blackboard::create())
Definition: bt_factory.cpp:432
RegisterTestTick
void RegisterTestTick(BT::BehaviorTreeFactory &factory, const std::string &name_prefix, std::array< int, N > &tick_counters)
Definition: test_helper.hpp:15
Assert::Assert
Assert(const std::string &name, const BT::NodeConfiguration &config)
Definition: gtest_subtree.cpp:507
ReadInConstructor::tick
BT::NodeStatus tick() override
Method to be implemented by the user.
Definition: gtest_subtree.cpp:221
BT::Tree
Struct used to store a tree. If this object goes out of scope, the tree is destroyed.
Definition: bt_factory.h:91
BT::Tree::tickOnce
NodeStatus tickOnce()
by default, tickOnce() sends a single tick, BUT as long as there is at least one node of the tree inv...
Definition: bt_factory.cpp:605
bt_factory.h
ModifyPose
Definition: gtest_subtree.cpp:289
MoveBaseAction
Definition: movebase_node.h:54
ReadInConstructor::ReadInConstructor
ReadInConstructor(const std::string &name, const BT::NodeConfig &config)
Definition: gtest_subtree.cpp:211
PrintToConsole::tick
virtual BT::NodeStatus tick() override
Method to be implemented by the user.
Definition: gtest_subtree.cpp:606
TEST
TEST(SubTree, SiblingPorts_Issue_72)
Definition: gtest_subtree.cpp:9
test_helper.hpp
ModifyPose::providedPorts
static BT::PortsList providedPorts()
Definition: gtest_subtree.cpp:297
BT::Tree::tickWhileRunning
NodeStatus tickWhileRunning(std::chrono::milliseconds sleep_time=std::chrono::milliseconds(10))
Definition: bt_factory.cpp:610
BT::NodeConfig::blackboard
Blackboard::Ptr blackboard
Definition: tree_node.h:79
BT::PortsList
std::unordered_map< std::string, PortInfo > PortsList
Definition: basic_types.h:585
Assert
Definition: gtest_subtree.cpp:504
BT::NodeStatus::FAILURE
@ FAILURE
BT::BehaviorTreeFactory::registerNodeType
void registerNodeType(const std::string &ID, const PortsList &ports, ExtraArgs... args)
Definition: bt_factory.h:326
ReadInConstructor::providedPorts
static BT::PortsList providedPorts()
Definition: gtest_subtree.cpp:225
BT::BehaviorTreeFactory::createTreeFromText
Tree createTreeFromText(const std::string &text, Blackboard::Ptr blackboard=Blackboard::create())
createTreeFromText will parse the XML directly from string. The XML needs to contain either a single ...
Definition: bt_factory.cpp:395
ModifyPose::tick
BT::NodeStatus tick() override
Method to be implemented by the user.
Definition: gtest_subtree.cpp:302
BT::RuntimeError
Definition: exceptions.h:58
NaughtyNav2Node::providedPorts
static BT::PortsList providedPorts()
Definition: gtest_subtree.cpp:348
NaughtyNav2Node
Definition: gtest_subtree.cpp:333
DummyNodes::SaySomething
Definition: dummy_nodes.h:47
ReadInConstructor
Definition: gtest_subtree.cpp:208
BT::BehaviorTreeFactory
The BehaviorTreeFactory is used to create instances of a TreeNode at run-time.
Definition: bt_factory.h:209
BT::Blackboard::create
static Blackboard::Ptr create(Blackboard::Ptr parent={})
Definition: blackboard.h:63
ModifyPose::ModifyPose
ModifyPose(const std::string &name, const BT::NodeConfig &config)
Definition: gtest_subtree.cpp:293
BT::NodeStatus::SUCCESS
@ SUCCESS
CopyPorts
Definition: gtest_subtree.cpp:45
BT::Tree::subtrees
std::vector< Subtree::Ptr > subtrees
Definition: bt_factory.h:104
CopyPorts::CopyPorts
CopyPorts(const std::string &name, const BT::NodeConfig &config)
Definition: gtest_subtree.cpp:48
Assert::tick
virtual BT::NodeStatus tick() override
Method to be implemented by the user.
Definition: gtest_subtree.cpp:517
NaughtyNav2Node::tick
BT::NodeStatus tick() override
Method to be implemented by the user.
Definition: gtest_subtree.cpp:342
NaughtyNav2Node::NaughtyNav2Node
NaughtyNav2Node(const std::string &name, const BT::NodeConfiguration &config)
Definition: gtest_subtree.cpp:336
BT::BehaviorTreeFactory::registerBehaviorTreeFromText
void registerBehaviorTreeFromText(const std::string &xml_text)
Definition: bt_factory.cpp:277
PrintToConsole::providedPorts
static BT::PortsList providedPorts()
Definition: gtest_subtree.cpp:600
CopyPorts::tick
BT::NodeStatus tick() override
Method to be implemented by the user.
Definition: gtest_subtree.cpp:52
CopyPorts::providedPorts
static BT::PortsList providedPorts()
Definition: gtest_subtree.cpp:63
BT::NodeConfig
Definition: tree_node.h:73
Pose2D::theta
double theta
Definition: t18_waypoints.cpp:15
PrintToConsole
Definition: gtest_subtree.cpp:592
xml_text
static const char * xml_text
Definition: ex01_wrap_legacy.cpp:52
BT::SyncActionNode
The SyncActionNode is an ActionNode that explicitly prevents the status RUNNING and doesn't require a...
Definition: action_node.h:52
PrintToConsole::PrintToConsole
PrintToConsole(const std::string &name, const BT::NodeConfiguration &config, std::vector< std::string > *console)
Definition: gtest_subtree.cpp:595
BT::NodeStatus
NodeStatus
Definition: basic_types.h:33
PrintToConsole::console_
std::vector< std::string > * console_
Definition: gtest_subtree.cpp:616


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Dec 13 2024 03:19:16