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 
9 namespace BT
10 {
12 {
13  static std::atomic<bool> ref_count;
14 
15  public:
16  PublisherZMQ(const BT::Tree& tree,
17  unsigned max_msg_per_second = 25,
18  unsigned publisher_port = 1666,
19  unsigned server_port = 1667);
20 
21  virtual ~PublisherZMQ();
22 
23  private:
24  virtual void callback(Duration timestamp, const TreeNode& node, NodeStatus prev_status,
25  NodeStatus status) override;
26 
27  virtual void flush() override;
28 
29  const BT::Tree& tree_;
30  std::vector<uint8_t> tree_buffer_;
31  std::vector<uint8_t> status_buffer_;
32  std::vector<SerializedTransition> transition_buffer_;
33  std::chrono::microseconds min_time_between_msgs_;
34 
35  std::atomic_bool active_server_;
36  std::thread thread_;
37 
38  void createStatusBuffer();
39 
42  std::atomic_bool send_pending_;
43 
44  std::future<void> send_future_;
45 
46  struct Pimpl;
47  Pimpl* zmq_;
48 
49 };
50 }
51 
52 #endif // BT_ZMQ_PUBLISHER_H
std::vector< uint8_t > status_buffer_
std::chrono::high_resolution_clock::time_point TimePoint
Definition: basic_types.h:339
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:130
Abstract base class for Behavior Tree Nodes.
Definition: tree_node.h:53
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)
NodeStatus
Definition: basic_types.h:35
std::vector< SerializedTransition > transition_buffer_
std::chrono::high_resolution_clock::duration Duration
Definition: basic_types.h:340
std::atomic_bool send_pending_


behaviotree_cpp_v3
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Tue May 4 2021 02:56:24