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 
71 
72  QAction* _action_saveAny;
73 
74  std::vector<QAction*> _available_actions;
75 
76  std::map<std::string, int> _msg_index;
77 
79 
80  std::unique_ptr<RosCompositeParser> _parser;
81 
82  QTimer* _periodic_timer;
83 
85 
86  std::unordered_map<std::string, PlotDataAny> _user_defined_buffers;
87 
88 private:
89  void saveIntoRosbag();
90 };
91 
92 #endif // DATALOAD_CSV_H
void topicCallback(const RosIntrospection::ShapeShifter::ConstPtr &msg, const std::string &topic_name)
RosIntrospection::SubstitutionRuleMap _rules
virtual const std::vector< QAction * > & availableActions() override
QTimer * _periodic_timer
ros::NodeHandlePtr _node
void extractInitialSamples()
double _initial_time
std::string _prefix
virtual void shutdown() override
std::unordered_map< std::string, PlotDataAny > _user_defined_buffers
std::vector< QAction * > _available_actions
std::map< ROSType, std::vector< SubstitutionRule > > SubstitutionRuleMap
std::unique_ptr< RosCompositeParser > _parser
virtual bool start(QStringList *selected_datasources) override
std::map< std::string, int > _msg_index
virtual bool xmlLoadState(const QDomElement &parent_element) override
virtual const char * name() const override
virtual ~DataStreamROS() override
QAction * _action_saveAny
double _prev_clock_time
virtual bool xmlSaveState(QDomDocument &doc, QDomElement &parent_element) const override
virtual bool isRunning() const override
RosParserConfig _config
std::map< std::string, ros::Subscriber > _subscribers
msg
std::shared_ptr< ros::AsyncSpinner > _spinner
QAction * _action_saveIntoRosbag


plotjuggler_ros
Author(s): Davide Faconti
autogenerated on Fri Jun 23 2023 02:28:03