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(autoware_behavior_path_planner_common): fix containerOutOfBounds warning #7675

Merged
merged 3 commits into from
Jun 25, 2024
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 @@ -471,14 +471,15 @@ std::vector<Pose> interpolatePose(
{
std::vector<Pose> interpolated_poses{}; // output

const std::vector<double> base_s{
0, autoware::universe_utils::calcDistance2d(start_pose.position, end_pose.position)};
const double distance =
autoware::universe_utils::calcDistance2d(start_pose.position, end_pose.position);
const std::vector<double> base_s{0.0, distance};
const std::vector<double> base_x{start_pose.position.x, end_pose.position.x};
const std::vector<double> base_y{start_pose.position.y, end_pose.position.y};
std::vector<double> new_s;

constexpr double eps = 0.3; // prevent overlapping
for (double s = eps; s < base_s.back() - eps; s += resample_interval) {
for (double s = eps; s < distance - eps; s += resample_interval) {
new_s.push_back(s);
}

Expand All @@ -491,7 +492,7 @@ std::vector<Pose> interpolatePose(
for (size_t i = 0; i < interpolated_x.size(); ++i) {
Pose pose{};
pose = autoware::universe_utils::calcInterpolatedPose(
end_pose, start_pose, (base_s.back() - new_s.at(i)) / base_s.back());
end_pose, start_pose, (distance - new_s.at(i)) / distance);
pose.position.x = interpolated_x.at(i);
pose.position.y = interpolated_y.at(i);
pose.position.z = end_pose.position.z;
Expand Down
Loading