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 BT::NodeStatus SayHello() 00013 { 00014 std::cout << "Robot says: \"Hello!!!\"" << std::endl; 00015 return BT::NodeStatus::SUCCESS; 00016 } 00017 00018 BT::NodeStatus CheckBattery() 00019 { 00020 std::cout << "[ Battery: OK ]" << std::endl; 00021 return BT::NodeStatus::SUCCESS; 00022 } 00023 00024 BT::NodeStatus CheckTemperature() 00025 { 00026 std::cout << "[ Temperature: OK ]" << std::endl; 00027 return BT::NodeStatus::SUCCESS; 00028 } 00029 00030 BT::NodeStatus GripperInterface::open() 00031 { 00032 _opened = true; 00033 std::cout << "GripperInterface::open" << std::endl; 00034 return BT::NodeStatus::SUCCESS; 00035 } 00036 00037 BT::NodeStatus GripperInterface::close() 00038 { 00039 std::cout << "GripperInterface::close" << std::endl; 00040 _opened = false; 00041 return BT::NodeStatus::SUCCESS; 00042 } 00043 00044 BT::NodeStatus ApproachObject::tick() 00045 { 00046 std::cout << "ApproachObject: " << this->name() << std::endl; 00047 return BT::NodeStatus::SUCCESS; 00048 } 00049 00050 BT::NodeStatus SaySomething::tick() 00051 { 00052 std::string msg; 00053 if (getParam("message", msg) == false) 00054 { 00055 // if getParam failed, use the default value 00056 msg = requiredNodeParameters().at("message"); 00057 } 00058 std::cout << "Robot says: " << msg << std::endl; 00059 return BT::NodeStatus::SUCCESS; 00060 } 00061 }