00001 #ifndef ucl_drone_gui_my_plugin_H 00002 #define ucl_drone_gui_my_plugin_H 00003 00004 #include <ardrone_autonomy/Navdata.h> 00005 #include <ros/ros.h> 00006 #include <rqt_gui_cpp/plugin.h> 00007 #include <std_msgs/Empty.h> 00008 #include <ucl_drone/DroneRole.h> 00009 #include <ucl_drone/DroneRoles.h> 00010 #include <ucl_drone_gui/ui_my_plugin.h> 00011 #include <QDebug> 00012 #include <QWidget> 00013 00014 namespace ucl_drone_gui 00015 { 00016 class MyPlugin : public rqt_gui_cpp::Plugin 00017 { 00018 Q_OBJECT 00019 public: 00020 MyPlugin(); 00021 virtual void initPlugin(qt_gui_cpp::PluginContext& context); 00022 virtual void shutdownPlugin(); 00023 virtual void saveSettings(qt_gui_cpp::Settings& plugin_settings, 00024 qt_gui_cpp::Settings& instance_settings) const; 00025 virtual void restoreSettings(const qt_gui_cpp::Settings& plugin_settings, 00026 const qt_gui_cpp::Settings& instance_settings); 00027 00028 // Comment in to signal that the plugin has a way to configure it 00029 // bool hasConfiguration() const; 00030 // void triggerConfiguration(); 00031 00032 QStringList drones_list; 00033 00034 private: 00035 Ui::MyPluginWidget ui_; 00036 QWidget* widget_; 00037 00038 ros::Subscriber roles_sub; 00039 std::string roles_channel; 00040 void rolesCb(const ucl_drone::DroneRoles::ConstPtr drones_rolesPtr); 00041 00042 ros::Subscriber navdata_sub; 00043 void navdataCb(const ardrone_autonomy::Navdata::ConstPtr navdata); 00044 00045 std::vector< ros::Publisher > emergency_pub; 00046 void init_emergency_pub(int i = 0, bool only = false); 00047 00048 std::vector< ros::Publisher > land_pub; 00049 void init_land_pub(int i = 0, bool only = false); 00050 00051 std::vector< ros::Publisher > takeoff_pub; 00052 void init_takeoff_pub(int i = 0, bool only = false); 00053 00054 std::vector< ros::Publisher > reset_pose_pub; 00055 void init_reset_pose_pub(int i = 0, bool only = false); 00056 00057 public slots: 00058 void drone_select(const QString& str); 00059 void emergency_publish(); 00060 void land_publish(); 00061 void takeoff_publish(); 00062 void reset_pose_publish(); 00063 void add_drone_to_list(); 00064 void remove_drone_from_list(); 00065 }; 00066 } // namespace ucl_drone_gui 00067 #endif // ucl_drone_gui_my_plugin_H