Skip to content

Commit 1fcbfc4

Browse files
authored
fix(goal_planner): ignore use bus_stop_area flag if there are no BusStopArea on the pull over lanes (#10274)
Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp>
1 parent 2e5fa85 commit 1fcbfc4

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class LaneParkingPlanner
195195
bool switch_bezier_{false};
196196
void normal_pullover_planning_helper(
197197
const std::shared_ptr<PlannerData> planner_data, const GoalCandidates & goal_candidates,
198-
const BehaviorModuleOutput & upstream_module_output,
198+
const BehaviorModuleOutput & upstream_module_output, const bool use_bus_stop_area,
199199
const lanelet::ConstLanelets current_lanelets, std::optional<Pose> & closest_start_pose,
200200
std::vector<PullOverPath> & path_candidates);
201201
void bezier_planning_helper(

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

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ class GoalSearcher
6060

6161
MultiPolygon2d getAreaPolygons() const { return area_polygons_; }
6262

63+
bool bus_stop_area_available() const { return !bus_stop_area_polygons_.empty(); }
64+
6365
private:
6466
GoalSearcher(
6567
const GoalPlannerParameters & parameters, const LinearRing2d & vehicle_footprint,

planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/goal_planner_module.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ void LaneParkingPlanner::onTimer()
384384
closest_start_pose, path_candidates, sorted_indices_opt);
385385
} else {
386386
normal_pullover_planning_helper(
387-
local_planner_data, goal_candidates, upstream_module_output, current_lanes,
387+
local_planner_data, goal_candidates, upstream_module_output, use_bus_stop_area, current_lanes,
388388
closest_start_pose, path_candidates);
389389
}
390390

@@ -405,7 +405,7 @@ void LaneParkingPlanner::onTimer()
405405

406406
void LaneParkingPlanner::normal_pullover_planning_helper(
407407
const std::shared_ptr<PlannerData> planner_data, const GoalCandidates & goal_candidates,
408-
const BehaviorModuleOutput & upstream_module_output,
408+
const BehaviorModuleOutput & upstream_module_output, const bool use_bus_stop_area,
409409
const lanelet::ConstLanelets current_lanelets, std::optional<Pose> & closest_start_pose,
410410
std::vector<PullOverPath> & path_candidates)
411411
{
@@ -464,7 +464,7 @@ void LaneParkingPlanner::normal_pullover_planning_helper(
464464
if (closest_start_pose) {
465465
const auto original_pose = planner_data->route_handler->getOriginalGoalPose();
466466
if (
467-
parameters_.bus_stop_area.use_bus_stop_area &&
467+
use_bus_stop_area &&
468468
std::fabs(autoware_utils::normalize_radian(
469469
autoware_utils::get_rpy(original_pose).z -
470470
autoware_utils::get_rpy(closest_start_pose.value()).z)) > pull_over_angle_threshold) {
@@ -473,7 +473,7 @@ void LaneParkingPlanner::normal_pullover_planning_helper(
473473
path_candidates.clear();
474474
RCLCPP_INFO(getLogger(), "will generate Bezier Paths next");
475475
}
476-
} else if (parameters_.bus_stop_area.use_bus_stop_area && path_candidates.size() == 0) {
476+
} else if (use_bus_stop_area && path_candidates.size() == 0) {
477477
switch_bezier_ = true;
478478
RCLCPP_INFO(
479479
getLogger(), "Could not find any shift pull over paths, will generate Bezier Paths next");
@@ -649,8 +649,10 @@ std::pair<LaneParkingResponse, FreespaceParkingResponse> GoalPlannerModule::sync
649649
{
650650
std::lock_guard<std::mutex> guard(lane_parking_mutex_);
651651
if (!lane_parking_request_) {
652+
const auto & goal_searcher = goal_searcher_.value();
652653
lane_parking_request_.emplace(
653-
vehicle_footprint_, goal_candidates_, getPreviousModuleOutput(), use_bus_stop_area_);
654+
vehicle_footprint_, goal_candidates_, getPreviousModuleOutput(),
655+
use_bus_stop_area_ && goal_searcher.bus_stop_area_available());
654656
}
655657
// NOTE: for the above reasons, PlannerManager/behavior_path_planner_node ensure that
656658
// planner_data_ is not nullptr, so it is OK to copy as value
@@ -714,7 +716,7 @@ void GoalPlannerModule::updateData()
714716
parameters_.forward_goal_search_length);
715717
const auto bus_stop_area_polygons = goal_planner_utils::getBusStopAreaPolygons(pull_over_lanes);
716718
use_bus_stop_area_ =
717-
parameters_.bus_stop_area.use_bus_stop_area &&
719+
parameters_.bus_stop_area.use_bus_stop_area && goal_searcher.bus_stop_area_available() &&
718720
std::any_of(
719721
bus_stop_area_polygons.begin(), bus_stop_area_polygons.end(), [&](const auto & area) {
720722
const auto & goal_position = planner_data_->route_handler->getOriginalGoalPose().position;

planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/goal_searcher.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,8 @@ GoalCandidates GoalSearcher::search(
227227
vehicle_footprint_, autoware_utils::pose2transform(search_pose));
228228

229229
if (
230-
parameters_.bus_stop_area.use_bus_stop_area &&
231-
!goal_planner_utils::isWithinAreas(
232-
transformed_vehicle_footprint, bus_stop_area_polygons_)) {
230+
use_bus_stop_area && !goal_planner_utils::isWithinAreas(
231+
transformed_vehicle_footprint, bus_stop_area_polygons_)) {
233232
continue;
234233
}
235234

0 commit comments

Comments
 (0)