Skip to content

Commit

Permalink
fix(pure_pursuit):return zero curvature when idx isn't found
Browse files Browse the repository at this point in the history
Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp>
  • Loading branch information
kyoichi-sugahara committed Feb 15, 2023
1 parent 4c6107a commit 1b29b9c
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,16 @@ double PurePursuitLateralController::calcCurvature(const size_t closest_idx)

if (static_cast<size_t>(closest_idx) >= idx_dist) {
prev_idx = closest_idx - idx_dist;
} else {
// return zero curvature because prev_idx can't be found
return 0.0;
}

if (trajectory_resampled_->points.size() - 1 >= closest_idx + idx_dist) {
next_idx = closest_idx + idx_dist;
} else {
// return zero curvature because next_idx can't be found
return 0.0;
}

// Calculate curvature assuming the trajectory points interval is constant
Expand Down

0 comments on commit 1b29b9c

Please sign in to comment.