diff --git a/TCPServer.cpp b/TCPServer.cpp index 380a1d0..c151d30 100644 --- a/TCPServer.cpp +++ b/TCPServer.cpp @@ -363,13 +363,13 @@ void TCPServer::goToAruco(const ArucoTagPos &arucoTagPos, const int pince) { this->broadcastMessage(toSend); - double xPrime = arucoTagPos.pos.first[0] - 5; + double xPrime = arucoTagPos.pos.first[0] - 105; double yPrime = arucoTagPos.pos.first[1]; std::cout << "Aruco position1 " << xPrime << " " << yPrime << std::endl; - double posV200X = ((xPrime - 100) * std::cos(theta) + (yPrime - decalage) * std::sin(theta)) + robotPosX; - double posV200Y = (-(xPrime - 100) * std::sin(theta) + (yPrime - decalage) * std::cos(theta)) + robotPosY; + double posV200X = (xPrime * std::cos(theta) + (yPrime - decalage) * std::sin(theta)) + robotPosX; + double posV200Y = (-xPrime * std::sin(theta) + (yPrime - decalage) * std::cos(theta)) + robotPosY; toSend = "strat;arduino;go;" + std::to_string(static_cast(posV200X)) + "," + std::to_string(static_cast(posV200Y)) + "\n"; this->broadcastMessage(toSend); @@ -377,6 +377,8 @@ void TCPServer::goToAruco(const ArucoTagPos &arucoTagPos, const int pince) { this->broadcastMessage("strat;arduino;speed;150\n"); usleep(500'000); + xPrime += 100; + double robotPosForPotX = (xPrime * std::cos(theta) + (yPrime - decalage) * std::sin(theta)) + robotPosX; double robotPosForPotY = (-xPrime * std::sin(theta) + (yPrime - decalage) * std::cos(theta)) + robotPosY;