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 2 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,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
taikitanaka3 marked this conversation as resolved.
Show resolved Hide resolved
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kyoichi-sugahara
IMO
I think it's better to use prev_idx and next_idx a certain distance far from closest_idx with threshold.
What do you think?

 prev_index,<--->closest index <--->next_idx

Copy link
Contributor Author

@kyoichi-sugahara kyoichi-sugahara Feb 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taikitanaka3
I think your proposal method is expected behavior in the current implementation

return 0.0;
}

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