00001 // ***************************************************************************** 00002 // 00003 // Copyright (C) 2013 All Right Reserved, Southwest Research Institute® (SwRI®) 00004 // 00005 // Contract No. 10-58058A 00006 // Contractor Southwest Research Institute® (SwRI®) 00007 // Address 6220 Culebra Road, San Antonio, Texas 78228-0510 00008 // Contact Steve Dellenback <sdellenback@swri.org> (210) 522-3914 00009 // 00010 // This code was developed as part of an internal research project fully funded 00011 // by Southwest Research Institute®. 00012 // 00013 // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 00014 // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 00015 // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 00016 // PARTICULAR PURPOSE. 00017 // 00018 // ***************************************************************************** 00019 00020 #ifndef MAPVIZ_PLUGINS_GPS_PLUGIN_H_ 00021 #define MAPVIZ_PLUGINS_GPS_PLUGIN_H_ 00022 00023 // Include mapviz_plugin.h first to ensure GL deps are included in the right order 00024 #include <mapviz/mapviz_plugin.h> 00025 00026 #include <mapviz/map_canvas.h> 00027 #include <mapviz_plugins/point_drawing_plugin.h> 00028 00029 // C++ standard libraries 00030 #include <list> 00031 #include <string> 00032 #include <vector> 00033 00034 // QT libraries 00035 #include <QGLWidget> 00036 #include <QObject> 00037 #include <QWidget> 00038 00039 // ROS libraries 00040 #include <ros/ros.h> 00041 #include <tf/transform_datatypes.h> 00042 #include <gps_common/GPSFix.h> 00043 #include <swri_transform_util/local_xy_util.h> 00044 00045 // QT autogenerated files 00046 #include "ui_gps_config.h" 00047 00048 namespace mapviz_plugins 00049 { 00050 class GpsPlugin : public mapviz_plugins::PointDrawingPlugin 00051 { 00052 Q_OBJECT 00053 00054 public: 00055 GpsPlugin(); 00056 virtual ~GpsPlugin(); 00057 00058 bool Initialize(QGLWidget* canvas); 00059 void Shutdown() 00060 { 00061 } 00062 00063 void Draw(double x, double y, double scale); 00064 00065 void LoadConfig(const YAML::Node& node, const std::string& path); 00066 void SaveConfig(YAML::Emitter& emitter, const std::string& path); 00067 00068 QWidget* GetConfigWidget(QWidget* parent); 00069 00070 protected: 00071 void PrintError(const std::string& message); 00072 void PrintInfo(const std::string& message); 00073 void PrintWarning(const std::string& message); 00074 00075 protected Q_SLOTS: 00076 void SelectTopic(); 00077 void TopicEdited(); 00078 00079 private: 00080 Ui::gps_config ui_; 00081 QWidget* config_widget_; 00082 00083 std::string topic_; 00084 00085 ros::Subscriber gps_sub_; 00086 bool has_message_; 00087 00088 swri_transform_util::LocalXyWgs84Util local_xy_util_; 00089 00090 void GPSFixCallback(const gps_common::GPSFixConstPtr& gps); 00091 }; 00092 } 00093 00094 #endif // MAPVIZ_PLUGINS_GPS_PLUGIN_H_