6from custom_interfaces.msg
import ConeArray, PathPointArray, Pose, Velocities
7from visualization_msgs.msg
import MarkerArray
8from pacsim.msg
import PerceptionDetections
9from geometry_msgs.msg
import TwistWithCovarianceStamped, TransformStamped
11 format_vehicle_pose_msg,
12 format_velocities_msg,
13 format_cone_array_msg,
14 format_transform_stamped_msg,
15 format_twist_with_covariance_stamped_msg,
16 format_marker_array_msg,
17 format_path_point_array_msg,
18 get_blue_and_yellow_cones_after_msg_treatment,
24 Adapter class to manage the use of Pacsim.
29 Initializes the PacSim Adapter.
32 node (Node): ROS2 node instance.
36 self.node.groundtruth_map_subscription_ = self.node.create_subscription(
43 self.node.velocities_subscription_ = self.node.create_subscription(
45 "/state_estimation/velocities",
51 self.node.velocities_groundtruth_subscription_ = self.node.create_subscription(
52 TwistWithCovarianceStamped,
59 self.node.pose_groundtruth_subscription_ = self.node.create_subscription(
60 TwistWithCovarianceStamped,
81 self.node.planning_subscription_,
82 self.node.planning_gt_subscription_,
92 Callback function to process map messages.
95 map (ConeArray): Map data.
98 self.node.get_logger().warn(
"Groundtruth map not received")
100 map_treated: np.ndarray = format_cone_array_msg(map)
101 groundtruth_map_treated: np.ndarray = format_marker_array_msg(
104 self.node.compute_and_publish_map(
106 groundtruth_map_treated,
111 Callback function to process vehicle pose messages.
114 vehicle_pose (Pose): Vehicle pose data.
117 self.node.get_logger().warn(
"Groundtruth pose not received")
120 groundtruth_pose_treated: np.ndarray = format_twist_with_covariance_stamped_msg(
123 pose_treated: np.ndarray = format_vehicle_pose_msg(vehicle_pose)
124 self.node.compute_and_publish_pose(
126 groundtruth_pose_treated,
131 velocities: Velocities,
134 Callback function to process synchronized messages
135 and compute state estimation metrics.
138 velocities (Velocities): Vehicle velocities estimation data.
142 self.node.get_logger().warn(
"Groundtruth velocity not received")
145 groundtruth_velocities_treated: np.ndarray = (
148 velocities_treated = format_velocities_msg(velocities)
149 self.node.compute_and_publish_velocities(
151 groundtruth_velocities_treated,
156 planning_output: PathPointArray,
157 path_ground_truth: PathPointArray,
160 Callback function to process synchronized messages and compute planning metrics.
163 planning_output (PathPointArray): Planning output.
164 path_ground_truth (PathPointArray): Groundtruth path message.
168 map_ground_truth_treated: np.ndarray = format_marker_array_msg(
171 blue_cones, yellow_cones = get_blue_and_yellow_cones_after_msg_treatment(
172 map_ground_truth_treated
174 planning_output_treated: np.ndarray = format_path_point_array_msg(
177 path_ground_truth_treated: np.ndarray = format_path_point_array_msg(
180 self.node.compute_and_publish_planning(
181 planning_output_treated,
182 path_ground_truth_treated,
189 Callback function to process ground truth map messages.
190 It also marks the planning's initial timestamp
193 groundtruth_map (MarkerArray): Ground truth map data.
198 self, groundtruth_velocity: TwistWithCovarianceStamped
201 Callback function to process ground truth velocity messages.
204 groundtruth_velocity (TwistWithCovarianceStamped): Ground truth velocity data.
207 if self.node.use_simulated_velocities_:
208 self.node.absolute_velocity = (
215 Callback function to process ground truth pose messages.
218 groundtruth_pose (TwistWithCovarianceStamped): Ground truth pose data.
221 if self.node.use_simulated_se_:
222 self.node.position = [
223 groundtruth_pose.twist.twist.linear.x,
224 groundtruth_pose.twist.twist.linear.y,
Class for subscribing to a point cloud topic and synchronizing messages with a ROS2 node.
Adapter class to manage the use of Pacsim.
groundtruth_velocity_callback(self, TwistWithCovarianceStamped groundtruth_velocity)
Callback function to process ground truth velocity messages.
groundtruth_pose_callback(self, TwistWithCovarianceStamped groundtruth_pose)
Callback function to process ground truth pose messages.
planning_callback(self, PathPointArray planning_output, PathPointArray path_ground_truth)
Callback function to process synchronized messages and compute planning metrics.
groundtruth_map_callback(self, MarkerArray groundtruth_map)
Callback function to process ground truth map messages.
groundtruth_velocity_callback
__init__(self, rclpy.node.Node node)
Initializes the PacSim Adapter.
map_callback(self, ConeArray map)
Callback function to process map messages.
groundtruth_pose_callback
velocities_callback(self, Velocities velocities)
Callback function to process synchronized messages and compute state estimation metrics.
pose_callback(self, Pose vehicle_pose)
Callback function to process vehicle pose messages.