TeleKybCoreInterface.cpp
Go to the documentation of this file.
00001 /*
00002  * TeleKybCoreInterface.cpp
00003  *
00004  *  Created on: Nov 14, 2011
00005  *      Author: mriedel
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         // Initial Call. Needed to get the NameSpace
00024         getMainNodeHandle = robotIDNodeHandle.advertiseService(
00025                         "GetMainNodeHandle", &TeleKybCoreInterface::getMainNodeHandleCB, this);
00026 
00027         // Create Services
00028 //      getOptionNodeHandle = mainNodeHandle.advertiseService(
00029 //                      "GetOptionNodeHandle", &TeleKybCoreInterface::getOptionNodeHandleCB, this);
00030         getStateNodeHandle = mainNodeHandle.advertiseService(
00031                         "GetStateNodeHandle", &TeleKybCoreInterface::getStateNodeHandleCB, this);
00032         getBehaviorNodeHandle = mainNodeHandle.advertiseService(
00033                         "GetBehaviorNodeHandle", &TeleKybCoreInterface::getBehaviorNodeHandleCB, this);
00034 }
00035 
00036 TeleKybCoreInterface::~TeleKybCoreInterface() {
00037         // TODO Auto-generated destructor stub
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 //bool TeleKybCoreInterface::getOptionNodeHandleCB(
00048 //              telekyb_srvs::StringOutput::Request& request,
00049 //              telekyb_srvs::StringOutput::Response& response)
00050 //{
00051 //      response.output = ROSOptionController::Instance().getOptionNodeHandle().getNamespace();
00052 //      return true;
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 } /* namespace telekyb */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Defines


telekyb_core
Author(s): Dr. Antonio Franchi and Martin Riedel
autogenerated on Mon Nov 11 2013 11:13:47