Skip to content

Commit 4eef2c7

Browse files
committed
feat(goal_planner): ensure stop while path candidates are empty (autowarefoundation#10101)
Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp>
1 parent 6efa878 commit 4eef2c7

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/include/autoware/behavior_path_goal_planner_module/goal_searcher.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class GoalSearcher
4949

5050
// todo(kosuke55): Functions for this specific use should not be in the interface,
5151
// so it is better to consider interface design when we implement other goal searchers.
52-
GoalCandidate getClosetGoalCandidateAlongLanes(
52+
std::optional<GoalCandidate> getClosestGoalCandidateAlongLanes(
5353
const GoalCandidates & goal_candidates,
5454
const std::shared_ptr<const PlannerData> & planner_data) const;
5555
bool isSafeGoalWithMarginScaleFactor(

planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/goal_planner_module.cpp

+18-8
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,9 @@ BehaviorModuleOutput GoalPlannerModule::planPullOverAsCandidate(
14641464

14651465
// if pull over path candidates generation is not finished, use previous module output
14661466
if (context_data.lane_parking_response.pull_over_path_candidates.empty()) {
1467-
return getPreviousModuleOutput();
1467+
auto stop_path = getPreviousModuleOutput();
1468+
stop_path.path = generateStopPath(context_data, detail);
1469+
return stop_path;
14681470
}
14691471

14701472
BehaviorModuleOutput output{};
@@ -1735,11 +1737,13 @@ PathWithLaneId GoalPlannerModule::generateStopPath(
17351737
// calculate search start offset pose from the closest goal candidate pose with
17361738
// approximate_pull_over_distance_ ego vehicle decelerates to this position. or if no feasible
17371739
// stop point is found, stop at this position.
1738-
const auto closest_goal_candidate =
1739-
goal_searcher.getClosetGoalCandidateAlongLanes(goal_candidates_, planner_data_);
1740+
const auto closest_searched_goal_candidate =
1741+
goal_searcher.getClosestGoalCandidateAlongLanes(goal_candidates_, planner_data_);
1742+
const auto closest_goal_candidate = closest_searched_goal_candidate
1743+
? closest_searched_goal_candidate.value().goal_pose
1744+
: route_handler->getOriginalGoalPose();
17401745
const auto decel_pose = calcLongitudinalOffsetPose(
1741-
extended_prev_path.points, closest_goal_candidate.goal_pose.position,
1742-
-approximate_pull_over_distance_);
1746+
extended_prev_path.points, closest_goal_candidate.position, -approximate_pull_over_distance_);
17431747

17441748
// if not approved stop road lane.
17451749
// stop point priority is
@@ -2066,12 +2070,18 @@ double GoalPlannerModule::calcSignedArcLengthFromEgo(
20662070
void GoalPlannerModule::deceleratePath(PullOverPath & pull_over_path) const
20672071
{
20682072
universe_utils::ScopedTimeTrack st(__func__, *time_keeper_);
2073+
assert(goal_searcher_);
2074+
const auto & goal_searcher = goal_searcher_.value();
20692075

20702076
// decelerate before the search area start
2071-
const auto closest_goal_candidate =
2072-
goal_searcher_->getClosetGoalCandidateAlongLanes(goal_candidates_, planner_data_);
2077+
const auto & route_handler = planner_data_->route_handler;
2078+
const auto closest_searched_goal_candidate =
2079+
goal_searcher.getClosestGoalCandidateAlongLanes(goal_candidates_, planner_data_);
2080+
const auto closest_goal_candidate = closest_searched_goal_candidate
2081+
? closest_searched_goal_candidate.value().goal_pose
2082+
: route_handler->getOriginalGoalPose();
20732083
const auto decel_pose = calcLongitudinalOffsetPose(
2074-
pull_over_path.full_path().points, closest_goal_candidate.goal_pose.position,
2084+
pull_over_path.full_path().points, closest_goal_candidate.position,
20752085
-approximate_pull_over_distance_);
20762086
auto & first_path = pull_over_path.partial_paths().front();
20772087
if (decel_pose) {

planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/goal_searcher.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ void GoalSearcher::createAreaPolygons(
550550
}
551551
}
552552

553-
GoalCandidate GoalSearcher::getClosetGoalCandidateAlongLanes(
553+
std::optional<GoalCandidate> GoalSearcher::getClosestGoalCandidateAlongLanes(
554554
const GoalCandidates & goal_candidates,
555555
const std::shared_ptr<const PlannerData> & planner_data) const
556556
{

0 commit comments

Comments
 (0)