00001 /* 00002 * BehaviorInterface.hpp 00003 * 00004 * Created on: Nov 10, 2011 00005 * Author: mriedel 00006 */ 00007 00008 #ifndef BEHAVIORCONTROLLERINTERFACE_HPP_ 00009 #define BEHAVIORCONTROLLERINTERFACE_HPP_ 00010 00011 #include <telekyb_defines/telekyb_defines.hpp> 00012 #include <ros/ros.h> 00013 00014 // BehaviorContainer. Contains UserBehaviors that are loaded at runtime 00015 #include <tk_behavior/BehaviorContainer.hpp> 00016 00017 // Services 00018 #include <telekyb_srvs/StringArrayOutput.h> 00019 #include <telekyb_srvs/BehaviorInput.h> 00020 #include <telekyb_srvs/BehaviorOutput.h> 00021 #include <telekyb_srvs/BehaviorInputOutput.h> 00022 00023 #include <std_srvs/Empty.h> 00024 00025 namespace TELEKYB_NAMESPACE { 00026 00027 // Forward Declaration 00028 class BehaviorController; 00029 00030 00031 class BehaviorControllerInterface { 00032 protected: 00033 // the Controller 00034 BehaviorController& behaviorController; 00035 00036 // the Container 00037 BehaviorContainer behaviorContainer; 00038 00039 // NodeHandle 00040 ros::NodeHandle nodeHandle; 00041 00042 // ServiceServer 00043 ros::ServiceServer getAvailableBehaviorsClient; 00044 ros::ServiceServer loadBehavior; 00045 ros::ServiceServer unloadBehavior; 00046 ros::ServiceServer switchBehavior; 00047 ros::ServiceServer getSystemBehavior; 00048 ros::ServiceServer getActiveBehavior; 00049 ros::ServiceServer emergencyLand; 00050 ros::ServiceServer normalBrake; 00051 00052 // ServiceServerCallBacks 00053 bool getAvailableBehaviorsCB( 00054 telekyb_srvs::StringArrayOutput::Request& request, 00055 telekyb_srvs::StringArrayOutput::Response& response); 00056 bool loadBehaviorCB( 00057 telekyb_srvs::BehaviorInputOutput::Request& request, 00058 telekyb_srvs::BehaviorInputOutput::Response& response); 00059 bool unloadBehaviorCB( 00060 telekyb_srvs::BehaviorInput::Request& request, 00061 telekyb_srvs::BehaviorInput::Response& response); 00062 bool switchBehaviorCB( 00063 telekyb_srvs::BehaviorInput::Request& request, 00064 telekyb_srvs::BehaviorInput::Response& response); 00065 bool getSystemBehaviorCB( 00066 telekyb_srvs::BehaviorInputOutput::Request& request, 00067 telekyb_srvs::BehaviorInputOutput::Response& response); 00068 bool getActiveBehaviorCB( 00069 telekyb_srvs::BehaviorOutput::Request& request, 00070 telekyb_srvs::BehaviorOutput::Response& response); 00071 bool emergencyLandCB( 00072 std_srvs::Empty::Request& request, 00073 std_srvs::Empty::Response& response); 00074 bool normalBrakeCB( 00075 std_srvs::Empty::Request& request, 00076 std_srvs::Empty::Response& response); 00077 00078 00079 // Publish activeBehavior Changes 00080 ros::Publisher activeBehaviorPub; 00081 00082 // Trajectory 00083 ros::Publisher trajectoryPub; 00084 00085 public: 00086 BehaviorControllerInterface(BehaviorController& behaviorController_); 00087 virtual ~BehaviorControllerInterface(); 00088 00089 // published the curret active Behavior 00090 void publishActiveBehavior(); 00091 00092 void publishTKTrajectory(const TKTrajectory& trajectory); 00093 00094 }; 00095 00096 } 00097 00098 #endif /* BEHAVIORCONTROLLERINTERFACE_HPP_ */