Skip to content

Commit ad36fc1

Browse files
committed
fix(goal_planner): fix freespace planning chattering (autowarefoundation#8981)
Signed-off-by: kosuke55 <kosuke.tnp@gmail.com>
1 parent aaaf02c commit ad36fc1

File tree

3 files changed

+4
-62
lines changed

3 files changed

+4
-62
lines changed

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

+1-7
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,7 @@ MarkerArray createLaneletPolygonMarkerArray(
141141
MarkerArray createNumObjectsToAvoidTextsMarkerArray(
142142
const GoalCandidates & goal_candidates, std::string && ns,
143143
const std_msgs::msg::ColorRGBA & color);
144-
std::string makePathPriorityDebugMessage(
145-
const std::vector<size_t> & sorted_path_indices,
146-
const std::vector<PullOverPath> & pull_over_path_candidates,
147-
const std::map<size_t, size_t> & goal_id_to_index, const GoalCandidates & goal_candidates,
148-
const std::map<size_t, double> & path_id_to_rough_margin_map,
149-
const std::function<bool(const PullOverPath &)> & isSoftMargin,
150-
const std::function<bool(const PullOverPath &)> & isHighCurvature);
144+
151145
/**
152146
* @brief combine two points
153147
* @param points lane points

planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/goal_planner_module.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,8 @@ BehaviorModuleOutput GoalPlannerModule::planPullOverAsOutput()
14921492
return getPreviousModuleOutput();
14931493
}
14941494

1495+
const bool is_freespace =
1496+
thread_safe_data_.getPullOverPlannerType() == PullOverPlannerType::FREESPACE;
14951497
if (
14961498
hasNotDecidedPath(
14971499
planner_data_, occupancy_grid_map_, *parameters_, ego_predicted_path_params_,
@@ -1540,6 +1542,7 @@ BehaviorModuleOutput GoalPlannerModule::planPullOverAsOutput()
15401542

15411543
// return to lane parking if it is possible
15421544
if (
1545+
is_freespace &&
15431546
thread_safe_data_.getPullOverPlannerType() == PullOverPlannerType::FREESPACE &&
15441547
canReturnToLaneParking()) {
15451548
thread_safe_data_.set_pull_over_path(thread_safe_data_.get_lane_parking_pull_over_path());

planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/util.cpp

-55
Original file line numberDiff line numberDiff line change
@@ -576,61 +576,6 @@ std::vector<Polygon2d> createPathFootPrints(
576576
return footprints;
577577
}
578578

579-
std::string makePathPriorityDebugMessage(
580-
const std::vector<size_t> & sorted_path_indices,
581-
const std::vector<PullOverPath> & pull_over_path_candidates,
582-
const std::map<size_t, size_t> & goal_id_to_index, const GoalCandidates & goal_candidates,
583-
const std::map<size_t, double> & path_id_to_rough_margin_map,
584-
const std::function<bool(const PullOverPath &)> & isSoftMargin,
585-
const std::function<bool(const PullOverPath &)> & isHighCurvature)
586-
{
587-
std::stringstream ss;
588-
589-
// Unsafe goal and its priority are not visible as debug marker in rviz,
590-
// so exclude unsafe goal from goal_priority
591-
std::map<size_t, int> goal_id_and_priority;
592-
for (size_t i = 0; i < goal_candidates.size(); ++i) {
593-
goal_id_and_priority[goal_candidates[i].id] = goal_candidates[i].is_safe ? i : -1;
594-
}
595-
596-
ss << "\n---------------------- path priority ----------------------\n";
597-
for (size_t i = 0; i < sorted_path_indices.size(); ++i) {
598-
const auto & path = pull_over_path_candidates[sorted_path_indices[i]];
599-
// goal_index is same to goal priority including unsafe goal
600-
const int goal_index = static_cast<int>(goal_id_to_index.at(path.goal_id));
601-
const bool is_safe_goal = goal_candidates[goal_index].is_safe;
602-
const int goal_priority = goal_id_and_priority[path.goal_id];
603-
604-
ss << "path_priority: " << i << ", path_type: " << magic_enum::enum_name(path.type)
605-
<< ", path_id: " << path.id << ", goal_id: " << path.goal_id
606-
<< ", goal_priority: " << (is_safe_goal ? std::to_string(goal_priority) : "unsafe")
607-
<< ", margin: " << path_id_to_rough_margin_map.at(path.id)
608-
<< (isSoftMargin(path) ? " (soft)" : " (hard)")
609-
<< ", curvature: " << path.getParkingPathMaxCurvature()
610-
<< (isHighCurvature(path) ? " (high)" : " (low)") << "\n";
611-
}
612-
ss << "-----------------------------------------------------------\n";
613-
return ss.str();
614-
}
615-
616-
lanelet::Points3d combineLanePoints(
617-
const lanelet::Points3d & points, const lanelet::Points3d & points_next)
618-
{
619-
lanelet::Points3d combined_points;
620-
std::unordered_set<lanelet::Id> point_ids;
621-
for (const auto & point : points) {
622-
if (point_ids.insert(point.id()).second) {
623-
combined_points.push_back(point);
624-
}
625-
}
626-
for (const auto & point : points_next) {
627-
if (point_ids.insert(point.id()).second) {
628-
combined_points.push_back(point);
629-
}
630-
}
631-
return combined_points;
632-
}
633-
634579
lanelet::Lanelet createDepartureCheckLanelet(
635580
const lanelet::ConstLanelets & pull_over_lanes, const route_handler::RouteHandler & route_handler,
636581
const bool left_side_parking)

0 commit comments

Comments
 (0)