19#define INPUT_KEY_PACKAGE "package_name"
20#define INPUT_KEY_FILENAME "filename"
21#define OUTPUT_KEY_DATA "xml_data"
26class LoadBehaviorTreeAction :
public BT::SyncActionNode
29 using SyncActionNode::SyncActionNode;
31 static BT::PortsList providedPorts()
33 return { BT::InputPort<std::string>(
INPUT_KEY_PACKAGE,
"Name of the ROS2 package containing the trees file"),
34 BT::InputPort<std::string>(
INPUT_KEY_FILENAME,
"Name of the trees file (Extension may be omitted)"),
36 "XML string containing the data for the behavior trees") };
39 BT::NodeStatus tick()
final
44 std::unique_ptr<TreeResource> tree_resource_ptr;
51 return BT::NodeStatus::FAILURE;
54 setOutput<std::string>(
OUTPUT_KEY_DATA, tree_resource_ptr->writeTreeToString());
55 return BT::NodeStatus::SUCCESS;
#define AUTO_APMS_BEHAVIOR_TREE_REGISTER_NODE(type)
Macro for registering a behavior tree node plugin.
#define INPUT_KEY_FILENAME
#define INPUT_KEY_PACKAGE
static TreeResource selectByFileName(const std::string &file_name, const std::string &package_name="")