datastream_ROS.h
Go to the documentation of this file.
1 #ifndef DATASTREAM_ROS_TOPIC_H
2 #define DATASTREAM_ROS_TOPIC_H
3 
4 #include <QtPlugin>
5 #include <QAction>
6 #include <QTimer>
7 #include <thread>
11 #include <rosgraph_msgs/Clock.h>
12 #include "qnodedialog.h"
15 
17 {
18  Q_OBJECT
19  Q_PLUGIN_METADATA(IID "facontidavide.PlotJuggler3.DataStreamer")
20  Q_INTERFACES(PJ::DataStreamer)
21 
22 public:
23  DataStreamROS();
24 
25  virtual bool start(QStringList* selected_datasources) override;
26 
27  virtual void shutdown() override;
28 
29  virtual bool isRunning() const override;
30 
31  virtual ~DataStreamROS() override;
32 
33  virtual const char* name() const override
34  {
35  return "ROS Topic Subscriber";
36  }
37 
38  virtual bool xmlSaveState(QDomDocument& doc, QDomElement& parent_element) const override;
39 
40  virtual bool xmlLoadState(const QDomElement& parent_element) override;
41 
42  virtual const std::vector<QAction*>& availableActions() override;
43 
44 private:
45  void topicCallback(const RosIntrospection::ShapeShifter::ConstPtr& msg, const std::string& topic_name);
46 
47  void extractInitialSamples();
48 
49  void timerCallback();
50 
51  void subscribe();
52 
53  bool _running;
55 
56  std::shared_ptr<ros::AsyncSpinner> _spinner;
57 
58  double _initial_time;
59 
60  std::string _prefix;
61 
63 
64  std::map<std::string, ros::Subscriber> _subscribers;
65 
67 
69 
70  QAction* _action_saveAny;
71 
72  std::vector<QAction*> _available_actions;
73 
74  std::map<std::string, int> _msg_index;
75 
77 
79 
80  QTimer* _periodic_timer;
81 
83 
84  std::unordered_map<std::string, PJ::PlotDataAny> _user_defined_buffers;
85 
86 private:
87  void saveIntoRosbag();
88 };
89 
90 #endif // DATALOAD_CSV_H
DataStreamROS::_action_saveIntoRosbag
QAction * _action_saveIntoRosbag
Definition: datastream_ROS.h:68
DataStreamROS::saveIntoRosbag
void saveIntoRosbag()
Definition: datastream_ROS.cpp:248
qnodedialog.h
DataStreamROS::timerCallback
void timerCallback()
Definition: datastream_ROS.cpp:206
boost::shared_ptr
DataStreamROS::_user_defined_buffers
std::unordered_map< std::string, PJ::PlotDataAny > _user_defined_buffers
Definition: datastream_ROS.h:84
DataStreamROS::_spinner
std::shared_ptr< ros::AsyncSpinner > _spinner
Definition: datastream_ROS.h:56
DataStreamROS::_config
PJ::RosParserConfig _config
Definition: datastream_ROS.h:76
DataStreamROS::~DataStreamROS
virtual ~DataStreamROS() override
Definition: datastream_ROS.cpp:438
DataStreamROS::_initial_time
double _initial_time
Definition: datastream_ROS.h:58
DataStreamROS::xmlSaveState
virtual bool xmlSaveState(QDomDocument &doc, QDomElement &parent_element) const override
Definition: datastream_ROS.cpp:443
ros_introspection.hpp
DataStreamROS::_prev_clock_time
double _prev_clock_time
Definition: datastream_ROS.h:82
DataStreamROS
Definition: datastream_ROS.h:16
PJ::RosParserConfig
Definition: parser_configuration.h:14
DataStreamROS::subscribe
void subscribe()
Definition: datastream_ROS.cpp:314
dialog_select_ros_topics.h
DataStreamROS::_subscribers
std::map< std::string, ros::Subscriber > _subscribers
Definition: datastream_ROS.h:64
DataStreamROS::_received_msg_count
int _received_msg_count
Definition: datastream_ROS.h:66
DataStreamROS::_available_actions
std::vector< QAction * > _available_actions
Definition: datastream_ROS.h:72
DataStreamROS::xmlLoadState
virtual bool xmlLoadState(const QDomElement &parent_element) override
Definition: datastream_ROS.cpp:449
PJ::DataStreamer
DataStreamROS::extractInitialSamples
void extractInitialSamples()
Definition: datastream_ROS.cpp:173
DataStreamROS::isRunning
virtual bool isRunning() const override
Definition: datastream_ROS.cpp:413
ros1_parser.h
DataStreamROS::_first_warning
bool _first_warning
Definition: datastream_ROS.h:54
DataStreamROS::start
virtual bool start(QStringList *selected_datasources) override
Definition: datastream_ROS.cpp:334
DataStreamROS::shutdown
virtual void shutdown() override
Definition: datastream_ROS.cpp:418
PJ::CompositeParser
Definition: parser_configuration.h:32
DataStreamROS::name
virtual const char * name() const override
Definition: datastream_ROS.h:33
datastreamer_base.h
DataStreamROS::_running
bool _running
Definition: datastream_ROS.h:53
shape_shifter.hpp
DataStreamROS::DataStreamROS
DataStreamROS()
Definition: datastream_ROS.cpp:29
DataStreamROS::_action_saveAny
QAction * _action_saveAny
Definition: datastream_ROS.h:70
DataStreamROS::_parser
PJ::CompositeParser _parser
Definition: datastream_ROS.h:78
DataStreamROS::_node
ros::NodeHandlePtr _node
Definition: datastream_ROS.h:62
DataStreamROS::_prefix
std::string _prefix
Definition: datastream_ROS.h:60
DataStreamROS::availableActions
virtual const std::vector< QAction * > & availableActions() override
Definition: datastream_ROS.cpp:455
DataStreamROS::_msg_index
std::map< std::string, int > _msg_index
Definition: datastream_ROS.h:74
DataStreamROS::topicCallback
void topicCallback(const RosIntrospection::ShapeShifter::ConstPtr &msg, const std::string &topic_name)
Definition: datastream_ROS.cpp:63
DataStreamROS::_periodic_timer
QTimer * _periodic_timer
Definition: datastream_ROS.h:80


plotjuggler_ros
Author(s): Davide Faconti
autogenerated on Wed Feb 21 2024 03:22:55