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
void sendKobukiData(TKobukiData &data) {
while (true) {
if(!robot.isConnected()){
std::cout << "Kobuki is not connected anymore" << std::endl;
robot.startCommunication("/dev/ttyUSB0", true, nullptr);
while(!robot.isConnected()){
std::this_thread::sleep_for(std::chrono::seconds(1));
}
}
// if(!robot.isConnected()){
// std::cout << "Kobuki is not connected anymore" << std::endl;
// robot.startCommunication("/dev/ttyUSB0", true, nullptr);
// while(!robot.isConnected()){
// std::this_thread::sleep_for(std::chrono::seconds(1));
// }
// }
client.publishMessage("kobuki/data", serializeKobukiData(data));
std::cout << "Sent data" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(1000));