19#include "auto_apms_behavior_tree_core/node/node_registration_options.hpp"
20#include "auto_apms_behavior_tree_core/tree/tree_document.hpp"
21#include "behaviortree_cpp/basic_types.h"
25#define AUTO_APMS_BEHAVIOR_TREE_CORE_DEFINE_NON_LEAF_THISREF_METHODS(ClassType) \
26 ClassType & removeFirstChild(const std::string & registration_name = "", const std::string & instance_name = "") \
28 NodeElement::removeFirstChild(registration_name, instance_name); \
32 typename std::enable_if_t<std::is_base_of_v<NodeModelType, T>, ClassType &> removeFirstChild( \
33 const std::string & instance_name = "") \
35 NodeElement::removeFirstChild<T>(instance_name); \
38 ClassType & removeChildren() \
40 NodeElement::removeChildren(); \
44#define AUTO_APMS_BEHAVIOR_TREE_CORE_DEFINE_LEAF_THISREF_METHODS(ClassType) \
45 ClassType & setPorts(const auto_apms_behavior_tree::core::TreeDocument::NodeElement::PortValues & port_values) \
47 NodeElement::setPorts(port_values); \
50 ClassType & resetPorts() \
52 NodeElement::resetPorts(); \
55 ClassType & setConditionalScript(BT::PreCond type, const auto_apms_behavior_tree::core::Script & script) \
57 NodeElement::setConditionalScript(type, script); \
60 ClassType & setConditionalScript(BT::PostCond type, const auto_apms_behavior_tree::core::Script & script) \
62 NodeElement::setConditionalScript(type, script); \
65 ClassType & setName(const std::string & instance_name) \
67 NodeElement::setName(instance_name); \
89 using NodeElement::NodeElement;
92 using RegistrationOptions = NodeRegistrationOptions;
93 using PortInfos = std::map<std::string, BT::PortInfo>;
95 virtual std::string getRegistrationName()
const override = 0;
101 NodeElement toNodeElement();
108class LeafNodeModelType :
public NodeModelType
111 using NodeModelType::NodeModelType;
116 LeafNodeModelType insertNode() =
delete;
117 LeafNodeModelType insertSubTreeNode() =
delete;
118 LeafNodeModelType insertTree() =
delete;
119 LeafNodeModelType insertTreeFromDocument() =
delete;
120 LeafNodeModelType insertTreeFromString() =
delete;
121 LeafNodeModelType insertTreeFromFile() =
delete;
122 LeafNodeModelType insertTreeFromResource() =
delete;
123 LeafNodeModelType & removeFirstChild() =
delete;
124 LeafNodeModelType & removeChildren() =
delete;
166 using LeafNodeModelType::LeafNodeModelType;
170 static std::string
name();
173 static BT::NodeType
type();
181 AUTO_APMS_BEHAVIOR_TREE_CORE_DEFINE_LEAF_THISREF_METHODS(
SubTree)
Class for configuring and instantiating behavior trees.
Handle for a single node of a TreeDocument.
Subtree behavior tree node model.
SubTree & setBlackboardRemapping(const PortValues &remapping)
Configure which blackboard entries of the subtree node's parent tree should be also available for the...
static BT::NodeType type()
Type of the behavior tree node.
bool get_auto_remap() const
Get automatic blackboard remapping.
std::string getRegistrationName() const override final
Get the type specific name under which all subtree nodes are registered with the behavior tree factor...
SubTree & set_auto_remap(bool val=false)
Set automatic blackboard remapping.
static std::string name()
Static method that provides the hard coded registration name of subtree nodes.
Core API for AutoAPMS's behavior tree implementation.
Models for all available behavior tree nodes.
Useful tooling for incorporating behavior trees for task development.