From 7a6e2e07d17eedfb0b5543973c939e9d84d186a5 Mon Sep 17 00:00:00 2001 From: ackimixs Date: Tue, 16 Apr 2024 12:10:10 +0200 Subject: [PATCH] sleep --- TCPServer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/TCPServer.cpp b/TCPServer.cpp index f92121e..2b68c04 100644 --- a/TCPServer.cpp +++ b/TCPServer.cpp @@ -211,12 +211,10 @@ void TCPServer::handleMessage(const std::string& message, int clientSocket) this->endRobotPose = {1200, 1700, 1.57079}; std::string toSend = "strat;all;set pos;" + std::to_string(this->robotPose.pos.x) + "," + std::to_string(this->robotPose.pos.y) + "," + std::to_string(this->robotPose.theta * 100) + "\n"; - for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { this->broadcastMessage(toSend); usleep(200'000); } - - this->broadcastMessage(toSend, clientSocket); } else if (tokens[1] == "strat" && tokens[2] == "start") { @@ -452,6 +450,7 @@ void TCPServer::startGame() { // ReSharper disable once CppDFAUnreachableCode this->broadcastMessage("strat;arduino;angle;-157"); this->broadcastMessage("strat;servo_moteur;baisser bras;1");*/ + usleep(1'000'000); std::string toSend = "strat;arduino;go;" + std::to_string(static_cast(this->endRobotPose.pos.x)) + "," + std::to_string(static_cast(this->endRobotPose.pos.y)) + "\n"; this->broadcastMessage(toSend);