Skip to content

Commit ea52340

Browse files
authored
revert (map_based_prediction): use linear interpolation for path conversion (autowarefoundation#8400)" (autowarefoundation#8417)
Revert "perf(map_based_prediction): use linear interpolation for path conversion (autowarefoundation#8400)" This reverts commit 147403f. Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
1 parent e9dcf99 commit ea52340

File tree

1 file changed

+8
-26
lines changed

1 file changed

+8
-26
lines changed

perception/autoware_map_based_prediction/src/map_based_prediction_node.cpp

+8-26
Original file line numberDiff line numberDiff line change
@@ -2402,15 +2402,9 @@ std::vector<PosePath> MapBasedPredictionNode::convertPathType(
24022402
continue;
24032403
}
24042404

2405-
const double dx = current_p.position.x - prev_p.position.x;
2406-
const double dy = current_p.position.y - prev_p.position.y;
2407-
const double sin_yaw_half = dy / (std::sqrt(dx * dx + dy * dy) + dx);
2408-
const double cos_yaw_half = std::sqrt(1 - sin_yaw_half * sin_yaw_half);
2409-
current_p.orientation.x = 0.0;
2410-
current_p.orientation.y = 0.0;
2411-
current_p.orientation.z = sin_yaw_half;
2412-
current_p.orientation.w = cos_yaw_half;
2413-
2405+
const double lane_yaw = std::atan2(
2406+
current_p.position.y - prev_p.position.y, current_p.position.x - prev_p.position.x);
2407+
current_p.orientation = autoware::universe_utils::createQuaternionFromYaw(lane_yaw);
24142408
converted_path.push_back(current_p);
24152409
prev_p = current_p;
24162410
}
@@ -2439,29 +2433,17 @@ std::vector<PosePath> MapBasedPredictionNode::convertPathType(
24392433
}
24402434
}
24412435

2442-
const double dx = current_p.position.x - prev_p.position.x;
2443-
const double dy = current_p.position.y - prev_p.position.y;
2444-
const double sin_yaw_half = dy / (std::sqrt(dx * dx + dy * dy) + dx);
2445-
const double cos_yaw_half = std::sqrt(1 - sin_yaw_half * sin_yaw_half);
2446-
current_p.orientation.x = 0.0;
2447-
current_p.orientation.y = 0.0;
2448-
current_p.orientation.z = sin_yaw_half;
2449-
current_p.orientation.w = cos_yaw_half;
2450-
2436+
const double lane_yaw = std::atan2(
2437+
current_p.position.y - prev_p.position.y, current_p.position.x - prev_p.position.x);
2438+
current_p.orientation = autoware::universe_utils::createQuaternionFromYaw(lane_yaw);
24512439
converted_path.push_back(current_p);
24522440
prev_p = current_p;
24532441
}
24542442
}
24552443

24562444
// Resample Path
2457-
const bool use_akima_spline_for_xy = true;
2458-
const bool use_lerp_for_z = true;
2459-
// the options use_akima_slpine_for_xy and use_lerp_for_z are set to true
2460-
// but the implementation of use_akima_slpine_for_xy in resamplePoseVector and
2461-
// resamplePointVector is opposite to the options so the options are set to true to use linear
2462-
// interpolation for xy
2463-
const auto resampled_converted_path = autoware::motion_utils::resamplePoseVector(
2464-
converted_path, reference_path_resolution_, use_akima_spline_for_xy, use_lerp_for_z);
2445+
const auto resampled_converted_path =
2446+
autoware::motion_utils::resamplePoseVector(converted_path, reference_path_resolution_);
24652447
converted_paths.push_back(resampled_converted_path);
24662448
}
24672449

0 commit comments

Comments
 (0)