00001 /* 00002 00003 Copyright (c) 2013, Markus Achtelik, ASL, ETH Zurich, Switzerland 00004 You can contact the author at <markus dot achtelik at mavt dot ethz dot ch> 00005 00006 * Copyright (c) 2011, Dirk Thomas, TU Darmstadt 00007 00008 All rights reserved. 00009 00010 Redistribution and use in source and binary forms, with or without 00011 modification, are permitted provided that the following conditions are met: 00012 * Redistributions of source code must retain the above copyright 00013 notice, this list of conditions and the following disclaimer. 00014 * Redistributions in binary form must reproduce the above copyright 00015 notice, this list of conditions and the following disclaimer in the 00016 documentation and/or other materials provided with the distribution. 00017 * Neither the name of ETHZ-ASL nor the 00018 names of its contributors may be used to endorse or promote products 00019 derived from this software without specific prior written permission. 00020 00021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00022 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00023 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00024 DISCLAIMED. IN NO EVENT SHALL ETHZ-ASL BE LIABLE FOR ANY 00025 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00026 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00027 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00028 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00029 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00030 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 00032 */ 00033 00034 00035 #ifndef rqt_image_view__ImageView_H 00036 #define rqt_image_view__ImageView_H 00037 00038 #include <rqt_gui_cpp/plugin.h> 00039 00040 #include <ui_remote_ptam.h> 00041 00042 #include <image_transport/image_transport.h> 00043 #include <sensor_msgs/Image.h> 00044 00045 #include <opencv2/core/core.hpp> 00046 00047 #include <QImage> 00048 #include <QList> 00049 #include <QMutex> 00050 #include <QString> 00051 #include <QSize> 00052 #include <QWidget> 00053 00054 #include <vector> 00055 00056 namespace rqt_ptam { 00057 00058 class RemotePTAM 00059 : public rqt_gui_cpp::Plugin 00060 { 00061 00062 Q_OBJECT 00063 00064 public: 00065 00066 RemotePTAM(); 00067 00068 virtual void initPlugin(qt_gui_cpp::PluginContext& context); 00069 00070 virtual bool eventFilter(QObject* watched, QEvent* event); 00071 00072 virtual void shutdownPlugin(); 00073 00074 virtual void saveSettings(qt_gui_cpp::Settings& plugin_settings, qt_gui_cpp::Settings& instance_settings) const; 00075 00076 virtual void restoreSettings(const qt_gui_cpp::Settings& plugin_settings, const qt_gui_cpp::Settings& instance_settings); 00077 00078 protected slots: 00079 00080 virtual void updateNamespaceList(); 00081 00082 protected: 00083 00084 virtual QList<QString> getTopicList(const QSet<QString>& message_types, const QList<QString>& transports); 00085 00086 virtual void selectTopic(const QString& topic); 00087 00088 protected slots: 00089 00090 virtual void onNamespaceChanged(int index); 00091 00092 virtual void onZoom1(bool checked); 00093 00094 virtual void onSubscribe(bool checked); 00095 00096 virtual void onSpace(); 00097 00098 virtual void onReset(); 00099 00100 protected: 00101 00102 virtual void callbackImage(const sensor_msgs::Image::ConstPtr& msg); 00103 00104 Ui::RemotePTAMWidget ui_; 00105 00106 QWidget* widget_; 00107 00108 image_transport::Subscriber subscriber_; 00109 00110 ros::Publisher cmd_pub_; 00111 00112 QImage qimage_; 00113 QMutex qimage_mutex_; 00114 00115 cv::Mat conversion_mat_; 00116 00117 }; 00118 00119 } 00120 00121 #endif // rqt_image_view__ImageView_H