15#include "auto_apms_behavior_tree_core/node/node_model_type.hpp"
17#include "auto_apms_behavior_tree_core/builder.hpp"
18#include "auto_apms_behavior_tree_core/exceptions.hpp"
19#include "behaviortree_cpp/tree_node.h"
35std::string
SubTree::name() {
return core::TreeDocument::SUBTREE_ELEMENT_NAME; }
41 for (
const auto & [key, val] : remapping) {
42 if (!BT::TreeNode::isBlackboardPointer(val)) {
43 throw exceptions::TreeDocumentError(
44 "When setting the blackboard remapping for a subtree, you must refer to the parent blackboard's entry to remap "
45 "to using curly brackets (Got: '" +
48 ele_ptr_->SetAttribute(key.c_str(), val.c_str());
55 std::map<std::string, std::string> remapping;
56 for (
const tinyxml2::XMLAttribute * attr =
ele_ptr_->FirstAttribute(); attr !=
nullptr; attr = attr->Next()) {
57 if (BT::TreeNode::isBlackboardPointer(attr->Value())) {
58 remapping[attr->Name()] = attr->Value();
NodeElement toNodeElement()
Convert to a lower level NodeElement object.
Handle for a single node of a TreeDocument.
NodeElement & setPorts(const PortValues &port_values)
Populate the the node's data ports.
NodeElement(TreeDocument *doc_ptr, XMLElement *ele_ptr)
Protected constructor intended for internal use only.
PortValues getPorts() const
Assemble the values given to each data port implemented by this node.
tinyxml2::XMLElement * ele_ptr_
Pointer to the corresponding XMLElement of the base document.
Subtree behavior tree node model.
static BT::NodeType type()
Type of the behavior tree node.
bool get_auto_remap() const
Get automatic blackboard remapping.
SubTree & setBlackboardRemapping(const std::map< std::string, std::string > &remapping)
Configure which blackboard entries of the subtree node's parent tree should be also available for the...
std::string getRegistrationName() const override final
Get the type specific name under which all subtree nodes are registered with the behavior tree factor...
std::map< std::string, std::string > getBlackboardRemapping() const
Get the currently configured blackboard remapping.
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.
Powerful tooling for incorporating behavior trees for task development.