qnode_dabo_coop.hpp
Go to the documentation of this file.
00001 
00008 /*****************************************************************************
00009 ** Ifdefs
00010 *****************************************************************************/
00011 
00012 #ifndef tibi_dabo_gui_QNODE_HPP_
00013 #define tibi_dabo_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 #include <iri_action_server/iri_action_server.h>
00029 
00030 #include <iri_goal_database/get_locations.h>
00031 
00032 typedef enum {gui_none=-1,gui_set_goal=0, gui_set_sentence} gui_cmds;
00033 
00034 /*****************************************************************************
00035 ** Namespaces
00036 *****************************************************************************/
00037 
00038 namespace tibi_dabo_gui {
00039 
00040 /*****************************************************************************
00041 ** Class
00042 *****************************************************************************/
00043 
00044 class QNode : public QThread {
00045     Q_OBJECT
00046 public:
00047     QNode(int argc, char** argv );
00048     virtual ~QNode();
00049     bool initialize();
00050     void run();
00051 
00052     void exit();
00053     bool getLocations(std::vector<std::string> & locations);
00054     bool getGoal(std::string & goal);
00055     bool getSentence(double & sentence);
00056 
00057 Q_SIGNALS:
00058     void rosShutdown();
00059 
00060 private:
00061   int init_argc;
00062   char** init_argv;
00063   QMutex mutex;
00064 
00065   ros::NodeHandle n;
00066 
00067   // [service client attributes]
00068   ros::ServiceClient get_locations_client;
00069   iri_goal_database::get_locations get_locations_srv;
00070 
00071   // [action client attributes]
00072   actionlib::SimpleActionClient<tibi_dabo_msgs::guiAction> gui_action;
00073   tibi_dabo_msgs::guiGoal gui_goal;
00074   bool guiMakeActionRequest();
00075   void guiDone(const actionlib::SimpleClientGoalState& state,  const tibi_dabo_msgs::guiResultConstPtr& result);
00076   void guiActive();
00077   void guiFeedback(const tibi_dabo_msgs::guiFeedbackConstPtr& feedback);
00078   bool gui_active;
00079 
00080   // [action server attributes]
00081   IriActionServer<tibi_dabo_msgs::guiAction> gui_action_aserver_;
00082   void gui_actionStartCallback(const tibi_dabo_msgs::guiGoalConstPtr& goal);
00083   void gui_actionStopCallback(void);
00084   bool gui_actionIsFinishedCallback(void);
00085   bool gui_actionHasSucceedCallback(void);
00086   void gui_actionGetResultCallback(tibi_dabo_msgs::guiResultPtr& result);
00087   void gui_actionGetFeedbackCallback(tibi_dabo_msgs::guiFeedbackPtr& feedback);
00088   bool new_goal_cmd;
00089   bool new_sentence_cmd;
00090   gui_cmds gui_cmd;
00091 
00092   std::string gui_location_id;
00093   double sentence_id;
00094 };
00095 
00096 }  // namespace tibi_dabo_gui
00097 
00098 #endif /* tibi_dabo_gui_QNODE_HPP_ */


tibi_dabo_gui
Author(s): fherrero
autogenerated on Fri Dec 6 2013 22:01:34