00001 00023 #ifndef ROS_BROKER_H_ 00024 #define ROS_BROKER_H_ 00025 00026 #include <iostream> 00027 #include <ros/ros.h> 00028 #include <pluginlib/class_list_macros.h> 00029 00030 #include "micros_swarm/comm_interface.h" 00031 #include "ros_broker/GSDFPacket.h" 00032 00033 namespace ros_broker{ 00034 00035 class ROSBroker : public micros_swarm::CommInterface { 00036 public: 00037 ROSBroker(); 00038 void init(std::string name, const micros_swarm::PacketParser& parser); 00039 void broadcast(const std::vector<uint8_t>& msg_data); 00040 void receive(); 00041 private: 00042 void callback(const GSDFPacket& ros_msg); 00043 std::string name_; 00044 micros_swarm::PacketParser parser_; 00045 ros::NodeHandle node_handle_; 00046 ros::Publisher packet_publisher_; 00047 ros::Subscriber packet_subscriber_; 00048 }; 00049 }; 00050 #endif