refactor: comment out connection check in sendKobukiData function

This commit is contained in:
ishak jmilou.ishak
2025-01-09 13:38:18 +01:00
parent 89421ccf34
commit ec2a08c656

View File

@@ -325,13 +325,13 @@ std::string serializeKobukiData(const TKobukiData &data) {
// needed it so it can be threaded // needed it so it can be threaded
void sendKobukiData(TKobukiData &data) { void sendKobukiData(TKobukiData &data) {
while (true) { while (true) {
if(!robot.isConnected()){ // if(!robot.isConnected()){
std::cout << "Kobuki is not connected anymore" << std::endl; // std::cout << "Kobuki is not connected anymore" << std::endl;
robot.startCommunication("/dev/ttyUSB0", true, nullptr); // robot.startCommunication("/dev/ttyUSB0", true, nullptr);
while(!robot.isConnected()){ // while(!robot.isConnected()){
std::this_thread::sleep_for(std::chrono::seconds(1)); // std::this_thread::sleep_for(std::chrono::seconds(1));
} // }
} // }
client.publishMessage("kobuki/data", serializeKobukiData(data)); client.publishMessage("kobuki/data", serializeKobukiData(data));
std::cout << "Sent data" << std::endl; std::cout << "Sent data" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(1000)); std::this_thread::sleep_for(std::chrono::milliseconds(1000));