From 86fd5c8931e0244d64d68a0c4bcbca56d30ee377 Mon Sep 17 00:00:00 2001 From: ackimixs Date: Tue, 16 Apr 2024 19:15:58 +0200 Subject: [PATCH] drop plants --- TCPServer.cpp | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/TCPServer.cpp b/TCPServer.cpp index 535241a..535a043 100644 --- a/TCPServer.cpp +++ b/TCPServer.cpp @@ -444,8 +444,6 @@ void TCPServer::startGame() { return; } - - this->broadcastMessage("strat;arduino;angle;157\n"); isRobotMoving = 0; while (this->isRobotMoving < 3) { @@ -494,9 +492,41 @@ void TCPServer::startGame() { return; } + // got to jardinière + + this->broadcastMessage("strat;servo_moteur;lever bras;1\n"); + + std::string toSend = "strat;arduino;go;762,200\n"; + this->broadcastMessage(toSend); + isRobotMoving = 0; + while (this->isRobotMoving < 3) { + usleep(200'000); + this->broadcastMessage("strat;arduino;get state;1\n"); + } + usleep(500'000); + + this->broadcastMessage("strat;arduino;angle;0\n"); + isRobotMoving = 0; + while (this->isRobotMoving < 3) { + usleep(200'000); + this->broadcastMessage("strat;arduino;get state;1\n"); + } + usleep(500'000); + + this->broadcastMessage("strat;arduino;speed;130\n"); + this->broadcastMessage("strat;arduino;go;762,0\n"); + usleep(3'000'000); + + this->broadcastMessage("strat;servo_moteur;ouvrir pince;0\n"); + this->broadcastMessage("strat;servo_moteur;ouvrir pince;2\n"); 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("strat;servo_moteur;fermer pince;0\n"); + this->broadcastMessage("strat;servo_moteur;fermer pince;2\n"); + this->broadcastMessage("strat;servo_moteur;ouvrir pince;1\n"); + usleep(1'000'000); + + 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); isRobotMoving = 0; while (this->isRobotMoving < 3) {