From 16e19c7ce585ec44a243d8a6b2a9d4da407e18ce Mon Sep 17 00:00:00 2001 From: kobayu858 <129580202+kobayu858@users.noreply.github.com> Date: Thu, 18 Jul 2024 10:30:52 +0900 Subject: [PATCH] fix(autoware_velocity_smoother): fix shadowVariablefix:shadowVariable (#7950) fix:shadowVariable Signed-off-by: kobayu858 --- .../analytical_jerk_constrained_smoother.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/planning/autoware_velocity_smoother/src/smoother/analytical_jerk_constrained_smoother/analytical_jerk_constrained_smoother.cpp b/planning/autoware_velocity_smoother/src/smoother/analytical_jerk_constrained_smoother/analytical_jerk_constrained_smoother.cpp index 3906222454d35..3a6bc736c96ab 100644 --- a/planning/autoware_velocity_smoother/src/smoother/analytical_jerk_constrained_smoother/analytical_jerk_constrained_smoother.cpp +++ b/planning/autoware_velocity_smoother/src/smoother/analytical_jerk_constrained_smoother/analytical_jerk_constrained_smoother.cpp @@ -374,14 +374,14 @@ TrajectoryPoints AnalyticalJerkConstrainedSmoother::applyLateralAccelerationFilt for (size_t i = 0; i < output.size(); ++i) { for (const auto & lat_acc_filtered_range : latacc_filtered_ranges) { - const size_t start_index = std::get<0>(lat_acc_filtered_range); - const size_t end_index = std::get<1>(lat_acc_filtered_range); - const double min_latacc_velocity = std::get<2>(lat_acc_filtered_range); + const size_t filtered_start_index = std::get<0>(lat_acc_filtered_range); + const size_t filtered_end_index = std::get<1>(lat_acc_filtered_range); + const double filtered_min_latacc_velocity = std::get<2>(lat_acc_filtered_range); if ( - start_index <= i && i <= end_index && + filtered_start_index <= i && i <= filtered_end_index && smoother_param_.latacc.enable_constant_velocity_while_turning) { - output.at(i).longitudinal_velocity_mps = min_latacc_velocity; + output.at(i).longitudinal_velocity_mps = filtered_min_latacc_velocity; break; } } @@ -415,15 +415,15 @@ bool AnalyticalJerkConstrainedSmoother::searchDecelTargetIndices( } if (!tmp_indices.empty()) { - for (unsigned int i = 0; i < tmp_indices.size() - 1; ++i) { + for (unsigned int j = 0; j < tmp_indices.size() - 1; ++j) { const size_t index_err = 10; if ( - (tmp_indices.at(i + 1).first - tmp_indices.at(i).first < index_err) && - (tmp_indices.at(i + 1).second < tmp_indices.at(i).second)) { + (tmp_indices.at(j + 1).first - tmp_indices.at(j).first < index_err) && + (tmp_indices.at(j + 1).second < tmp_indices.at(j).second)) { continue; } - decel_target_indices.emplace_back(tmp_indices.at(i).first, tmp_indices.at(i).second); + decel_target_indices.emplace_back(tmp_indices.at(j).first, tmp_indices.at(j).second); } } if (!tmp_indices.empty()) {