|
16 | 16 | #include "autoware/behavior_path_planner_common/marker_utils/utils.hpp"
|
17 | 17 |
|
18 | 18 | #include <autoware/behavior_path_lane_change_module/utils/markers.hpp>
|
| 19 | +#include <autoware/universe_utils/geometry/geometry.hpp> |
19 | 20 | #include <autoware/universe_utils/ros/marker_helper.hpp>
|
20 | 21 | #include <autoware_lanelet2_extension/visualization/visualization.hpp>
|
21 | 22 |
|
@@ -185,6 +186,46 @@ MarkerArray showExecutionInfo(const Debug & debug_data, const geometry_msgs::msg
|
185 | 186 | return marker_array;
|
186 | 187 | }
|
187 | 188 |
|
| 189 | +MarkerArray ShowLaneChangeMetricsInfo( |
| 190 | + const Debug & debug_data, const geometry_msgs::msg::Pose & pose) |
| 191 | +{ |
| 192 | + MarkerArray marker_array; |
| 193 | + if (debug_data.lane_change_metrics.empty()) { |
| 194 | + return marker_array; |
| 195 | + } |
| 196 | + |
| 197 | + auto text_marker = createDefaultMarker( |
| 198 | + "map", rclcpp::Clock{RCL_ROS_TIME}.now(), "sampling_metrics", 0, Marker::TEXT_VIEW_FACING, |
| 199 | + createMarkerScale(0.6, 0.6, 0.6), colors::yellow()); |
| 200 | + text_marker.pose = autoware::universe_utils::calcOffsetPose(pose, 10.0, 15.0, 0.0); |
| 201 | + |
| 202 | + text_marker.text = fmt::format("{:<12}", "") + fmt::format("{:^18}|", "lat_accel[m/s2]") + |
| 203 | + fmt::format("{:^18}|", "lon_accel[m/s2]") + |
| 204 | + fmt::format("{:^17}|", "velocity[m/s]") + |
| 205 | + fmt::format("{:^15}|", "duration[s]") + fmt::format("{:^15}|", "length[m]") + |
| 206 | + fmt::format("{:^20}\n", "max_length_th[m]"); |
| 207 | + for (const auto & metrics : debug_data.lane_change_metrics) { |
| 208 | + text_marker.text += fmt::format("{:-<170}\n", ""); |
| 209 | + const auto & p_m = metrics.prep_metric; |
| 210 | + text_marker.text += |
| 211 | + fmt::format("{:<17}", "prep_metrics:") + fmt::format("{:^10.3f}", p_m.lat_accel) + |
| 212 | + fmt::format("{:^21.3f}", p_m.actual_lon_accel) + fmt::format("{:^12.3f}", p_m.velocity) + |
| 213 | + fmt::format("{:^15.3f}", p_m.duration) + fmt::format("{:^15.3f}", p_m.length) + |
| 214 | + fmt::format("{:^17.3f}\n", metrics.max_prepare_length); |
| 215 | + text_marker.text += fmt::format("{:<20}\n", "lc_metrics:"); |
| 216 | + for (const auto lc_m : metrics.lc_metrics) { |
| 217 | + text_marker.text += |
| 218 | + fmt::format("{:<15}", "") + fmt::format("{:^10.3f}", lc_m.lat_accel) + |
| 219 | + fmt::format("{:^21.3f}", lc_m.actual_lon_accel) + fmt::format("{:^12.3f}", lc_m.velocity) + |
| 220 | + fmt::format("{:^15.3f}", lc_m.duration) + fmt::format("{:^15.3f}", lc_m.length) + |
| 221 | + fmt::format("{:^17.3f}\n", metrics.max_lane_changing_length); |
| 222 | + } |
| 223 | + } |
| 224 | + |
| 225 | + marker_array.markers.push_back(text_marker); |
| 226 | + return marker_array; |
| 227 | +} |
| 228 | + |
188 | 229 | MarkerArray createDebugMarkerArray(
|
189 | 230 | const Debug & debug_data, const geometry_msgs::msg::Pose & ego_pose)
|
190 | 231 | {
|
@@ -212,6 +253,7 @@ MarkerArray createDebugMarkerArray(
|
212 | 253 | }
|
213 | 254 |
|
214 | 255 | add(showExecutionInfo(debug_data, ego_pose));
|
| 256 | + add(ShowLaneChangeMetricsInfo(debug_data, ego_pose)); |
215 | 257 |
|
216 | 258 | // lanes
|
217 | 259 | add(laneletsAsTriangleMarkerArray(
|
|
0 commit comments