Skip to content

Commit

Permalink
fix(lane_change): empty check
Browse files Browse the repository at this point in the history
Signed-off-by: Fumiya Watanabe <[email protected]>
  • Loading branch information
rej55 committed May 29, 2024
1 parent a831064 commit 8ce22af
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions planning/behavior_path_lane_change_module/src/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,14 @@ std::vector<DrivableLanes> generateDrivableLanes(

double getLateralShift(const LaneChangePath & path)
{
const auto start_idx = path.info.shift_line.start_idx;
const auto end_idx = path.info.shift_line.end_idx;
if (path.shifted_path.shift_length.empty()) {
return 0.0;
}

const auto start_idx =
std::min(path.info.shift_line.start_idx, path.shifted_path.shift_length.size() - 1);
const auto end_idx =
std::min(path.info.shift_line.end_idx, path.shifted_path.shift_length.size() - 1);

return path.shifted_path.shift_length.at(end_idx) - path.shifted_path.shift_length.at(start_idx);
}
Expand Down

0 comments on commit 8ce22af

Please sign in to comment.