From 0eeae36340de8e3b9508a681005fbc0f54f8e5a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20MARQUET?= Date: Wed, 24 Apr 2024 16:17:06 +0200 Subject: [PATCH 1/3] Add aructo tag broadcast --- TCPServer.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/TCPServer.cpp b/TCPServer.cpp index 255dc6d..790e4af 100644 --- a/TCPServer.cpp +++ b/TCPServer.cpp @@ -70,7 +70,7 @@ TCPServer::TCPServer(int port) std::cout << "Server started on port " << port << std::endl; - clients.reserve(6); + clients.reserve(7); ClientTCP tirette; tirette.name = "tirette"; @@ -89,12 +89,16 @@ TCPServer::TCPServer(int port) ClientTCP servo_moteur; servo_moteur.name = "servo_moteur"; + ClientTCP points; + points.name = "points"; + clients.push_back(tirette); clients.push_back(aruco); clients.push_back(ihm); clients.push_back(lidar); clients.push_back(arduino); clients.push_back(servo_moteur); + clients.push_back(points); } void TCPServer::acceptConnections() @@ -256,6 +260,9 @@ void TCPServer::handleMessage(const std::string& message, int clientSocket) tag.setRot(std::stof(aruco[i + 4]), std::stof(aruco[i + 5]), std::stof(aruco[i + 6])); handleArucoTag(tag); + + // Broadcast the aruco tag to all clients + this->broadcastMessage(message.c_str(), clientSocket); } } } From 9f3bd9a156d63a13971d95ea63fe2cdfd9a5c878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20MARQUET?= Date: Wed, 24 Apr 2024 16:46:46 +0200 Subject: [PATCH 2/3] Add aructo tag broadcast --- TCPServer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/TCPServer.cpp b/TCPServer.cpp index 790e4af..901cf63 100644 --- a/TCPServer.cpp +++ b/TCPServer.cpp @@ -260,10 +260,9 @@ void TCPServer::handleMessage(const std::string& message, int clientSocket) tag.setRot(std::stof(aruco[i + 4]), std::stof(aruco[i + 5]), std::stof(aruco[i + 6])); handleArucoTag(tag); - - // Broadcast the aruco tag to all clients - this->broadcastMessage(message.c_str(), clientSocket); } + // Broadcast the aruco tag to all clients + this->broadcastMessage(message.c_str(), clientSocket); } } else if (tokens[0] == "arduino") { From 019451babc76aad9817797ae37c7038e996de814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20MARQUET?= Date: Wed, 24 Apr 2024 16:50:01 +0200 Subject: [PATCH 3/3] Fix point bad naming --- TCPServer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TCPServer.cpp b/TCPServer.cpp index 901cf63..616da59 100644 --- a/TCPServer.cpp +++ b/TCPServer.cpp @@ -89,8 +89,8 @@ TCPServer::TCPServer(int port) ClientTCP servo_moteur; servo_moteur.name = "servo_moteur"; - ClientTCP points; - points.name = "points"; + ClientTCP point; + point.name = "point"; clients.push_back(tirette); clients.push_back(aruco); @@ -98,7 +98,7 @@ TCPServer::TCPServer(int port) clients.push_back(lidar); clients.push_back(arduino); clients.push_back(servo_moteur); - clients.push_back(points); + clients.push_back(point); } void TCPServer::acceptConnections()