Skip to content

Commit 3ae0b00

Browse files
authoredJul 11, 2023
fix(behavior_path_planner): fix sampling warning (#4216)
* fix(behavior_path_planner): fix sampling warning Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * update Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> --------- Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com>
1 parent 796bbf8 commit 3ae0b00

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎planning/behavior_path_planner/src/utils/path_utils.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,17 @@ PathWithLaneId resamplePathWithSpline(
108108

109109
std::vector<double> s_out = s_in;
110110

111+
// sampling from interval distance
111112
const auto start_s = std::max(target_section.first, 0.0);
112113
const auto end_s = std::min(target_section.second, s_vec.back());
113114
for (double s = start_s; s < end_s; s += interval) {
114115
if (!find_almost_same_values(s_out, s)) {
115116
s_out.push_back(s);
116117
}
117118
}
119+
if (!find_almost_same_values(s_out, end_s)) {
120+
s_out.push_back(end_s);
121+
}
118122

119123
// Insert Stop Point
120124
const auto closest_stop_dist = motion_utils::calcDistanceToForwardStopPoint(transformed_path);
@@ -133,7 +137,8 @@ PathWithLaneId resamplePathWithSpline(
133137
}
134138
}
135139

136-
if (s_out.empty()) {
140+
// spline resample required more than 2 points for yaw angle calculation
141+
if (s_out.size() < 2) {
137142
return path;
138143
}
139144

0 commit comments

Comments
 (0)
Please sign in to comment.