From 540b9ad756a456fffd5f10cc33a70bca7e464fe2 Mon Sep 17 00:00:00 2001 From: vishrut Date: Mon, 18 Mar 2024 23:33:28 +0530 Subject: [PATCH] adding small delay in creating publisher --- mqtt_client/src/MqttClient.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mqtt_client/src/MqttClient.cpp b/mqtt_client/src/MqttClient.cpp index 44f9e89..b52f80f 100644 --- a/mqtt_client/src/MqttClient.cpp +++ b/mqtt_client/src/MqttClient.cpp @@ -29,6 +29,7 @@ SOFTWARE. #include #include #include +#include #include #include @@ -785,6 +786,8 @@ void MqttClient::mqtt2primitive(mqtt::const_message_ptr mqtt_msg) { NODELET_INFO("ROS publisher message type on topic '%s' set to '%s'", mqtt2ros.ros.topic.c_str(), msg_type_name.c_str()); + //adding small delay in creating publisher + std::this_thread::sleep_for(std::chrono::milliseconds(200)); } // publish via ShapeShifter