Skip to content

Commit 2e41fe1

Browse files
committed
underflow check
Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp>
1 parent 9e76436 commit 2e41fe1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

planning/behavior_velocity_no_stopping_area_module/src/scene_no_stopping_area.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ boost::optional<LineString2d> NoStoppingAreaModule::getStopLineGeometry2d(
7878
* ---------------
7979
**/
8080

81+
if (path.points.size() == 0) {
82+
return {};
83+
}
84+
8185
for (const auto & no_stopping_area : no_stopping_area_reg_elem_.noStoppingAreas()) {
8286
const auto & area_poly = lanelet::utils::to2D(no_stopping_area).basicPolygon();
8387
lanelet::BasicLineString2d path_line;
@@ -254,6 +258,10 @@ bool NoStoppingAreaModule::checkStopLinesInNoStoppingArea(
254258
{
255259
const double stop_vel = std::numeric_limits<float>::min();
256260
// stuck points by stop line
261+
if (path.points.size() == 0) {
262+
return false;
263+
}
264+
257265
for (size_t i = 0; i < path.points.size() - 1; ++i) {
258266
const auto p0 = path.points.at(i).point.pose.position;
259267
const auto p1 = path.points.at(i + 1).point.pose.position;
@@ -290,6 +298,10 @@ Polygon2d NoStoppingAreaModule::generateEgoNoStoppingAreaLanePolygon(
290298
return ego_area;
291299
}
292300
auto & pp = interpolated_path.points;
301+
if (pp.size() == 0) {
302+
return ego_area;
303+
}
304+
293305
/* calc closest index */
294306
const auto closest_idx_opt =
295307
motion_utils::findNearestIndex(interpolated_path.points, ego_pose, 3.0, M_PI_4);

0 commit comments

Comments
 (0)