30 """Load ground truth data from a file, skipping the header line and assigning each point a label.
33 file_path (str): The path to the file containing ground truth data.
34 label (str): The label to assign to the points.
35 Returns: ground_truth_data (list): A list of tuples containing the x, y coordinates and label of each point.
37 ground_truth_data = []
39 with open(file_path,
"r")
as file:
42 x, y = map(float, line.strip().split()[:2])
43 ground_truth_data.append((x, y, label))
44 self.get_logger().info(f
"Loaded ground truth data for {label}.")
45 except Exception
as e:
46 self.get_logger().error(
47 f
"Failed to load ground truth data for {label}: {e}"
49 return ground_truth_data
52 """Publish the combined ground truth data as a single MarkerArray message.
57 marker_array = MarkerArray()
62 marker.header.frame_id =
"map"
63 marker.type = Marker.CYLINDER
64 marker.action = Marker.ADD
65 marker.id = id_counter
66 marker.pose.position.x = x
67 marker.pose.position.y = y
68 marker.pose.position.z = 0.5
83 marker_array.markers.append(marker)
87 self.get_logger().info(
"Published combined ground truth data as MarkerArray.")