Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pure_pursuit): return zero curvature when neighboring idx isn't found #2891

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,20 @@ 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 when backward distance is not long enough in the trajectory
return 0.0;
}

if (trajectory_resampled_->points.size() - 1 >= closest_idx + idx_dist) {
next_idx = closest_idx + idx_dist;
} else {
// return zero curvature when forward distance is not long enough in the trajectory
return 0.0;
}
// TODO(k.sugahara): shift the center point of the curvature calculation to allow sufficient
// distance, because if sufficient distance cannot be obtained in front or behind, the curvature
// will be zero in the current implementation.

// Calculate curvature assuming the trajectory points interval is constant
double current_curvature = 0.0;
Expand Down