00001 00029 #ifndef MRMRQT_H_ 00030 #define MRMRQT_H_ 00031 00032 #include <iostream> 00033 #include <set> 00034 00035 #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829 00036 # include <boost/foreach.hpp> 00037 # include <boost/date_time.hpp> 00038 # include <boost/thread.hpp> 00039 # include <boost/algorithm/string.hpp> 00040 #endif 00041 00042 #include <ros/ros.h> 00043 #include <std_msgs/String.h> 00044 #include <std_msgs/Int32.h> 00045 #include <geometry_msgs/Twist.h> 00046 00047 #include <QListView> 00048 #include <QPainter> 00049 #include <QStandardItemModel> 00050 #include <QDockWidget> 00051 00052 #include <rqt_gui_cpp/plugin.h> 00053 #include <pluginlib/class_list_macros.h> 00054 00055 #include <mr_rqt/TeleoperatorInstanceWidget.h> 00056 #include <mr_rqt/MrmControllerUi.h> 00057 #include <mr_rqt/VelocityWidget.h> 00058 #include <mr_rqt/KeyboardTeleop.h> 00059 00060 using namespace std; 00061 00062 namespace mr_rqt 00063 { 00064 00065 class MrRqt : public rqt_gui_cpp::Plugin 00066 { 00067 Q_OBJECT 00068 00069 public: 00070 MrRqt(); 00071 virtual ~MrRqt(); 00072 00073 virtual void initPlugin(qt_gui_cpp::PluginContext& context); 00074 virtual void shutdownPlugin(); 00075 virtual void saveSettings(qt_gui_cpp::Settings& plugin_settings, 00076 qt_gui_cpp::Settings& instance_settings) const; 00077 virtual void restoreSettings(const qt_gui_cpp::Settings& plugin_settings, 00078 const qt_gui_cpp::Settings& instance_settings); 00079 00080 public slots: 00081 00082 // void selectOutputClicked(); 00083 // void selectInputClicked(); 00084 00085 void addControllerClicked(); 00086 00087 private: 00088 bool _outputReady; 00089 00090 boost::thread _spinThread; 00091 QWidget* _widget; 00092 VelocityWidget* _velocityWidget; 00093 Ui_MrmController _mrmControllerUi; 00094 00095 map<string, string> _inputTopics; 00096 vector<string> _outputTopics; 00097 00098 ros::NodeHandle _node; 00099 ros::Publisher _setInputPublisher; 00100 ros::Publisher _setOutputPublisher; 00101 ros::Publisher _mouseVelocityPublisher; 00102 ros::Publisher _keyboardVelocityPublisher; 00103 ros::Subscriber _cmdvelSubscriber; 00104 00105 KeyboardTeleop _keyboardTeleop; 00106 00107 00108 int _currentInput; 00109 int _currentOutput; 00110 00111 void wireUpEvents(); 00112 // void refreshInputOutput(map<string, string>& inputs, vector<string> outputs); 00113 bool setupInputOuput(ros::NodeHandle& node); 00114 // void refreshConfiguration(); 00115 void spin(); 00116 00117 // void publishMouseVelocity(double, double); 00118 // void publishKeyboardVelocity(double, double); 00119 00120 // void onVelocityMessage(const geometry_msgs::Twist::Ptr velocity); 00121 00122 }; 00123 00124 } /* namespace mrm_rqt */ 00125 00126 #endif /* MRMRQT_H_ */