00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- 00002 00003 /* -- BEGIN LICENSE BLOCK ---------------------------------------------- 00004 00005 Copyright (c) 2013, TB 00006 All rights reserved. 00007 00008 Redistribution and use in source and binary forms are permitted 00009 provided that the above copyright notice and this paragraph are 00010 duplicated in all such forms and that any documentation, 00011 advertising materials, and other materials related to such 00012 distribution and use acknowledge that the software was developed 00013 by TB. The name of the 00014 TB may not be used to endorse or promote products derived 00015 from this software without specific prior written permission. 00016 THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 00017 IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 00018 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00019 00020 -- END LICENSE BLOCK ----------------------------------------------*/ 00021 00022 //---------------------------------------------------------------------- 00029 //---------------------------------------------------------------------- 00030 #ifndef _MARBLE_PLUGIN_H 00031 #define _MARBLE_PLUGIN_H 00032 00033 #include <QtCore/QObject> 00034 #include <QMutex> 00035 #include <marble/RouteRequest.h> 00036 #include <marble/RoutingManager.h> 00037 #include <marble/MapThemeManager.h> 00038 00039 #include <ros/ros.h> 00040 #include <rqt_gui_cpp/plugin.h> 00041 #include <sensor_msgs/NavSatFix.h> 00042 00043 #include <rqt_marble/bridge_ros_marble.h> 00044 #include <ui_marble_plugin.h> // Generated into ./build/rqt_robot_plugins/rqt_marble by Catkin. 00045 00046 namespace rqt_marble 00047 { 00048 00054 class MarblePlugin : public rqt_gui_cpp::Plugin 00055 { 00056 Q_OBJECT 00057 public: 00058 MarblePlugin(); 00059 virtual void initPlugin(qt_gui_cpp::PluginContext& context); 00060 virtual void shutdownPlugin(); 00061 virtual void saveSettings(qt_gui_cpp::Settings& plugin_settings, 00062 qt_gui_cpp::Settings& instance_settings) const; 00063 virtual void restoreSettings(const qt_gui_cpp::Settings& plugin_settings, 00064 const qt_gui_cpp::Settings& instance_settings); 00065 00066 // Comment in to signal that the plugin has a way to configure it 00067 //bool hasConfiguration() const; 00068 //void triggerConfiguration(); 00069 00070 void gpsCallback(const sensor_msgs::NavSatFixConstPtr& gpspt); 00071 00072 private: 00073 00074 Q_SIGNALS: 00075 00076 void newGpsPosition(qreal, qreal); 00077 00078 private Q_SLOTS: 00079 00080 void changeGpsTopic(const QString &topic_name); 00081 void setKmlFile(bool envoke_file_dialog = true); 00085 void changeMarbleModelTheme(int idx); 00086 void enableNavigation(bool checked); 00087 void routeChanged(); 00088 00089 private: 00090 Ui_MarblePluginWidget ui_; 00091 QWidget* widget_; 00092 ros::Subscriber m_sat_nav_fix_subscriber; 00093 Marble::RoutingManager* routing_manager; 00094 Marble::RouteRequest* request; 00095 Marble::RoutingModel* routeModel; 00096 Marble::MapThemeManager* map_theme_manager; 00097 rqt_marble::BridgeRosMarble* ros_navigation; 00098 00099 void initWidget(qt_gui_cpp::PluginContext& context); 00100 00104 void findGpsTopics(); 00105 }; 00106 } // namespace 00107 #endif // _MARBLE_PLUGIN_H