Skip to content

Commit 13ea8ae

Browse files
authored
fix(autoware_planning_evaluator): sort predicted paths (#12034)
fix predicted path sorting bug Signed-off-by: Kem (TiankuiXian) <temkei.kem@tier4.jp>
1 parent d0730c3 commit 13ea8ae

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

evaluator/autoware_planning_evaluator/src/obstacle_metrics_calculator.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,12 @@ void ObstacleMetricsCalculator::ProcessObstaclesTrajectory()
246246
obstacle_trajectory_points_.emplace_back(obstacle_pose, obstacle_velocity, ego_time, 0.0);
247247
}
248248
} else {
249-
// Create obstacle trajectory points based on the predicted path.
250-
const auto & obstacle_path = object.kinematics.predicted_paths.front().path;
249+
// Create obstacle trajectory points based on the predicted path with highest confidence.
250+
const auto & predicted_paths = object.kinematics.predicted_paths;
251+
auto max_confidence_iter = std::max_element(
252+
predicted_paths.begin(), predicted_paths.end(),
253+
[](const auto & a, const auto & b) { return a.confidence < b.confidence; });
254+
const auto & obstacle_path = max_confidence_iter->path;
251255

252256
// initialize reference point and the point right after next reference point. Here
253257
// `reference_point` is the point right before the current ego trajectory point.

0 commit comments

Comments
 (0)