Skip to content

Commit

Permalink
fix(behavior_velocity): stop line search ego index at returning path …
Browse files Browse the repository at this point in the history
…case (tier4#1000)

Signed-off-by: tanaka3 <ttatcoder@outlook.jp>
  • Loading branch information
taikitanaka3 authored and boyali committed Oct 3, 2022
1 parent 39b8065 commit a1247bf
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ PointWithSearchRangeIndex findFirstNearSearchRangeIndex(
tier4_autoware_utils::validateNonEmpty(points);

bool min_idx_found = false;
bool max_idx_found = false;
PointWithSearchRangeIndex point_with_range = {point, {static_cast<size_t>(0), points.size() - 1}};
for (size_t i = 0; i < points.size(); i++) {
const auto & p = points.at(i).point.pose.position;
Expand All @@ -231,7 +232,10 @@ PointWithSearchRangeIndex findFirstNearSearchRangeIndex(
point_with_range.index.min_idx = i;
min_idx_found = true;
}
point_with_range.index.max_idx = i;
if (!max_idx_found) point_with_range.index.max_idx = i;
} else if (min_idx_found) {
// found close index and farther than distance_thresh, stop update max index
max_idx_found = true;
}
}
return point_with_range;
Expand Down

0 comments on commit a1247bf

Please sign in to comment.