15#include "std_srvs/srv/set_bool.hpp"
17#include "auto_apms_behavior_tree_core/node.hpp"
19#define INPUT_KEY_DATA "data"
20#define OUTPUT_KEY_MESSAGE "message"
28 SetBool(
const std::string & instance_name,
const Config & config,
const Context & context)
33 static BT::PortsList providedPorts()
36 BT::InputPort<bool>(INPUT_KEY_DATA,
"Boolean data to set (true, false, 1, 0)."),
37 BT::OutputPort<std::string>(OUTPUT_KEY_MESSAGE,
"Service response: informational message."),
41 bool setRequest(Request::SharedPtr & request)
override final
43 const BT::Expected<bool> expected_data = getInput<bool>(INPUT_KEY_DATA);
46 logger_,
"%s - %s", context_.getFullyQualifiedTreeNodeName(
this).c_str(), expected_data.error().c_str());
49 request->data = expected_data.value();
53 BT::NodeStatus onResponseReceived(
const Response::SharedPtr & response)
override final
55 setOutput(OUTPUT_KEY_MESSAGE, response->message);
56 return response->success ? BT::NodeStatus::SUCCESS : BT::NodeStatus::FAILURE;
Generic behavior tree node wrapper for a ROS 2 service client.
static BT::PortsList providedBasicPorts(BT::PortsList addition)
RosServiceNode(const std::string &instance_name, const Config &config, Context context)
#define AUTO_APMS_BEHAVIOR_TREE_REGISTER_NODE(type)
Macro for registering a behavior tree node plugin.
Powerful tooling for incorporating behavior trees for task development.