00001 00008 /***************************************************************************** 00009 ** Ifdefs 00010 *****************************************************************************/ 00011 00012 #ifndef tibi_coop_gui_QNODE_HPP_ 00013 #define tibi_coop_gui_QNODE_HPP_ 00014 00015 /***************************************************************************** 00016 ** Includes 00017 *****************************************************************************/ 00018 00019 #include <ros/ros.h> 00020 #include <string> 00021 #include <QThread> 00022 #include <QStringListModel> 00023 #include <QMutex> 00024 00025 #include <actionlib/client/simple_action_client.h> 00026 #include <actionlib/client/terminal_state.h> 00027 #include <tibi_dabo_msgs/guiAction.h> 00028 00029 #include <iri_goal_database/get_locations.h> 00030 00031 /***************************************************************************** 00032 ** Namespaces 00033 *****************************************************************************/ 00034 00035 namespace tibi_coop_gui { 00036 00037 /***************************************************************************** 00038 ** Class 00039 *****************************************************************************/ 00040 00041 class QNode : public QThread { 00042 Q_OBJECT 00043 public: 00044 QNode(int argc, char** argv ); 00045 virtual ~QNode(); 00046 bool initialize(); 00047 void run(); 00048 00049 void askGoal(std::string goal); 00050 bool getLocations(std::vector<std::string> & locations); 00051 bool guiActionActive(); 00052 Q_SIGNALS: 00053 void rosShutdown(); 00054 00055 private: 00056 int init_argc; 00057 char** init_argv; 00058 QMutex mutex; 00059 00060 // [service client attributes] 00061 ros::ServiceClient get_locations_client; 00062 iri_goal_database::get_locations get_locations_srv; 00063 00064 // [action client attributes] 00065 actionlib::SimpleActionClient<tibi_dabo_msgs::guiAction> gui_action; 00066 tibi_dabo_msgs::guiGoal gui_goal; 00067 bool guiMakeActionRequest(); 00068 void guiDone(const actionlib::SimpleClientGoalState& state, const tibi_dabo_msgs::guiResultConstPtr& result); 00069 void guiActive(); 00070 void guiFeedback(const tibi_dabo_msgs::guiFeedbackConstPtr& feedback); 00071 bool gui_active; 00072 }; 00073 00074 } // namespace tibi_coop_gui 00075 00076 #endif /* tibi_coop_gui_QNODE_HPP_ */