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 authored Jun 27, 2024
1 parent c7f2e1e commit a7e83ff
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,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 a7e83ff

Please sign in to comment.