Skip to content

Commit

Permalink
fix(lane_change): prevent empty path when rerouting (autowarefoundati…
Browse files Browse the repository at this point in the history
…on#7717)

fix(lane_change): prevent empty path when routing

Signed-off-by: kosuke55 <[email protected]>
  • Loading branch information
kosuke55 committed Jun 27, 2024
1 parent 970c6f3 commit c215d6f
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,16 @@ void NormalLaneChange::insertStopPoint(

PathWithLaneId NormalLaneChange::getReferencePath() const
{
return utils::getCenterLinePathFromLanelet(
status_.lane_change_path.info.target_lanes.front(), planner_data_);
lanelet::ConstLanelet closest_lanelet;
if (!lanelet::utils::query::getClosestLanelet(
status_.lane_change_path.info.target_lanes, getEgoPose(), &closest_lanelet)) {
return prev_module_output_.reference_path;
}
const auto reference_path = utils::getCenterLinePathFromLanelet(closest_lanelet, planner_data_);
if (reference_path.points.empty()) {
return prev_module_output_.reference_path;
}
return reference_path;
}

std::optional<PathWithLaneId> NormalLaneChange::extendPath()
Expand Down

0 comments on commit c215d6f

Please sign in to comment.