00001 #ifndef ROSOUT_PUBLISHER_ROS_H 00002 #define ROSOUT_PUBLISHER_ROS_H 00003 00004 #include <QObject> 00005 #include <QtPlugin> 00006 #include <QMainWindow> 00007 #include <map> 00008 #include <ros/ros.h> 00009 #include "PlotJuggler/statepublisher_base.h" 00010 #include <rosgraph_msgs/Log.h> 00011 #include "logwidget.hpp" 00012 00013 class RosoutWindow: public QMainWindow 00014 { 00015 Q_OBJECT 00016 public: 00017 RosoutWindow():QMainWindow() {} 00018 ~ RosoutWindow(){} 00019 00020 void closeEvent ( QCloseEvent* ) override{ 00021 emit closed(); 00022 } 00023 signals: 00024 void closed(); 00025 }; 00026 00027 00028 class RosoutPublisher: public QObject, StatePublisher 00029 { 00030 Q_OBJECT 00031 Q_PLUGIN_METADATA(IID "com.icarustechnology.PlotJuggler.StatePublisher" "../statepublisher.json") 00032 Q_INTERFACES(StatePublisher) 00033 00034 public: 00035 RosoutPublisher(); 00036 00037 virtual void updateState(PlotDataMap* datamap, double current_time) override; 00038 virtual const char* name() const override { return "RosoutPublisherROS"; } 00039 virtual ~RosoutPublisher(); 00040 00041 virtual bool enabled() const override { return enabled_; } 00042 00043 public slots: 00044 virtual void setEnabled(bool enabled) override; 00045 00046 private slots: 00047 00048 void onWindowClosed(); 00049 00050 private: 00051 00052 bool enabled_; 00053 int64_t _minimum_time_usec, _maximum_time_usec; 00054 00055 LogsTableModel* _tablemodel; 00056 rqt_console_plus::LogWidget* _log_widget; 00057 00058 std::vector<const PlotDataAny *> findRosoutTimeseries(PlotDataMap *datamap); 00059 void syncWithTableModel(const std::vector<const PlotDataAny *> &logs_timeseries); 00060 00061 RosoutWindow* _log_window; 00062 signals: 00063 void timeRangeChanged(TimePoint time_min, TimePoint time_max); 00064 }; 00065 00066 00067 00068 #endif // ROSOUT_PUBLISHER_ROS_H