提交 6bdab90f 编写于 作者: Y Yajia Zhang 提交者: Kecheng Xu

prediction: bug fix in ValidationChecker; minor code refactor

上级 ab13defe
......@@ -33,8 +33,8 @@ double ValidationChecker::ProbabilityByCentripetalAcceleration(
double centripetal_acc_cost_sum = 0.0;
double centripetal_acc_cost_sqr_sum = 0.0;
for (int i = 0; i < lane_sequence.path_point_size(); ++i) {
const PathPoint& path_point = lane_sequence.path_point(i);
double centripetal_acc = speed * speed * path_point.kappa();
const auto& path_point = lane_sequence.path_point(i);
double centripetal_acc = speed * speed * std::fabs(path_point.kappa());
double centripetal_acc_cost =
centripetal_acc / FLAGS_centripedal_acc_threshold;
centripetal_acc_cost_sum += centripetal_acc_cost;
......@@ -47,12 +47,8 @@ double ValidationChecker::ProbabilityByCentripetalAcceleration(
bool ValidationChecker::ValidCentripetalAcceleration(
const std::vector<TrajectoryPoint>& trajectory_points) {
std::size_t num_point = trajectory_points.size();
if (num_point < 2) {
return true;
}
double max_centripedal_acc = 0.0;
for (std::size_t i = 0; i + 1 < num_point; ++i) {
double max_centripetal_acc = 0.0;
for (auto i = 0; i + 1 < trajectory_points.size(); ++i) {
const auto& first_point = trajectory_points[i];
const auto& second_point = trajectory_points[i + 1];
double theta_diff = std::abs(common::math::NormalizeAngle(
......@@ -63,11 +59,11 @@ bool ValidationChecker::ValidCentripetalAcceleration(
if (time_diff < FLAGS_double_precision) {
continue;
}
double v = (first_point.v() + second_point.v()) / 2.0;
double v = (first_point.v() + second_point.v()) * 0.5;
double centripedal_acc = v * theta_diff / time_diff;
max_centripedal_acc = std::max(max_centripedal_acc, centripedal_acc);
max_centripetal_acc = std::max(max_centripetal_acc, centripedal_acc);
}
return max_centripedal_acc < FLAGS_centripedal_acc_threshold;
return max_centripetal_acc < FLAGS_centripedal_acc_threshold;
}
bool ValidationChecker::ValidTrajectoryPoint(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册