Skip to content

Commit 87137d3

Browse files
soblinvividf
authored andcommitted
feat(goal_planner): reject candidate path whose start pose direction is not aligned with ego path (autowarefoundation#6935)
Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp> Signed-off-by: vividf <yihsiang.fang@tier4.jp>
1 parent 6c3cf79 commit 87137d3

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

planning/behavior_path_goal_planner_module/include/behavior_path_goal_planner_module/goal_planner_module.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,8 @@ class GoalPlannerModule : public SceneModuleInterface
582582
void updateStatus(const BehaviorModuleOutput & output);
583583

584584
// validation
585-
bool hasEnoughDistance(const PullOverPath & pull_over_path) const;
585+
bool hasEnoughDistance(
586+
const PullOverPath & pull_over_path, const PathWithLaneId & long_tail_reference_path) const;
586587
bool isCrossingPossible(
587588
const lanelet::ConstLanelet & start_lane, const lanelet::ConstLanelet & end_lane) const;
588589
bool isCrossingPossible(

planning/behavior_path_goal_planner_module/src/goal_planner_module.cpp

+24-3
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,26 @@ std::optional<std::pair<PullOverPath, GoalCandidate>> GoalPlannerModule::selectP
936936
const std::vector<PullOverPath> & pull_over_path_candidates,
937937
const GoalCandidates & goal_candidates, const double collision_check_margin) const
938938
{
939+
const auto & goal_pose = planner_data_->route_handler->getOriginalGoalPose();
940+
const double backward_length =
941+
parameters_->backward_goal_search_length + parameters_->decide_path_distance;
942+
const auto & prev_module_output_path = getPreviousModuleOutput().path;
943+
const double prev_path_front_to_goal_dist = calcSignedArcLength(
944+
prev_module_output_path.points, prev_module_output_path.points.front().point.pose.position,
945+
goal_pose.position);
946+
const auto & long_tail_reference_path = [&]() {
947+
if (prev_path_front_to_goal_dist > backward_length) {
948+
return prev_module_output_path;
949+
}
950+
// get road lanes which is at least backward_length[m] behind the goal
951+
const auto road_lanes = utils::getExtendedCurrentLanesFromPath(
952+
prev_module_output_path, planner_data_, backward_length, 0.0,
953+
/*forward_only_in_route*/ false);
954+
const auto goal_pose_length = lanelet::utils::getArcCoordinates(road_lanes, goal_pose).length;
955+
return planner_data_->route_handler->getCenterLinePath(
956+
road_lanes, std::max(0.0, goal_pose_length - backward_length),
957+
goal_pose_length + parameters_->forward_goal_search_length);
958+
}();
939959
for (const auto & pull_over_path : pull_over_path_candidates) {
940960
// check if goal is safe
941961
const auto goal_candidate_it = std::find_if(
@@ -947,7 +967,7 @@ std::optional<std::pair<PullOverPath, GoalCandidate>> GoalPlannerModule::selectP
947967
continue;
948968
}
949969

950-
if (!hasEnoughDistance(pull_over_path)) {
970+
if (!hasEnoughDistance(pull_over_path, long_tail_reference_path)) {
951971
continue;
952972
}
953973

@@ -1873,7 +1893,8 @@ bool GoalPlannerModule::checkObjectsCollision(
18731893
return utils::path_safety_checker::checkPolygonsIntersects(ego_polygons_expanded, obj_polygons);
18741894
}
18751895

1876-
bool GoalPlannerModule::hasEnoughDistance(const PullOverPath & pull_over_path) const
1896+
bool GoalPlannerModule::hasEnoughDistance(
1897+
const PullOverPath & pull_over_path, const PathWithLaneId & long_tail_reference_path) const
18771898
{
18781899
const Pose & current_pose = planner_data_->self_odometry->pose.pose;
18791900
const double current_vel = planner_data_->self_odometry->twist.twist.linear.x;
@@ -1885,7 +1906,7 @@ bool GoalPlannerModule::hasEnoughDistance(const PullOverPath & pull_over_path) c
18851906
// otherwise, the goal would change immediately after departure.
18861907
const bool is_separated_path = pull_over_path.partial_paths.size() > 1;
18871908
const double distance_to_start = calcSignedArcLength(
1888-
pull_over_path.getFullPath().points, current_pose.position, pull_over_path.start_pose.position);
1909+
long_tail_reference_path.points, current_pose.position, pull_over_path.start_pose.position);
18891910
const double distance_to_restart = parameters_->decide_path_distance / 2;
18901911
const double eps_vel = 0.01;
18911912
const bool is_stopped = std::abs(current_vel) < eps_vel;

0 commit comments

Comments
 (0)