00001 #include "dummy_nodes.h" 00002 00003 // This function must be implemented in the .cpp file to create 00004 // a plugin that can be loaded at run-time 00005 BT_REGISTER_NODES(factory) 00006 { 00007 DummyNodes::RegisterNodes(factory); 00008 } 00009 00010 namespace DummyNodes 00011 { 00012 00013 BT::NodeStatus CheckBattery() 00014 { 00015 std::cout << "[ Battery: OK ]" << std::endl; 00016 return BT::NodeStatus::SUCCESS; 00017 } 00018 00019 BT::NodeStatus GripperInterface::open() 00020 { 00021 _opened = true; 00022 std::cout << "GripperInterface::open" << std::endl; 00023 return BT::NodeStatus::SUCCESS; 00024 } 00025 00026 BT::NodeStatus GripperInterface::close() 00027 { 00028 std::cout << "GripperInterface::close" << std::endl; 00029 _opened = false; 00030 return BT::NodeStatus::SUCCESS; 00031 } 00032 00033 BT::NodeStatus ApproachObject::tick() 00034 { 00035 std::cout << "ApproachObject: " << this->name() << std::endl; 00036 return BT::NodeStatus::SUCCESS; 00037 } 00038 00039 BT::NodeStatus SaySomething::tick() 00040 { 00041 auto msg = getInput<std::string>("message"); 00042 if (!msg) 00043 { 00044 throw BT::RuntimeError( "missing required input [message]: ", msg.error() ); 00045 } 00046 00047 std::cout << "Robot says: " << msg.value() << std::endl; 00048 return BT::NodeStatus::SUCCESS; 00049 } 00050 00051 BT::NodeStatus SaySomethingSimple(BT::TreeNode &self) 00052 { 00053 auto msg = self.getInput<std::string>("message"); 00054 if (!msg) 00055 { 00056 throw BT::RuntimeError( "missing required input [message]: ", msg.error() ); 00057 } 00058 00059 std::cout << "Robot says: " << msg.value() << std::endl; 00060 return BT::NodeStatus::SUCCESS; 00061 } 00062 00063 }