Skip to content

Commit fcdd0f1

Browse files
add a sanity check if the path is empty
Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
1 parent c24c3b0 commit fcdd0f1

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

planning/behavior_path_start_planner_module/include/behavior_path_start_planner_module/pull_out_planner_base.hpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,14 @@ class PullOutPlannerBase
8383
utils::path_safety_checker::filterObjectsByClass(
8484
pull_out_lane_stop_objects, parameters_.object_types_to_check_for_path_generation);
8585

86-
return utils::checkCollisionBetweenPathFootprintsAndObjects(
87-
vehicle_footprint_,
86+
const auto collision_check_section_path =
8887
behavior_path_planner::start_planner_utils::extractCollisionCheckSection(
89-
pull_out_path, collision_check_distance_from_end),
90-
pull_out_lane_stop_objects, collision_check_margin_);
88+
pull_out_path, collision_check_distance_from_end);
89+
if (!collision_check_section_path) return true;
90+
91+
return utils::checkCollisionBetweenPathFootprintsAndObjects(
92+
vehicle_footprint_, collision_check_section_path.value(), pull_out_lane_stop_objects,
93+
collision_check_margin_);
9194
};
9295
std::shared_ptr<const PlannerData> planner_data_;
9396
vehicle_info_util::VehicleInfo vehicle_info_;

planning/behavior_path_start_planner_module/include/behavior_path_start_planner_module/util.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ lanelet::ConstLanelets getPullOutLanes(
5151
const std::shared_ptr<const PlannerData> & planner_data, const double backward_length);
5252
Pose getBackedPose(
5353
const Pose & current_pose, const double & yaw_shoulder_lane, const double & back_distance);
54-
PathWithLaneId extractCollisionCheckSection(
54+
std::optional<PathWithLaneId> extractCollisionCheckSection(
5555
const PullOutPath & path, const double collision_check_distance_from_end);
5656
} // namespace behavior_path_planner::start_planner_utils
5757

planning/behavior_path_start_planner_module/src/util.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ lanelet::ConstLanelets getPullOutLanes(
104104
/*forward_only_in_route*/ true);
105105
}
106106

107-
PathWithLaneId extractCollisionCheckSection(
107+
std::optional<PathWithLaneId> extractCollisionCheckSection(
108108
const PullOutPath & path, const double collision_check_distance_from_end)
109109
{
110110
PathWithLaneId full_path;
@@ -113,6 +113,7 @@ PathWithLaneId extractCollisionCheckSection(
113113
full_path.points.end(), partial_path.points.begin(), partial_path.points.end());
114114
}
115115

116+
if (full_path.points.empty()) return std::nullopt;
116117
// Find the start index for collision check section based on the shift start pose
117118
const auto shift_start_idx =
118119
motion_utils::findNearestIndex(full_path.points, path.start_pose.position);

0 commit comments

Comments
 (0)