dummy_nodes.cpp
Go to the documentation of this file.
1 #include "dummy_nodes.h"
2 
3 // This function must be implemented in the .cpp file to create
4 // a plugin that can be loaded at run-time
6 {
8 }
9 
10 namespace DummyNodes
11 {
12 
14 {
15  std::cout << "[ Battery: OK ]" << std::endl;
17 }
18 
20 {
21  std::cout << "[ Temperature: OK ]" << std::endl;
23 }
24 
26 {
27  std::cout << "Robot says: Hello World" << std::endl;
29 }
30 
32 {
33  _opened = true;
34  std::cout << "GripperInterface::open" << std::endl;
36 }
37 
39 {
40  std::cout << "GripperInterface::close" << std::endl;
41  _opened = false;
43 }
44 
46 {
47  std::cout << "ApproachObject: " << this->name() << std::endl;
49 }
50 
52 {
53  auto msg = getInput<std::string>("message");
54  if(!msg)
55  {
56  throw BT::RuntimeError("missing required input [message]: ", msg.error());
57  }
58 
59  std::cout << "Robot says: " << msg.value() << std::endl;
61 }
62 
64 {
65  auto msg = self.getInput<std::string>("message");
66  if(!msg)
67  {
68  throw BT::RuntimeError("missing required input [message]: ", msg.error());
69  }
70 
71  std::cout << "Robot says: " << msg.value() << std::endl;
73 }
74 
75 } // namespace DummyNodes
DummyNodes::GripperInterface::open
NodeStatus open()
Definition: dummy_nodes.cpp:31
BT::TreeNode
Abstract base class for Behavior Tree Nodes.
Definition: tree_node.h:118
DummyNodes::CheckBattery
BT::NodeStatus CheckBattery()
Definition: dummy_nodes.cpp:13
DummyNodes::SaySomethingSimple
BT::NodeStatus SaySomethingSimple(BT::TreeNode &self)
Definition: dummy_nodes.cpp:63
DummyNodes
Definition: dummy_nodes.cpp:10
DummyNodes::SaySomething::tick
NodeStatus tick() override
Method to be implemented by the user.
Definition: dummy_nodes.cpp:51
BT_REGISTER_NODES
BT_REGISTER_NODES(factory)
Definition: dummy_nodes.cpp:5
DummyNodes::ApproachObject::tick
NodeStatus tick() override
Method to be implemented by the user.
Definition: dummy_nodes.cpp:45
dummy_nodes.h
DummyNodes::RegisterNodes
void RegisterNodes(BT::BehaviorTreeFactory &factory)
Definition: dummy_nodes.h:122
DummyNodes::GripperInterface::close
NodeStatus close()
Definition: dummy_nodes.cpp:38
BT::RuntimeError
Definition: exceptions.h:58
DummyNodes::GripperInterface::_opened
bool _opened
Definition: dummy_nodes.h:28
BT::TreeNode::name
const std::string & name() const
Name of the instance, not the type.
Definition: tree_node.cpp:302
BT::NodeStatus::SUCCESS
@ SUCCESS
DummyNodes::SayHello
BT::NodeStatus SayHello()
Definition: dummy_nodes.cpp:25
DummyNodes::CheckTemperature
BT::NodeStatus CheckTemperature()
Definition: dummy_nodes.cpp:19
BT::NodeStatus
NodeStatus
Definition: basic_types.h:33


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