bt_factory.h
Go to the documentation of this file.
1 /* Copyright (C) 2018 Michele Colledanchise - All Rights Reserved
2  * Copyright (C) 2018-2023 Davide Faconti - All Rights Reserved
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
6 * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
11 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 */
13 
14 #ifndef BT_FACTORY_H
15 #define BT_FACTORY_H
16 
17 #include <filesystem>
18 #include <functional>
19 #include <memory>
20 #include <unordered_map>
21 #include <set>
22 #include <vector>
23 
26 
27 namespace BT
28 {
30 using NodeBuilder =
31  std::function<std::unique_ptr<TreeNode>(const std::string&, const NodeConfig&)>;
32 
33 template <typename T, typename... Args>
34 inline NodeBuilder CreateBuilder(Args... args)
35 {
36  return [=](const std::string& name, const NodeConfig& config) {
37  return TreeNode::Instantiate<T, Args...>(name, config, args...);
38  };
39 }
40 
41 template <typename T>
42 inline TreeNodeManifest CreateManifest(const std::string& ID,
43  PortsList portlist = getProvidedPorts<T>())
44 {
46  {
47  return { getType<T>(), ID, portlist, T::metadata() };
48  }
49  return { getType<T>(), ID, portlist, {} };
50 }
51 
52 #ifdef BT_PLUGIN_EXPORT
53 
54 #if defined(_WIN32)
55 #define BTCPP_EXPORT extern "C" __declspec(dllexport)
56 #else
57 // Unix-like OSes
58 #define BTCPP_EXPORT extern "C" __attribute__((visibility("default")))
59 #endif
60 
61 #else
62 #define BTCPP_EXPORT static
63 #endif
64 /* Use this macro to automatically register one or more custom Nodes
65 * into a factory. For instance:
66 *
67 * BT_REGISTER_NODES(factory)
68 * {
69 * factory.registerNodeType<MoveBaseAction>("MoveBase");
70 * }
71 *
72 * IMPORTANT: this function MUST be declared in a cpp file, NOT a header file.
73 * You must add the definition [BT_PLUGIN_EXPORT] in CMakeLists.txt using:
74 *
75 * target_compile_definitions(my_plugin_target PRIVATE BT_PLUGIN_EXPORT )
76 
77 * See examples in sample_nodes directory.
78 */
79 
80 #define BT_REGISTER_NODES(factory) \
81  BTCPP_EXPORT void BT_RegisterNodesFromPlugin(BT::BehaviorTreeFactory& factory)
82 
83 constexpr const char* PLUGIN_SYMBOL = "BT_RegisterNodesFromPlugin";
84 
85 bool WildcardMatch(const std::string& str, StringView filter);
86 
91 class Tree
92 {
93 public:
94  // a tree can contain multiple subtree.
95  struct Subtree
96  {
97  using Ptr = std::shared_ptr<Subtree>;
98  std::vector<TreeNode::Ptr> nodes;
100  std::string instance_name;
101  std::string tree_ID;
102  };
103 
104  std::vector<Subtree::Ptr> subtrees;
105  std::unordered_map<std::string, TreeNodeManifest> manifests;
106 
107  Tree();
108 
109  Tree(const Tree&) = delete;
110  Tree& operator=(const Tree&) = delete;
111 
112  Tree(Tree&& other);
113  Tree& operator=(Tree&& other);
114 
115  void initialize();
116 
117  void haltTree();
118 
119  [[nodiscard]] TreeNode* rootNode() const;
120 
124  void sleep(std::chrono::system_clock::duration timeout);
125 
126  ~Tree();
127 
131 
138 
142  NodeStatus
143  tickWhileRunning(std::chrono::milliseconds sleep_time = std::chrono::milliseconds(10));
144 
145  [[nodiscard]] Blackboard::Ptr rootBlackboard();
146 
147  //Call the visitor for each node of the tree.
148  void applyVisitor(const std::function<void(const TreeNode*)>& visitor);
149 
150  //Call the visitor for each node of the tree.
151  void applyVisitor(const std::function<void(TreeNode*)>& visitor);
152 
153  [[nodiscard]] uint16_t getUID();
154 
160  template <typename NodeType = BT::TreeNode>
161  [[nodiscard]] std::vector<const TreeNode*>
162  getNodesByPath(StringView wildcard_filter) const
163  {
164  std::vector<const TreeNode*> nodes;
165  for(auto const& subtree : subtrees)
166  {
167  for(auto const& node : subtree->nodes)
168  {
169  if(auto node_recast = dynamic_cast<const NodeType*>(node.get()))
170  {
171  if(WildcardMatch(node->fullPath(), wildcard_filter))
172  {
173  nodes.push_back(node.get());
174  }
175  }
176  }
177  }
178  return nodes;
179  }
180 
181 private:
182  std::shared_ptr<WakeUpSignal> wake_up_;
183 
185  {
189  };
190 
191  NodeStatus tickRoot(TickOption opt, std::chrono::milliseconds sleep_time);
192 
193  uint16_t uid_counter_ = 0;
194 };
195 
196 class Parser;
197 
206 {
207 public:
210 
211  BehaviorTreeFactory(const BehaviorTreeFactory& other) = delete;
212  BehaviorTreeFactory& operator=(const BehaviorTreeFactory& other) = delete;
213 
214  BehaviorTreeFactory(BehaviorTreeFactory&& other) noexcept;
216 
218  bool unregisterBuilder(const std::string& ID);
219 
225  void registerBuilder(const TreeNodeManifest& manifest, const NodeBuilder& builder);
226 
227  template <typename T>
228  void registerBuilder(const std::string& ID, const NodeBuilder& builder)
229  {
230  auto manifest = CreateManifest<T>(ID);
231  registerBuilder(manifest, builder);
232  }
233 
242  void registerSimpleAction(const std::string& ID,
243  const SimpleActionNode::TickFunctor& tick_functor,
244  PortsList ports = {});
253  void registerSimpleCondition(const std::string& ID,
254  const SimpleConditionNode::TickFunctor& tick_functor,
255  PortsList ports = {});
264  void registerSimpleDecorator(const std::string& ID,
265  const SimpleDecoratorNode::TickFunctor& tick_functor,
266  PortsList ports = {});
267 
273  void registerFromPlugin(const std::string& file_path);
274 
280  void registerFromROSPlugins();
281 
292  void registerBehaviorTreeFromFile(const std::filesystem::path& filename);
293 
296  void registerBehaviorTreeFromText(const std::string& xml_text);
297 
300  [[nodiscard]] std::vector<std::string> registeredBehaviorTrees() const;
301 
306 
315  [[nodiscard]] std::unique_ptr<TreeNode> instantiateTreeNode(
316  const std::string& name, const std::string& ID, const NodeConfig& config) const;
317 
321  template <typename T, typename... ExtraArgs>
322  void registerNodeType(const std::string& ID, const PortsList& ports, ExtraArgs... args)
323  {
328  "[registerNode]: accepts only classed derived from either "
329  "ActionNodeBase, "
330  "DecoratorNode, ControlNode or ConditionNode");
331 
332  constexpr bool default_constructable =
334  constexpr bool param_constructable =
335  std::is_constructible<T, const std::string&, const NodeConfig&,
336  ExtraArgs...>::value;
337 
338  // clang-format off
339  static_assert(!std::is_abstract<T>::value,
340  "[registerNode]: Some methods are pure virtual. "
341  "Did you override the methods tick() and halt()?");
342 
343  static_assert(default_constructable || param_constructable,
344  "[registerNode]: the registered class must have at least one of these two constructors:\n"
345  " (const std::string&, const NodeConfig&) or (const std::string&)\n"
346  "Check also if the constructor is public!)");
347  // clang-format on
348 
349  registerBuilder(CreateManifest<T>(ID, ports), CreateBuilder<T>(args...));
350  }
351 
357  template <typename T, typename... ExtraArgs>
358  void registerNodeType(const std::string& ID, ExtraArgs... args)
359  {
360  if constexpr(std::is_abstract_v<T>)
361  {
362  // check first if the given class is abstract
363  static_assert(!std::is_abstract_v<T>, "The Node type can't be abstract. "
364  "Did you forget to implement an abstract "
365  "method in the derived class?");
366  }
367  else
368  {
369  constexpr bool param_constructable =
370  std::is_constructible<T, const std::string&, const NodeConfig&,
371  ExtraArgs...>::value;
372  constexpr bool has_static_ports_list = has_static_method_providedPorts<T>::value;
373 
374  // clang-format off
375  static_assert(!(param_constructable && !has_static_ports_list),
376  "[registerNode]: you MUST implement the static method:\n"
377  " PortsList providedPorts();\n");
378 
379  static_assert(!(has_static_ports_list && !param_constructable),
380  "[registerNode]: since you have a static method providedPorts(),\n"
381  "you MUST add a constructor with signature:\n"
382  "(const std::string&, const NodeConfig&)\n");
383  }
384  // clang-format on
385  registerNodeType<T>(ID, getProvidedPorts<T>(), args...);
386  }
387 
389  [[nodiscard]] const std::unordered_map<std::string, NodeBuilder>& builders() const;
390 
392  [[nodiscard]] const std::unordered_map<std::string, TreeNodeManifest>&
393  manifests() const;
394 
396  [[nodiscard]] const std::set<std::string>& builtinNodes() const;
397 
409  [[nodiscard]] Tree createTreeFromText(
410  const std::string& text, Blackboard::Ptr blackboard = Blackboard::create());
411 
423  [[nodiscard]] Tree
424  createTreeFromFile(const std::filesystem::path& file_path,
425  Blackboard::Ptr blackboard = Blackboard::create());
426 
427  [[nodiscard]] Tree createTree(const std::string& tree_name,
428  Blackboard::Ptr blackboard = Blackboard::create());
429 
432  void addMetadataToManifest(const std::string& node_id, const KeyValueVector& metadata);
433 
447  void registerScriptingEnum(StringView name, int value);
448 
457  template <typename EnumType>
459  {
460  constexpr auto entries = magic_enum::enum_entries<EnumType>();
461  for(const auto& it : entries)
462  {
463  registerScriptingEnum(it.second, static_cast<int>(it.first));
464  }
465  }
466 
467  void clearSubstitutionRules();
468 
469  using SubstitutionRule = std::variant<std::string, TestNodeConfig>;
470 
483 
491  void loadSubstitutionRuleFromJSON(const std::string& json_text);
492 
496  [[nodiscard]] const std::unordered_map<std::string, SubstitutionRule>&
497  substitutionRules() const;
498 
499 private:
500  struct PImpl;
501  std::unique_ptr<PImpl> _p;
502 };
503 
510 void BlackboardClone(const Blackboard& src, Blackboard& dst);
511 
519 std::vector<Blackboard::Ptr> BlackboardBackup(const BT::Tree& tree);
520 
528 void BlackboardRestore(const std::vector<Blackboard::Ptr>& backup, BT::Tree& tree);
529 
535 
540 void ImportTreeFromJSON(const nlohmann::json& json, BT::Tree& tree);
541 
542 } // namespace BT
543 
544 #endif // BT_FACTORY_H
BT
Definition: ex01_wrap_legacy.cpp:29
BT::BehaviorTreeFactory::builtinNodes
const std::set< std::string > & builtinNodes() const
List of builtin IDs.
Definition: bt_factory.cpp:390
BT::BlackboardRestore
void BlackboardRestore(const std::vector< Blackboard::Ptr > &backup, BT::Tree &tree)
BlackboardRestore uses Blackboard::cloneInto to restore all the blackboards of the tree.
Definition: bt_factory.cpp:679
BT::NodeType
NodeType
Enumerates the possible types of nodes.
Definition: basic_types.h:20
BT::Tree::ONCE_UNLESS_WOKEN_UP
@ ONCE_UNLESS_WOKEN_UP
Definition: bt_factory.h:187
BT::Tree::getUID
uint16_t getUID()
Definition: bt_factory.cpp:633
BT::BehaviorTreeFactory::registeredBehaviorTrees
std::vector< std::string > registeredBehaviorTrees() const
Definition: bt_factory.cpp:282
BT::BehaviorTreeFactory::createTree
Tree createTree(const std::string &tree_name, Blackboard::Ptr blackboard=Blackboard::create())
Definition: bt_factory.cpp:432
BT::CreateBuilder
NodeBuilder CreateBuilder(Args... args)
Definition: bt_factory.h:34
BT::BehaviorTreeFactory::unregisterBuilder
bool unregisterBuilder(const std::string &ID)
Remove a registered ID.
Definition: bt_factory.cpp:124
BT::BehaviorTreeFactory::registerBuilder
void registerBuilder(const std::string &ID, const NodeBuilder &builder)
Definition: bt_factory.h:228
BT::SimpleDecoratorNode::TickFunctor
std::function< NodeStatus(NodeStatus, TreeNode &)> TickFunctor
Definition: decorator_node.h:55
magic_enum.hpp
BT::Tree::operator=
Tree & operator=(const Tree &)=delete
BT::BehaviorTreeFactory::operator=
BehaviorTreeFactory & operator=(const BehaviorTreeFactory &other)=delete
BT::Tree::Subtree::nodes
std::vector< TreeNode::Ptr > nodes
Definition: bt_factory.h:98
BT::BehaviorTreeFactory::substitutionRules
const std::unordered_map< std::string, SubstitutionRule > & substitutionRules() const
substitutionRules return the current substitution rules.
Definition: bt_factory.cpp:529
BT::BehaviorTreeFactory::_p
std::unique_ptr< PImpl > _p
Definition: bt_factory.h:500
BT::BehaviorTreeFactory::BehaviorTreeFactory
BehaviorTreeFactory()
Definition: bt_factory.cpp:43
BT::StringView
std::string_view StringView
Definition: basic_types.h:59
BT::BehaviorTreeFactory::loadSubstitutionRuleFromJSON
void loadSubstitutionRuleFromJSON(const std::string &json_text)
loadSubstitutionRuleFromJSON will parse a JSON file to create a set of substitution rules....
Definition: bt_factory.cpp:480
BT::BehaviorTreeFactory::registerFromPlugin
void registerFromPlugin(const std::string &file_path)
registerFromPlugin load a shared library and execute the function BT_REGISTER_NODES (see macro).
Definition: bt_factory.cpp:192
BT::TreeNode
Abstract base class for Behavior Tree Nodes.
Definition: tree_node.h:118
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::manifests
std::unordered_map< std::string, TreeNodeManifest > manifests
Definition: bt_factory.h:105
BT::BehaviorTreeFactory::addMetadataToManifest
void addMetadataToManifest(const std::string &node_id, const KeyValueVector &metadata)
Definition: bt_factory.cpp:440
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:604
manifest
string manifest
BT::Tree::Subtree
Definition: bt_factory.h:95
basic_json
namespace for Niels Lohmann
Definition: json.hpp:3411
BT::PLUGIN_SYMBOL
constexpr const char * PLUGIN_SYMBOL
Definition: bt_factory.h:83
BT::BehaviorTreeFactory::clearRegisteredBehaviorTrees
void clearRegisteredBehaviorTrees()
Clear previously-registered behavior trees.
Definition: bt_factory.cpp:287
BT::Tree::Tree
Tree()
Definition: bt_factory.cpp:542
magic_enum::detail::value
constexpr E value(std::size_t i) noexcept
Definition: magic_enum.hpp:664
BT::BehaviorTreeFactory::clearSubstitutionRules
void clearSubstitutionRules()
Definition: bt_factory.cpp:470
BT::BehaviorTreeFactory::registerScriptingEnum
void registerScriptingEnum(StringView name, int value)
Add an Enum to the scripting language. For instance if you do:
Definition: bt_factory.cpp:451
BT::BehaviorTreeFactory::manifests
const std::unordered_map< std::string, TreeNodeManifest > & manifests() const
Manifests of all the registered TreeNodes.
Definition: bt_factory.cpp:385
BT::WildcardMatch
bool WildcardMatch(const std::string &str, StringView filter)
Definition: bt_factory.cpp:27
BT::Tree::Subtree::Ptr
std::shared_ptr< Subtree > Ptr
Definition: bt_factory.h:97
BT::BehaviorTreeFactory::instantiateTreeNode
std::unique_ptr< TreeNode > instantiateTreeNode(const std::string &name, const std::string &ID, const NodeConfig &config) const
instantiateTreeNode creates an instance of a previously registered TreeNode.
Definition: bt_factory.cpp:292
BT::Tree::tickWhileRunning
NodeStatus tickWhileRunning(std::chrono::milliseconds sleep_time=std::chrono::milliseconds(10))
Definition: bt_factory.cpp:609
BT::Blackboard::Ptr
std::shared_ptr< Blackboard > Ptr
Definition: blackboard.h:35
BT::Tree::getNodesByPath
std::vector< const TreeNode * > getNodesByPath(StringView wildcard_filter) const
Definition: bt_factory.h:162
BT::PortsList
std::unordered_map< std::string, PortInfo > PortsList
Definition: basic_types.h:585
BT::has_static_method_metadata
Definition: basic_types.h:601
BT::BehaviorTreeFactory::registerBuilder
void registerBuilder(const TreeNodeManifest &manifest, const NodeBuilder &builder)
Definition: bt_factory.cpp:140
json_text
static const char * json_text
Definition: gtest_substitution.cpp:6
BT::Tree::rootNode
TreeNode * rootNode() const
Definition: bt_factory.cpp:579
BT::Tree::tickRoot
NodeStatus tickRoot(TickOption opt, std::chrono::milliseconds sleep_time)
Definition: bt_factory.cpp:639
BT::Tree::~Tree
~Tree()
Definition: bt_factory.cpp:594
BT::BehaviorTreeFactory::registerNodeType
void registerNodeType(const std::string &ID, const PortsList &ports, ExtraArgs... args)
Definition: bt_factory.h:322
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
BT::BehaviorTreeFactory::~BehaviorTreeFactory
~BehaviorTreeFactory()
Definition: bt_factory.cpp:121
BT::Tree::initialize
void initialize()
Definition: bt_factory.cpp:550
BT::Tree::tickExactlyOnce
NodeStatus tickExactlyOnce()
Definition: bt_factory.cpp:599
BT::Tree::Subtree::blackboard
Blackboard::Ptr blackboard
Definition: bt_factory.h:99
BT::Tree::sleep
void sleep(std::chrono::system_clock::duration timeout)
Definition: bt_factory.cpp:589
BT::TreeNode::Instantiate
static std::unique_ptr< TreeNode > Instantiate(const std::string &name, const NodeConfig &config, ExtraArgs... args)
Definition: tree_node.h:347
BT::CreateManifest
TreeNodeManifest CreateManifest(const std::string &ID, PortsList portlist=getProvidedPorts< T >())
Definition: bt_factory.h:42
BT::BehaviorTreeFactory::PImpl
Definition: bt_factory.cpp:32
BT::Tree::wake_up_
std::shared_ptr< WakeUpSignal > wake_up_
Definition: bt_factory.h:182
magic_enum::detail::entries
constexpr auto entries(std::index_sequence< I... >) noexcept
Definition: magic_enum.hpp:839
BT::TreeNodeManifest
This information is used mostly by the XMLParser.
Definition: tree_node.h:35
BT::Tree::Subtree::instance_name
std::string instance_name
Definition: bt_factory.h:100
BT::ExportTreeToJSON
nlohmann::json ExportTreeToJSON(const BT::Tree &tree)
ExportTreeToJSON it calls ExportBlackboardToJSON for all the blackboards in the tree.
Definition: bt_factory.cpp:700
behavior_tree.h
BT::ImportTreeFromJSON
void ImportTreeFromJSON(const nlohmann::json &json, BT::Tree &tree)
ImportTreeFromJSON it calls ImportBlackboardFromJSON for all the blackboards in the tree.
Definition: bt_factory.cpp:716
BT::BehaviorTreeFactory::registerNodeType
void registerNodeType(const std::string &ID, ExtraArgs... args)
Definition: bt_factory.h:358
BT::Blackboard
The Blackboard is the mechanism used by BehaviorTrees to exchange typed data.
Definition: blackboard.h:32
BT::BehaviorTreeFactory
The BehaviorTreeFactory is used to create instances of a TreeNode at run-time.
Definition: bt_factory.h:205
BT::Tree::WHILE_RUNNING
@ WHILE_RUNNING
Definition: bt_factory.h:188
BT::KeyValueVector
std::vector< std::pair< std::string, std::string > > KeyValueVector
Definition: basic_types.h:66
BT::BehaviorTreeFactory::createTreeFromFile
Tree createTreeFromFile(const std::filesystem::path &file_path, Blackboard::Ptr blackboard=Blackboard::create())
createTreeFromFile will parse the XML from a given file. The XML needs to contain either a single <Be...
Definition: bt_factory.cpp:413
BT::Blackboard::create
static Blackboard::Ptr create(Blackboard::Ptr parent={})
Definition: blackboard.h:63
BT::has_static_method_providedPorts
Definition: basic_types.h:588
BT::BehaviorTreeFactory::builders
const std::unordered_map< std::string, NodeBuilder > & builders() const
All the builders. Made available mostly for debug purposes.
Definition: bt_factory.cpp:379
BT::Tree::subtrees
std::vector< Subtree::Ptr > subtrees
Definition: bt_factory.h:104
BT::Tree::haltTree
void haltTree()
Definition: bt_factory.cpp:562
BT::BehaviorTreeFactory::registerSimpleDecorator
void registerSimpleDecorator(const std::string &ID, const SimpleDecoratorNode::TickFunctor &tick_functor, PortsList ports={})
registerSimpleDecorator help you register nodes of type SimpleDecoratorNode.
Definition: bt_factory.cpp:179
BT::Tree::Subtree::tree_ID
std::string tree_ID
Definition: bt_factory.h:101
BT::BlackboardBackup
std::vector< Blackboard::Ptr > BlackboardBackup(const BT::Tree &tree)
BlackboardBackup uses Blackboard::cloneInto to backup all the blackboards of the tree.
Definition: bt_factory.cpp:688
BT::BehaviorTreeFactory::registerBehaviorTreeFromFile
void registerBehaviorTreeFromFile(const std::filesystem::path &filename)
registerBehaviorTreeFromFile. Load the definition of an entire behavior tree, but don't instantiate i...
Definition: bt_factory.cpp:271
BT::BehaviorTreeFactory::SubstitutionRule
std::variant< std::string, TestNodeConfig > SubstitutionRule
Definition: bt_factory.h:469
json
basic_json<> json
default specialization
Definition: json.hpp:3422
lexy::_detail::is_constructible
constexpr auto is_constructible
Definition: object.hpp:18
BT::BehaviorTreeFactory::registerBehaviorTreeFromText
void registerBehaviorTreeFromText(const std::string &xml_text)
Definition: bt_factory.cpp:277
BT::SimpleConditionNode::TickFunctor
std::function< NodeStatus(TreeNode &)> TickFunctor
Definition: condition_node.h:53
BT::Tree::rootBlackboard
Blackboard::Ptr rootBlackboard()
Definition: bt_factory.cpp:614
BT::BehaviorTreeFactory::addSubstitutionRule
void addSubstitutionRule(StringView filter, SubstitutionRule rule)
addSubstitutionRule replace a node with another one when the tree is created. If the rule ia a string...
Definition: bt_factory.cpp:475
BT::Tree::TickOption
TickOption
Definition: bt_factory.h:184
lexyd::opt
constexpr auto opt(Rule)
Definition: option.hpp:81
BT::NodeBuilder
std::function< std::unique_ptr< TreeNode >(const std::string &, const NodeConfig &)> NodeBuilder
The term "Builder" refers to the Builder Pattern (https://en.wikipedia.org/wiki/Builder_pattern)
Definition: bt_factory.h:31
BT::NodeConfig
Definition: tree_node.h:73
BT::Tree::applyVisitor
void applyVisitor(const std::function< void(const TreeNode *)> &visitor)
Definition: bt_factory.cpp:623
BT::BehaviorTreeFactory::registerSimpleCondition
void registerSimpleCondition(const std::string &ID, const SimpleConditionNode::TickFunctor &tick_functor, PortsList ports={})
registerSimpleCondition help you register nodes of type SimpleConditionNode.
Definition: bt_factory.cpp:153
xml_text
static const char * xml_text
Definition: ex01_wrap_legacy.cpp:52
BT::BehaviorTreeFactory::registerScriptingEnums
void registerScriptingEnums()
registerScriptingEnums is syntactic sugar to automatically register multiple enums....
Definition: bt_factory.h:458
BT::Tree::EXACTLY_ONCE
@ EXACTLY_ONCE
Definition: bt_factory.h:186
BT::SimpleActionNode::TickFunctor
std::function< NodeStatus(TreeNode &)> TickFunctor
Definition: action_node.h:82
BT::BehaviorTreeFactory::registerFromROSPlugins
void registerFromROSPlugins()
registerFromROSPlugins finds all shared libraries that export ROS plugins for behaviortree_cpp,...
Definition: bt_factory.cpp:263
BT::NodeStatus
NodeStatus
Definition: basic_types.h:33
BT::BlackboardClone
void BlackboardClone(const Blackboard &src, Blackboard &dst)
BlackboardClone make a copy of the content of the blackboard.
BT::Parser
The BehaviorTreeParser is a class used to read the model of a BehaviorTree from file or text and inst...
Definition: bt_parser.h:26
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:166
BT::Tree::uid_counter_
uint16_t uid_counter_
Definition: bt_factory.h:193


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Jun 28 2024 02:20:07