qnode_car_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_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 go();
00053     bool getLocations(std::vector<std::string> & locations);
00054     bool getGoal(std::string & goal);
00055 
00056 Q_SIGNALS:
00057     void rosShutdown();
00058 
00059 private:
00060   int init_argc;
00061   char** init_argv;
00062   QMutex mutex;
00063 
00064   ros::NodeHandle n;
00065 
00066   // [service client attributes]
00067   ros::ServiceClient get_locations_client;
00068   iri_goal_database::get_locations get_locations_srv;
00069 
00070   // [action client attributes]
00071   actionlib::SimpleActionClient<tibi_dabo_msgs::guiAction> gui_action;
00072   tibi_dabo_msgs::guiGoal gui_goal;
00073   bool guiMakeActionRequest();
00074   void guiDone(const actionlib::SimpleClientGoalState& state,  const tibi_dabo_msgs::guiResultConstPtr& result);
00075   void guiActive();
00076   void guiFeedback(const tibi_dabo_msgs::guiFeedbackConstPtr& feedback);
00077   bool gui_active;
00078 
00079   // [action server attributes]
00080   IriActionServer<tibi_dabo_msgs::guiAction> gui_action_aserver_;
00081   void gui_actionStartCallback(const tibi_dabo_msgs::guiGoalConstPtr& goal);
00082   void gui_actionStopCallback(void);
00083   bool gui_actionIsFinishedCallback(void);
00084   bool gui_actionHasSucceedCallback(void);
00085   void gui_actionGetResultCallback(tibi_dabo_msgs::guiResultPtr& result);
00086   void gui_actionGetFeedbackCallback(tibi_dabo_msgs::guiFeedbackPtr& feedback);
00087   bool new_gui_cmd;
00088   gui_cmds gui_cmd;
00089   std::string gui_location_id;
00090 };
00091 
00092 }  // namespace tibi_dabo_gui
00093 
00094 #endif /* tibi_dabo_gui_QNODE_HPP_ */


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