15#include "auto_apms_behavior_tree_core/node.hpp"
17#define INPUT_KEY_MSG "message"
22class ThrowException :
public BT::SyncActionNode
25 using SyncActionNode::SyncActionNode;
27 static BT::PortsList providedPorts()
29 return {BT::InputPort<std::string>(INPUT_KEY_MSG,
"Error message. Creates a generic error message if empty.")};
32 BT::NodeStatus tick() override final
34 auto input = getInput<std::string>(INPUT_KEY_MSG);
35 auto prefix = name() == registrationName() ? name() : (name() +
" (" + registrationName() +
")");
36 std::string msg = input.has_value() && !input.value().empty() ? (prefix +
" - " + input.value())
37 : (prefix +
" - Tree ran into an exception.");
38 throw exceptions::RosNodeError(msg);
#define AUTO_APMS_BEHAVIOR_TREE_DECLARE_NODE(type)
Macro for registering a behavior tree node plugin.
Useful tooling for incorporating behavior trees for task development.