diff --git a/App/RobobinApp/Networking/WifiManager.cs b/App/RobobinApp/Networking/WifiManager.cs index ac5bd3c69e975b6ef4b56eb928f4b4ad67b73172..18631f5bcafeae5b79d1268b11fb0030f03a37e9 100644 --- a/App/RobobinApp/Networking/WifiManager.cs +++ b/App/RobobinApp/Networking/WifiManager.cs @@ -227,7 +227,7 @@ namespace RobobinApp.Networking Debug.WriteLine("Connected to Robobin via TCP."); _isConnected = true; - await SendMessageAsync("REQMAP"); + //await SendMessageAsync("REQMAP"); Task.Run(() => ReceiveMessages()); diff --git a/App/RobobinApp/ViewModels/MainPageViewModel.cs b/App/RobobinApp/ViewModels/MainPageViewModel.cs index 52c0b7a0a103657e6e347fe8bc27474382fb4c05..8ccf149179380ed3fe5385e70a3919b0e9e2a500 100644 --- a/App/RobobinApp/ViewModels/MainPageViewModel.cs +++ b/App/RobobinApp/ViewModels/MainPageViewModel.cs @@ -98,7 +98,7 @@ namespace RobobinApp.ViewModels private async Task GetNewGraph() { - await App.WifiManager.SendMessageAsync("REQMAP"); + return; } public static (float magnitude, float angle)[,] CalculatePolarConnections(List<Node> nodes, bool[,] connections) diff --git a/ros2/src/robobin/launch/robobin_no_components_launch.py b/ros2/src/robobin/launch/robobin_no_components_launch.py index cea865161157a7774fe733c787e51c92bebf4c1b..256a27f2f2d540e35184bda41537ab77063672db 100644 --- a/ros2/src/robobin/launch/robobin_no_components_launch.py +++ b/ros2/src/robobin/launch/robobin_no_components_launch.py @@ -13,14 +13,7 @@ def generate_launch_description(): emulate_tty=True ), - - Node( - package='robobin', - executable='uwb_navigation_node', - name='uwb_navigation_node', - output='screen', - emulate_tty=True - ), + Node( package='robobin', executable='motor_control_node', diff --git a/ros2/src/robobin/robobin/api_node.py b/ros2/src/robobin/robobin/api_node.py index 2f05d1383f0a274db9a4acb2b07ff8bc21362cf9..eff4027cf762d20929f94170b7d741448a9e57d5 100644 --- a/ros2/src/robobin/robobin/api_node.py +++ b/ros2/src/robobin/robobin/api_node.py @@ -51,46 +51,14 @@ class ApiNode(Node): if self.mode == "Call": if len(self.called_locations) > 0: self.get_logger().info("Handling queue operations...") - start_node = self.getNearestNode(self.connection_manager.location) client_socket, end_location = self.called_locations[0] - self.get_logger().info(f"(Start Node: {start_node}, End Location: {end_location})") + self.get_logger().info(f" End Location: {end_location})") # self.get_logger().info(f"Sending location: {end_location}") - self.publisher_topics["nav_command"].publish(String(data="CALL " + start_node + " " + end_location)) + - def getNearestNode(self, location): - """ - Return the name of the node nearest to the given (x, y) location. - """ - workspace_root = os.getcwd() # Current working directory - self.get_logger().info(f"Workspace root: {workspace_root}") - graph_file_path = os.path.abspath(os.path.join(workspace_root, "src", "robobin", "robobin", "graphs", "graph.json")) - self.get_logger().info(f"Graph file path: {graph_file_path}") - if not os.path.exists(graph_file_path): - self.get_logger().error(f"Graph file not found at: {graph_file_path}") - return None - - x_loc, y_loc = location - try: - with open(graph_file_path, 'r') as f: - graph_data = json.load(f) - - closest_node_name = None - closest_distance = float('inf') - - for node in graph_data["nodes"]: - x_node = node["x"] - y_node = node["y"] - dist = math.sqrt((x_node - x_loc)**2 + (y_node - y_loc)**2) - if dist < closest_distance: - closest_distance = dist - closest_node_name = node["name"] - - return closest_node_name - except Exception as e: - self.get_logger().error(f"Failed to determine nearest node: {str(e)}") - return None + def handle_client_connection(self, client_socket): """Handles incoming TCP client connections.""" try: diff --git a/ros2/src/robobin/robobin/helpers/connection_manager.py b/ros2/src/robobin/robobin/helpers/connection_manager.py index a2498443aada764e8130e516640e070c90e93bc1..769a59694a6810ddbef17a495d803733c9653fe6 100644 --- a/ros2/src/robobin/robobin/helpers/connection_manager.py +++ b/ros2/src/robobin/robobin/helpers/connection_manager.py @@ -69,8 +69,8 @@ class ConnectionManager: # Send the JSON message over UDP sock.sendto(json_message, (self.UDP_IP, self.UDP_PORT)) - self.api_node.get_logger().info("Broadcasting JSON presence.") - self.api_node.get_logger().info(f"Location: {self.location}, Mode: {mode}") + # self.api_node.get_logger().info("Broadcasting JSON presence.") + # self.api_node.get_logger().info(f"Location: {self.location}, Mode: {mode}") time.sleep(0.5) except OSError: break