32 std::vector<std::vector<uint8_t> > msg_vec;
34 for(
int i = 0; i < msg_vec.size(); i++) {
42 int barrier_size =
rth_->getBarrierSize();
44 std::cout<<
"robot "<<
rth_->getRobotID()<<
" daemon node start."<<std::endl;
49 int robot_id =
rth_->getRobotID();
51 std::string syn=
"SYN";
52 gsdf_msgs::BarrierSyn bs;
56 gsdf_msgs::CommPacket p;
57 p.header.source = robot_id;
59 p.header.data_len = bs_vec.size();
61 p.header.checksum = 0;
62 p.content.buf = bs_vec;
69 int robot_id =
rth_->getRobotID();
70 const Base& l =
rth_->getRobotBase();
71 gsdf_msgs::RobotBase rb;
83 gsdf_msgs::CommPacket p;
84 p.header.source = robot_id;
86 p.header.data_len = rb_vec.size();
88 p.header.checksum = 0;
89 p.content.buf = rb_vec;
96 int robot_id =
rth_->getRobotID();
97 std::vector<int> swarm_list;
99 rth_->getSwarmList(swarm_list);
101 gsdf_msgs::SwarmList sl;
102 sl.robot_id = robot_id;
103 sl.swarm_list = swarm_list;
106 gsdf_msgs::CommPacket p;
107 p.header.source = robot_id;
109 p.header.data_len = sl_vec.size();
110 p.header.version = 1;
111 p.header.checksum = 0;
112 p.content.buf = sl_vec;
121 std::cout<<
"could not get parameter publish_robot_id_duration! use the default value."<<std::endl;
130 std::cout<<
"could not get parameter publish_swarm_list_duration! use the default value."<<std::endl;
139 std::cout<<
"could not get parameter default_neighbor_distance! use the default value."<<std::endl;
148 std::cout<<
"could not get parameter total_robot_numbers! use the default value."<<std::endl;
157 std::cout<<
"could not get parameter comm_type, use the default ros_comm."<<std::endl;
161 std::cout<<
"comm_type: "<<
comm_type_<<std::endl;
166 std::cout<<
"robot_id: "<<
robot_id_<<std::endl;
174 srand(time(NULL) + (
int)getpid());
202 std::cout<<
"robot "<<
rth_->getRobotID()<<
" daemon node start."<<std::endl;
double default_neighbor_distance_
ros::Timer barrier_timer_
pluginlib::ClassLoader< micros_swarm::CommInterface > ci_loader_
void barrier_check(const ros::TimerEvent &)
boost::thread * spin_thread_
boost::shared_ptr< RuntimeHandle > rth_
ros::Timer publish_swarm_list_timer_
std::vector< uint8_t > serialize_ros(T t)
double publish_robot_base_duration_
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
ros::NodeHandle node_handle_
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
boost::shared_ptr< CommInterface > communicator_
ros::Timer publish_robot_base_timer_
static boost::shared_ptr< T > getSingleton()
boost::shared_ptr< micros_swarm::MsgQueueManager > msg_queue_manager_
boost::shared_ptr< micros_swarm::PacketParser > parser_
static void deleteSingleton()
bool getParam(const std::string &key, std::string &s) const
void publish_robot_base(const ros::TimerEvent &)
double publish_swarm_list_duration_
void publish_swarm_list(const ros::TimerEvent &)
boost::shared_ptr< AppManager > app_manager_