Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #include <telekyb_core/TeleKybCoreInterface.hpp>
00009 
00010 #include <telekyb_base/ROS.hpp>
00011 #include <tk_state/StateEstimatorController.hpp>
00012 #include <tk_behavior/BehaviorController.hpp>
00013 
00014 #include <boost/lexical_cast.hpp>
00015 
00016 namespace TELEKYB_NAMESPACE {
00017 
00018 TeleKybCoreInterface::TeleKybCoreInterface(int robotID_)
00019         : robotID(robotID_),
00020           robotIDNodeHandle(ROSModule::Instance().getBaseNodeHandle(), boost::lexical_cast<std::string>(robotID_)),
00021           mainNodeHandle(ROSModule::Instance().getMainNodeHandle())
00022 {
00023         
00024         getMainNodeHandle = robotIDNodeHandle.advertiseService(
00025                         "GetMainNodeHandle", &TeleKybCoreInterface::getMainNodeHandleCB, this);
00026 
00027         
00028 
00029 
00030         getStateNodeHandle = mainNodeHandle.advertiseService(
00031                         "GetStateNodeHandle", &TeleKybCoreInterface::getStateNodeHandleCB, this);
00032         getBehaviorNodeHandle = mainNodeHandle.advertiseService(
00033                         "GetBehaviorNodeHandle", &TeleKybCoreInterface::getBehaviorNodeHandleCB, this);
00034 }
00035 
00036 TeleKybCoreInterface::~TeleKybCoreInterface() {
00037         
00038 }
00039 
00040 bool TeleKybCoreInterface::getMainNodeHandleCB(
00041                 telekyb_srvs::StringOutput::Request& request,
00042                 telekyb_srvs::StringOutput::Response& response)
00043 {
00044         response.output = mainNodeHandle.getNamespace();
00045         return true;
00046 }
00047 
00048 
00049 
00050 
00051 
00052 
00053 
00054 
00055 bool TeleKybCoreInterface::getStateNodeHandleCB(
00056                 telekyb_srvs::StringOutput::Request& request,
00057                 telekyb_srvs::StringOutput::Response& response)
00058 {
00059         response.output = StateEstimatorController::Instance().getSensorNodeHandle().getNamespace();
00060         return true;
00061 }
00062 
00063 bool TeleKybCoreInterface::getBehaviorNodeHandleCB(
00064                 telekyb_srvs::StringOutput::Request& request,
00065                 telekyb_srvs::StringOutput::Response& response)
00066 {
00067         response.output = BehaviorController::Instance().getBehaviorNodeHandle().getNamespace();
00068         return true;
00069 }
00070 
00071 }