2from eufs_msgs.msg
import ConeArrayWithCovariance, CarState
3from nav_msgs.msg
import Odometry
4from custom_interfaces.msg
import ConeArray, VehicleState, PathPointArray
10 format_cone_array_msg,
11 format_vehicle_state_msg,
12 format_eufs_cone_array_with_covariance_msg,
13 format_nav_odometry_msg,
15 format_path_point_array_msg,
16 get_blue_and_yellow_cones_after_msg_treatment,
23 Adapter class for subscribing to EUFS topics
28 Initializes the EUFS Adapter.
31 node (Node): ROS2 node instance.
38 self.
node.groundtruth_map_subscription_ = self.
node.create_subscription(
39 ConeArrayWithCovariance,
40 "/ground_truth/track",
45 self.
node.groundtruth_state_subscription_ = self.
node.create_subscription(
52 self.
node.simulated_state_subscription = self.
node.create_subscription(
54 "/odometry_integration/car_state",
61 self.
node.vehicle_state_subscription_,
62 self.
node.map_subscription_,
70 self.
node.groundtruth_perception_subscription_ = message_filters.Subscriber(
71 self.
node, ConeArrayWithCovariance,
"/ground_truth/cones"
75 self.
node.perception_subscription_,
76 self.
node.groundtruth_perception_subscription_,
86 self.
node.planning_subscription_,
87 self.
node.planning_gt_subscription_,
97 Callback function to mark the initial timestamp of the control execution
100 msg (CarState): Car state coming from EUFS simulator
106 vehicle_state: VehicleState,
110 Callback function to process synchronized messages and compute state estimation metrics.
113 vehicle_state (VehicleState): Vehicle state estimation message.
114 map (ConeArray): Cone array message.
122 pose_treated, velocities_treated = format_vehicle_state_msg(vehicle_state)
123 map_treated: np.ndarray = format_cone_array_msg(map)
124 groundtruth_pose_treated, groundtruth_velocity_treated = (
127 groundtruth_map_treated: np.ndarray = (
130 self.
node.compute_and_publish_state_estimation(
132 groundtruth_pose_treated,
134 groundtruth_velocity_treated,
136 groundtruth_map_treated,
140 self, perception_output: ConeArray, ground_truth: ConeArrayWithCovariance
143 Callback function to process synchronized messages and compute perception metrics.
146 perception_output (ConeArray): Perception Output.
149 perception_treated: np.ndarray = format_cone_array_msg(perception_output)
151 groundtruth_perception_treated: np.ndarray = (
152 format_eufs_cone_array_with_covariance_msg(ground_truth)
155 self.
node.compute_and_publish_perception(
156 perception_treated, groundtruth_perception_treated
161 planning_output: PathPointArray,
162 path_ground_truth: PathPointArray,
165 Callback function to process synchronized messages and compute planning metrics.
168 map_ground_truth (ConeArrayWithCovariance): Groundtruth map message.
169 planning_output (PathPointArray): Planning output.
170 path_ground_truth (PathPointArray): Groundtruth path message.
174 map_ground_truth_treated: np.ndarray = (
177 self.
node.get_logger().debug(
178 "treated gt with size: %d" % len(map_ground_truth_treated)
180 blue_cones, yellow_cones = get_blue_and_yellow_cones_after_msg_treatment(
181 map_ground_truth_treated
183 self.
node.get_logger().debug(
184 "n blue cones: %d; n yellow cones : %d"
185 % (len(blue_cones), len(yellow_cones))
187 planning_output_treated: np.ndarray = format_path_point_array_msg(
190 path_ground_truth_treated: np.ndarray = format_path_point_array_msg(
193 self.
node.compute_and_publish_planning(
194 planning_output_treated, path_ground_truth_treated, blue_cones, yellow_cones
199 Callback function to process groundtruth map messages.
202 track (ConeArrayWithCovariance): Groundtruth track data.
204 self.
node.get_logger().debug(
205 "Received groundtruth map with size: %d" % len(track.blue_cones)
211 Callback function to process groundtruth vehicle_state messages.
214 vehicle_state (Odometry): Groundtruth vehicle_state data.
216 self.
node.get_logger().debug(
"Received groundtruth vehicle state")
218 if self.
node.use_simulated_se_:
219 self.
node.position = [
220 vehicle_state.pose.pose.position.x,
221 vehicle_state.pose.pose.position.y,
224 if self.
node.use_simulated_velocities_:
225 self.
node.absolute_velocity = sqrt(
226 vehicle_state.twist.twist.linear.x**2
227 + vehicle_state.twist.twist.linear.y**2
Class for subscribing to a point cloud topic and synchronizing messages with a ROS2 node.
Adapter class for subscribing to EUFS topics.
perception_callback(self, ConeArray perception_output, ConeArrayWithCovariance ground_truth)
Callback function to process synchronized messages and compute perception metrics.
groundtruth_map_callback(self, ConeArrayWithCovariance track)
Callback function to process groundtruth map messages.
simulated_vehicle_state_callback
simulated_vehicle_state_callback(self, CarState msg)
Callback function to mark the initial timestamp of the control execution.
state_estimation_callback(self, VehicleState vehicle_state, ConeArray map)
Callback function to process synchronized messages and compute state estimation metrics.
groundtruth_vehicle_state_
groundtruth_vehicle_state_callback(self, Odometry vehicle_state)
Callback function to process groundtruth vehicle_state messages.
groundtruth_vehicle_state_callback
planning_callback(self, PathPointArray planning_output, PathPointArray path_ground_truth)
Callback function to process synchronized messages and compute planning metrics.
__init__(self, rclpy.node.Node node)
Initializes the EUFS Adapter.
state_estimation_callback