25 #ifndef __PLUGINS_GAZSIM_COMM_COMM_THREAD_H_ 26 #define __PLUGINS_GAZSIM_COMM_COMM_THREAD_H_ 28 #include <core/threading/thread.h> 29 #include <aspect/logging.h> 30 #include <aspect/configurable.h> 31 #include <aspect/blocked_timing.h> 32 #include <boost/asio.hpp> 33 #include <google/protobuf/message.h> 34 #include <protobuf_comm/peer.h> 35 #include <protobuf_comm/message_register.h> 40 class ProtobufStreamClient;
57 void receive_msg(boost::asio::ip::udp::endpoint &endpoint,
58 uint16_t component_id, uint16_t msg_type,
59 std::shared_ptr<google::protobuf::Message> msg);
65 protected:
virtual void run() { Thread::run(); }
68 std::vector<protobuf_comm::ProtobufBroadcastPeer*> peers_;
69 std::vector<protobuf_comm::ProtobufBroadcastPeer*> peers_crypto1_;
70 std::vector<protobuf_comm::ProtobufBroadcastPeer*> peers_crypto2_;
73 std::vector<std::string> addresses_;
74 std::vector<unsigned int> send_ports_;
75 std::vector<unsigned int> recv_ports_;
76 std::vector<unsigned int> send_ports_crypto1_;
77 std::vector<unsigned int> recv_ports_crypto1_;
78 std::vector<unsigned int> send_ports_crypto2_;
79 std::vector<unsigned int> recv_ports_crypto2_;
81 bool use_crypto1_, use_crypto2_;
83 std::vector<std::string> proto_dirs_;
void receive_raw_msg(boost::asio::ip::udp::endpoint &endpoint, protobuf_comm::frame_header_t &header, void *data, size_t length)
Receive and forward raw msg.
Thread class encapsulation of pthreads.
Plugin simulates and manages communication for Simulation in Gazebo.
Thread aspect to use blocked timing.
Thread aspect to log output.
Thread aspect to access configuration data.
virtual void finalize()
Finalize the thread.
virtual void init()
Initialize the thread.
virtual void run()
Stub to see name in backtrace for easier debugging.
void receive_msg(boost::asio::ip::udp::endpoint &endpoint, uint16_t component_id, uint16_t msg_type, std::shared_ptr< google::protobuf::Message > msg)
Receive and forward msg.
virtual void loop()
Code to execute in the thread.