publisher_ros2.h
Go to the documentation of this file.
1 #ifndef STATE_PUBLISHER_ROS2TOPIC_H
2 #define STATE_PUBLISHER_ROS2TOPIC_H
3 
4 #include <QObject>
5 #include <QtPlugin>
6 #include <map>
7 #include <unordered_set>
8 
9 #include <rclcpp/rclcpp.hpp>
10 #include <rclcpp/publisher.hpp>
11 #include <rosbag2_storage/serialized_bag_message.hpp>
12 
15 
17 #include "ros2_parser.h"
18 #include "generic_publisher.h"
19 
20 using MessageRefPtr = std::shared_ptr<rosbag2_storage::SerializedBagMessage>;
21 
22 
24 {
25  Q_OBJECT
26  Q_PLUGIN_METADATA(IID "facontidavide.PlotJuggler3.StatePublisher")
27  Q_INTERFACES(PJ::StatePublisher)
28 
29 public:
31 
32  virtual ~TopicPublisherROS2() override;
33 
34  void updateState(double current_time) override;
35 
36  const char* name() const override
37  {
38  return "ROS2 Topic Re-Publisher";
39  }
40 
41  bool enabled() const override
42  {
43  return _enabled;
44  }
45 
46  const std::vector<QAction*>& availableActions() override;
47 
48  void play(double interval) override;
49 
50 public slots:
51 
52  void setEnabled(bool enabled) override;
53 
54  void filterDialog();
55 
56 private:
57 
58  std::shared_ptr<rclcpp::Context> _context;
59  std::unique_ptr<rclcpp::executors::MultiThreadedExecutor> _executor;
60  std::shared_ptr<rclcpp::Node> _node;
61 
62  bool _enabled;
63 
64  std::shared_ptr<tf2_ros::TransformBroadcaster> _tf_broadcaster;
65  std::shared_ptr<tf2_ros::StaticTransformBroadcaster> _tf_static_broadcaster;
66 
67  std::unordered_map<std::string, std::shared_ptr<GenericPublisher>> _publishers;
68 
70 
71  std::unordered_map<std::string, bool> _topics_to_publish;
72 
73  double previous_time;
74 
76 
77  std::vector<TopicInfo> _topics_info;
78 
79  std::vector<QAction*> _available_actions;
80 
81  void broadcastTF(double current_time);
82 
83  void updatePublishers();
84 };
85 
86 #endif // STATE_PUBLISHER_ROS2TOPIC_H
const char * name() const override
void updateState(double current_time) override
std::unordered_map< std::string, std::shared_ptr< GenericPublisher > > _publishers
void play(double interval) override
std::unordered_map< std::string, bool > _topics_to_publish
std::shared_ptr< tf2_ros::TransformBroadcaster > _tf_broadcaster
std::shared_ptr< rosbag2_storage::SerializedBagMessage > MessageRefPtr
std::unique_ptr< rclcpp::executors::MultiThreadedExecutor > _executor
void setEnabled(bool enabled) override
std::shared_ptr< tf2_ros::StaticTransformBroadcaster > _tf_static_broadcaster
virtual ~TopicPublisherROS2() override
std::vector< TopicInfo > _topics_info
std::shared_ptr< rclcpp::Context > _context
const std::vector< QAction * > & availableActions() override
void broadcastTF(double current_time)
QAction * _select_topics_to_publish
std::vector< QAction * > _available_actions
bool enabled() const override
std::shared_ptr< rclcpp::Node > _node


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