diff --git a/control/autoware_pid_longitudinal_controller/src/pid_longitudinal_controller.cpp b/control/autoware_pid_longitudinal_controller/src/pid_longitudinal_controller.cpp index 96e2796a91d22..7c1c0ec494ced 100644 --- a/control/autoware_pid_longitudinal_controller/src/pid_longitudinal_controller.cpp +++ b/control/autoware_pid_longitudinal_controller/src/pid_longitudinal_controller.cpp @@ -477,6 +477,7 @@ PidLongitudinalController::ControlData PidLongitudinalController::getControlData control_data.interpolated_traj.points.insert( control_data.interpolated_traj.points.begin() + current_interpolated_pose.second + 1, current_interpolated_pose.first); + control_data.nearest_idx = current_interpolated_pose.second + 1; control_data.target_idx = control_data.nearest_idx; const auto nearest_point = current_interpolated_pose.first; @@ -507,6 +508,8 @@ PidLongitudinalController::ControlData PidLongitudinalController::getControlData // calculate the target motion for delay compensation constexpr double min_running_dist = 0.01; if (control_data.state_after_delay.running_distance > min_running_dist) { + control_data.interpolated_traj.points = + autoware::motion_utils::removeOverlapPoints(control_data.interpolated_traj.points); const auto target_pose = longitudinal_utils::findTrajectoryPoseAfterDistance( control_data.nearest_idx, control_data.state_after_delay.running_distance, control_data.interpolated_traj);