bt_zmq_publisher.h
Go to the documentation of this file.
1 #ifndef BT_ZMQ_PUBLISHER_H
2 #define BT_ZMQ_PUBLISHER_H
3 
4 #include <array>
5 #include <future>
6 #include "abstract_logger.h"
7 
8 namespace BT
9 {
11 {
12  static std::atomic<bool> ref_count;
13 
14 public:
15  PublisherZMQ(const BT::Tree& tree, unsigned max_msg_per_second = 25,
16  unsigned publisher_port = 1666, unsigned server_port = 1667);
17 
18  virtual ~PublisherZMQ();
19 
20 private:
21  virtual void callback(Duration timestamp, const TreeNode& node, NodeStatus prev_status,
22  NodeStatus status) override;
23 
24  virtual void flush() override;
25 
26  const BT::Tree& tree_;
27  std::vector<uint8_t> tree_buffer_;
28  std::vector<uint8_t> status_buffer_;
29  std::vector<SerializedTransition> transition_buffer_;
30  std::chrono::microseconds min_time_between_msgs_;
31 
32  std::atomic_bool active_server_;
33  std::thread thread_;
34 
35  void createStatusBuffer();
36 
39  std::atomic_bool send_pending_;
40  std::condition_variable send_condition_variable_;
41  std::future<void> send_future_;
42 
43  struct Pimpl;
44  Pimpl* zmq_;
45 };
46 } // namespace BT
47 
48 #endif // BT_ZMQ_PUBLISHER_H
std::vector< uint8_t > status_buffer_
std::chrono::high_resolution_clock::time_point TimePoint
Definition: basic_types.h:361
std::vector< uint8_t > tree_buffer_
std::atomic_bool active_server_
static pthread_mutex_t mutex
Definition: minitrace.cpp:61
static std::atomic< bool > ref_count
virtual void flush() override
const BT::Tree & tree_
std::future< void > send_future_
virtual void callback(Duration timestamp, const TreeNode &node, NodeStatus prev_status, NodeStatus status) override
Struct used to store a tree. If this object goes out of scope, the tree is destroyed.
Definition: bt_factory.h:125
Abstract base class for Behavior Tree Nodes.
Definition: tree_node.h:55
std::chrono::microseconds min_time_between_msgs_
std::thread thread_
PublisherZMQ(const BT::Tree &tree, unsigned max_msg_per_second=25, unsigned publisher_port=1666, unsigned server_port=1667)
std::condition_variable send_condition_variable_
NodeStatus
Definition: basic_types.h:35
std::vector< SerializedTransition > transition_buffer_
std::chrono::high_resolution_clock::duration Duration
Definition: basic_types.h:362
std::atomic_bool send_pending_


behaviortree_cpp_v3
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Mon Jul 3 2023 02:50:14