Skip to content

Commit

Permalink
fix:过滤错误msg导致节点挂断问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zymouse committed Mar 25, 2024
1 parent ebcfb6f commit 1473543
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/obu_socket_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ int main(int argc, char** argv) {

// udp_server.send_to_client(data_process_.packed_data(),29+data_process_.get_string().length());
// std::cout<<"send over"<<std::endl;
data_process_.parse_data(udp_server.receive_data());
std::cout<<"receive over"<<std::endl;
std::vector<uint8_t> received_data= udp_server.receive_data();
std::cout<<sizeof(received_data)<<std::endl;
if (sizeof(received_data)>28){
data_process_.parse_data(received_data);
std::cout<<"receive over"<<std::endl;
}

rclcpp::spin_some(node);
sleep(1);
}
Expand All @@ -28,4 +33,4 @@ int main(int argc, char** argv) {
rclcpp::shutdown();
return 0;

}
}

0 comments on commit 1473543

Please sign in to comment.