plugin_action.cpp
Go to the documentation of this file.
1 #include "custom_type.hpp"
3 
5 {
6 public:
7  PrintVector(const std::string& name, const BT::NodeConfig& config)
9  {}
10 
11  BT::NodeStatus tick() override
12  {
13  const auto v = getInput<Vector4D>("value").value();
14  printf("x:%f y:%f z:%f w:%f\n", v.x, v.y, v.z, v.w);
16  }
17 
18  // It is mandatory to define this static method.
20  {
21  return { BT::InputPort<Vector4D>("value") };
22  }
23 };
24 
25 // Function used to register PrintVector automatically, when
26 // loading the plugin.
27 // Remember that it is mandatory to add to the CMakeLists.txt file this:
28 //
29 // target_compile_definitions(<target_name> PRIVATE BT_PLUGIN_EXPORT)
30 //
32 {
33  factory.registerNodeType<PrintVector>("PrintVector");
34 }
BT
Definition: ex01_wrap_legacy.cpp:29
PrintVector::providedPorts
static BT::PortsList providedPorts()
Definition: plugin_action.cpp:19
BT::TreeNode::config
const NodeConfig & config() const
Definition: tree_node.cpp:351
BT_REGISTER_NODES
BT_REGISTER_NODES(factory)
Definition: plugin_action.cpp:31
PrintVector::PrintVector
PrintVector(const std::string &name, const BT::NodeConfig &config)
Definition: plugin_action.cpp:7
bt_factory.h
BT::PortsList
std::unordered_map< std::string, PortInfo > PortsList
Definition: basic_types.h:585
custom_type.hpp
BT::SyncActionNode::SyncActionNode
SyncActionNode(const std::string &name, const NodeConfig &config)
Definition: action_node.cpp:52
PrintVector
Definition: plugin_action.cpp:4
BT::TreeNode::name
const std::string & name() const
Name of the instance, not the type.
Definition: tree_node.cpp:302
BT::NodeStatus::SUCCESS
@ SUCCESS
PrintVector::tick
BT::NodeStatus tick() override
Method to be implemented by the user.
Definition: plugin_action.cpp:11
BT::NodeConfig
Definition: tree_node.h:73
BT::SyncActionNode
The SyncActionNode is an ActionNode that explicitly prevents the status RUNNING and doesn't require a...
Definition: action_node.h:52
BT::NodeStatus
NodeStatus
Definition: basic_types.h:33


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Dec 13 2024 03:19:17