From 0cc45ae1783a4dc71e01d90c074086cf3c94e281 Mon Sep 17 00:00:00 2001 From: Ryuta Kambe Date: Thu, 27 Jun 2024 13:47:30 +0900 Subject: [PATCH] fix(obstacle_stop_planner): fix unreadVariable warning (#7626) Signed-off-by: Ryuta Kambe --- .../src/adaptive_cruise_control.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/planning/obstacle_stop_planner/src/adaptive_cruise_control.cpp b/planning/obstacle_stop_planner/src/adaptive_cruise_control.cpp index e9058f234e98f..1ab368b6f2a8d 100644 --- a/planning/obstacle_stop_planner/src/adaptive_cruise_control.cpp +++ b/planning/obstacle_stop_planner/src/adaptive_cruise_control.cpp @@ -639,14 +639,11 @@ double AdaptiveCruiseController::calcTargetVelocity_D( return 0.0; } - double add_vel_d = 0; - - add_vel_d = diff_vel; + double add_vel_d = diff_vel; if (add_vel_d >= 0) { - diff_vel *= param_.d_coeff_pos; - } - if (add_vel_d < 0) { - diff_vel *= param_.d_coeff_neg; + add_vel_d *= param_.d_coeff_pos; + } else { + add_vel_d *= param_.d_coeff_neg; } add_vel_d = boost::algorithm::clamp(add_vel_d, -param_.d_max_vel_norm, param_.d_max_vel_norm);